idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
239,700
protected function createValueWriter ( int $ sourceId , int $ targetId , ExtractorInterface $ extractor , string $ trail ) : WritableTranslationValueInterface { return new WritableTranslationValue ( $ this , $ sourceId , $ targetId , $ extractor , $ trail ) ; }
Create a value writer instance .
239,701
public function addPath ( $ db_filename = null , $ db_directory = null , $ file = null ) { if ( ! empty ( $ db_filename ) && ! in_array ( $ db_filename , $ this -> _paths [ 'language_strings_db_filename' ] ) ) { $ this -> _paths [ 'language_strings_db_filename' ] [ ] = $ db_filename ; } if ( ! empty ( $ db_directory ) ...
Add a path to the registry
239,702
public function getParsedOption ( $ name , $ lang = null , $ default = null ) { $ val = $ this -> getOption ( $ name , $ default ) ; if ( false !== strpos ( $ val , '%s' ) ) { if ( is_null ( $ lang ) ) { $ i18n = I18n :: getInstance ( ) ; $ lang = $ i18n -> getLanguage ( ) ; } if ( is_array ( $ lang ) ) { array_unshift...
Parse an option value replacing %s by the actual language code
239,703
public function buildLanguageFileName ( $ lang , $ db_filename = null ) { if ( empty ( $ db_filename ) ) { $ db_filename = $ this -> getParsedOption ( 'language_strings_db_filename' ) ; } $ filename = pathinfo ( $ db_filename , PATHINFO_FILENAME ) ; return $ this -> getParsedOption ( 'language_filename' , array ( $ fil...
Build the file name for the language database
239,704
public function agregarCabecera ( $ nombre , $ valor ) { if ( isset ( $ this -> cabeceras [ $ nombre ] ) ) { $ this -> cabeceras [ $ nombre ] [ ] = $ valor ; } else { $ this -> cabeceras [ $ nombre ] = [ $ valor ] ; } }
Agrega una cabecera a la respuesta .
239,705
public function agregarGalleta ( $ nombre , $ valor , $ expira = 0 , $ camino = '/' , $ dominio = null , $ seguro = false , $ soloHttp = false ) { $ extras = '' ; if ( $ expira ) { $ extras .= ';Expires=' . gmdate ( 'D, d M Y H:i:s \G\M\T' , $ expira ) ; } if ( $ camino ) { $ extras .= ';Path=' . $ camino ; } if ( $ do...
Agrega una galleta a la respuesta .
239,706
public function enviarArchivo ( $ nombre ) { $ this -> definirCabecera ( 'Pragma' , 'public' ) ; $ this -> definirCabecera ( 'Expires' , '0' ) ; $ this -> definirCabecera ( 'Cache-Control' , 'must-revalidate, post-check=0, pre-check=0' ) ; $ this -> definirCabecera ( 'Content-Length' , ( function_exists ( 'mb_strlen' )...
Envia un archivo al navegador .
239,707
public function redirigir ( $ url , $ estadoHttp = 302 ) { $ this -> definirCabecera ( 'Location' , $ url ) ; $ this -> definirEstadoHttp ( $ estadoHttp ) ; $ this -> definirContenido ( null ) ; return $ this ; }
Redirige el navegador a la URL especificada .
239,708
public function run ( SymfonyRequest $ request = null ) { if ( defined ( 'WELOQUENT_TEST_ENV' ) && WELOQUENT_TEST_ENV ) { return ; } $ request = $ request ? : $ this [ 'request' ] ; $ response = with ( $ stack = $ this -> getStackedClient ( ) ) -> handle ( $ request ) ; if ( ! is_admin ( ) ) { $ response -> sendHeaders...
Run the application and save headers . The response is up to WordPress
239,709
public function getLeaderboardTypes ( ) { $ leaderboardTypesArray = array ( ) ; $ leaderboardTypesService = $ this -> getServiceManager ( ) -> get ( 'playgroundreward_leaderboardtype_service' ) ; $ leaderboardTypes = $ leaderboardTypesService -> getLeaderboardTypeMapper ( ) -> findAll ( ) ; foreach ( $ leaderboardTypes...
retrieve all leaderboard type for associate to storyMapping
239,710
public static function rules ( $ type , $ config = array ( ) ) { $ var = '_' . $ type ; if ( ! isset ( static :: $ { $ var } ) ) { return null ; } if ( empty ( $ config ) ) { return static :: $ { $ var } ; } switch ( $ type ) { case 'transliteration' : $ _config = array ( ) ; foreach ( $ config as $ key => $ val ) { if...
Gets or adds inflection and transliteration rules .
239,711
public static function pluralize ( $ word ) { if ( isset ( static :: $ _pluralized [ $ word ] ) ) { return static :: $ _pluralized [ $ word ] ; } extract ( static :: $ _plural ) ; if ( ! isset ( $ regexUninflected ) || ! isset ( $ regexIrregular ) ) { $ regexUninflected = static :: _enclose ( join ( '|' , $ uninflected...
Changes the form of a word from singular to plural .
239,712
public static function limitExact ( $ value , $ limit = 100 , $ end = '...' ) { if ( static :: length ( $ value ) <= $ limit ) { return $ value ; } $ limit -= static :: length ( $ end ) ; return static :: limit ( $ value , $ limit , $ end ) ; }
Limit the number of chracters in a string including custom ending
239,713
public function getProgress ( $ total = null ) { if ( ! $ this -> progress || $ this -> progress -> getMaxSteps ( ) === $ this -> progress -> getProgress ( ) ) { $ this -> progress = new ProgressBar ( $ this -> output , $ total ) ; } return $ this -> progress ; }
Get progress bar instance
239,714
public function flush ( ) { if ( ! $ this -> progress ) { $ this -> log ( '' ) ; foreach ( $ this -> logs as $ message ) { $ this -> log ( $ message ) ; } $ this -> logs = [ ] ; } }
Flush message queue
239,715
public static function register ( $ implementation ) { $ object = new $ implementation ( ) ; if ( ! ( $ object instanceof \ Phramework \ Authentication \ IAuthentication ) ) { throw new \ Exception ( 'Class is not implementing \Phramework\Authentication\IAuthentication' ) ; } self :: $ implementations [ ] = $ object ; ...
Register an authentication implementation . Implementation must implement \ Phramework \ Authentication \ IAuthentication interface
239,716
public static function check ( $ params , $ method , $ headers ) { if ( count ( self :: $ implementations ) !== 0 && ! self :: $ userGetByEmailMethod ) { throw new \ Phramework \ Exceptions \ ServerException ( 'getUserByEmail method is not set' ) ; } foreach ( self :: $ implementations as $ implementation ) { if ( $ im...
Check user s authentication This method iterates through all available authentication implementations tests in priorioty order which of them might be provided and executes
239,717
public function filter ( \ Closure $ predicate ) { $ filter = array ( ) ; $ filter [ 0 ] = function ( FixedFDirectory $ obj ) use ( $ predicate , & $ filter ) { return $ obj -> filter ( $ predicate ) -> map ( function ( FSObject $ obj ) use ( $ predicate , & $ filter ) { if ( $ obj -> isFile ( ) ) { return $ obj ; } re...
Get a recursor that folds all files in this recursor that match the provided predicate and the objects below that match the predicate as well .
239,718
public function cata ( \ Closure $ trans ) { return $ trans ( $ this -> directory -> unfix ( ) -> fmap ( function ( FSObject $ obj ) use ( $ trans ) { if ( $ obj -> isFile ( ) ) { return $ trans ( $ obj ) ; } assert ( $ obj instanceof FixedFDirectory ) ; return $ obj -> cata ( $ trans ) ; } ) ) ; }
We could also use the catamorphism on this to do recursion as we have an unfix and an underlying fmap from the FDirectory .
239,719
public function foldFiles ( $ start_value , \ Closure $ fold_with ) { foreach ( $ this -> allFiles ( ) as $ file ) { $ start_value = $ fold_with ( $ start_value , $ file ) ; } return $ start_value ; }
Fold over all files in this directory and subjacent directories .
239,720
public function allFiles ( ) { return $ this -> cata ( function ( FSObject $ obj ) { if ( $ obj -> isFile ( ) ) { return array ( $ obj ) ; } assert ( $ obj instanceof FDirectory ) ; $ fcontents = $ obj -> fcontents ( ) ; if ( empty ( $ fcontents ) ) { return $ fcontents ; } return call_user_func_array ( "array_merge" ,...
Get a list of all files in the directory and subjacent directories .
239,721
protected function ensureAccess ( $ params = [ ] ) { if ( ! isset ( $ this -> checkAccess ) ) return ; $ params [ 'action' ] = $ this ; if ( call_user_func ( $ this -> checkAccess , $ params ) ) return ; $ user = \ Yii :: $ app -> user ; if ( $ user -> getIsGuest ( ) ) $ user -> loginRequired ( ) ; else throw new Forbi...
Ensure this action is allowed for current user
239,722
public static function detect ( $ html , & $ error = '' ) { if ( ! class_exists ( 'Whoops\Run' ) ) { return false ; } if ( strpos ( $ html , 'class="Whoops container"' ) != false ) { libxml_use_internal_errors ( true ) ; $ dom = new \ DOMDocument ( ) ; $ dom -> loadHTML ( $ html ) ; $ xpath = new \ DOMXpath ( $ dom ) ;...
Function detect Takes care of detecting if a Whoops error was passed and if true extracting the error code to return it by reference
239,723
public function getSwiftMessage ( ) { $ message = \ Swift_Message :: newInstance ( ) ; if ( true === is_array ( $ this -> getRecipient ( ) ) ) { $ recipient = $ this -> getRecipient ( ) ; } else { $ recipient = [ $ this -> getRecipient ( ) , ] ; } ; $ message -> setSubject ( $ this -> getSubject ( ) ) -> setFrom ( [ $ ...
Get Swift Message
239,724
private function checkMessageStatus ( $ message ) { if ( ! $ message || $ message -> success == 0 || $ message -> failure > 0 ) { throw new DispatchMessageException ( sprintf ( "%d messages could not be processed" , $ message -> failure ) ) ; } }
Checks message status
239,725
private function checkMessageResult ( $ message , \ ArrayIterator $ recipients ) { $ hasDeviceError = false ; $ recipientCount = $ recipients -> count ( ) ; for ( $ i = 0 ; $ i <= $ recipientCount ; $ i ++ ) { if ( isset ( $ message -> results [ $ i ] [ 'registration_id' ] ) ) { $ hasDeviceError = true ; $ recipients -...
Check message result
239,726
public function getOptional ( $ key , $ defaultValue = null ) { if ( array_key_exists ( $ key , $ this -> data ) ) { return $ this -> data [ $ key ] ; } return $ defaultValue ; }
Use this method for optional values .
239,727
protected function registerOptimizeCommand ( ) { $ this -> app -> bindShared ( 'command.optimize' , function ( $ app ) { return new \ Weloquent \ Core \ Console \ OptimizeCommand ( $ app [ 'composer' ] ) ; } ) ; }
Register the optimize command .
239,728
public static function listenTo ( String $ eventId , $ callback ) { if ( ! in_array ( gettype ( $ callback ) , [ 'array' , 'object' , 'closure' ] ) ) { return false ; } EventManager :: $ listeners [ $ eventId ] [ ] = $ callback ; }
Creates a new listener . Two parameters are required . The eventId that will be used to track the current event and the callback which can be either an array or a closure .
239,729
public function attachSubscriber ( Subscriber $ subscriber ) { $ listeners = $ subscriber -> getRegisteredEvents ( ) ; foreach ( $ listeners as $ id => $ listener ) { EventManager :: listenTo ( $ id , array ( $ subscriber , $ listener ) ) ; } }
This method attaches an event through it s subscribe object . List of events are loaded from the subscriber and added to the listeners .
239,730
public static function registerFilters ( Isolator $ isolator = null ) { $ isolator = Isolator :: get ( $ isolator ) ; $ isolator -> stream_filter_register ( 'endec.base16-encode' , 'Eloquent\Endec\Base16\Base16EncodeNativeStreamFilter' ) ; $ isolator -> stream_filter_register ( 'endec.base16-decode' , 'Eloquent\Endec\B...
Register Endec s native stream filters .
239,731
public function get ( $ key ) { $ position = $ this -> getPosition ( $ key ) ; if ( false !== $ position ) { return [ $ key => $ this -> file -> read ( $ position ) ] ; } return false ; }
Retrieves the value based on the key
239,732
public function query ( $ match ) { $ keys = $ this -> index -> getKeys ( ) ; $ matches = array_filter ( $ keys , function ( $ key ) use ( $ match ) { return preg_match ( "/{$match}/i" , $ key ) ; } ) ; $ results = [ ] ; foreach ( $ matches as $ match ) { $ result = $ this -> get ( $ match ) ; $ results [ key ( $ resul...
Queries for Keys matching a case insensitive expression
239,733
public function remove ( $ key ) { $ position = $ this -> getPosition ( $ key ) ; if ( false !== $ position ) { $ this -> file -> remove ( $ position ) ; $ this -> rebuildIndex ( ) ; return true ; } return false ; }
Remove a Value based on its Key
239,734
public function drop ( ) { $ filepath = $ this -> file -> getFilePath ( ) ; unset ( $ this -> file ) ; if ( ! file_exists ( $ filepath ) ) { unlink ( $ filepath ) ; } return true ; }
Removes the Collection database file
239,735
protected function boot ( ) { try { Kernel :: boot ( ) ; if ( true === file_exists ( Kernel :: getPath ( 'app_manifest_filepath' ) ) ) { $ manifest_data = FilesystemHelper :: parseJson ( Kernel :: getPath ( 'app_manifest_filepath' ) ) ; if ( $ manifest_data ) { Kernel :: setConfig ( $ manifest_data , 'manifest' ) ; } e...
This must boot the system
239,736
public function distribute ( $ return = false ) { $ this -> processSessionValues ( ) ; try { $ routing = $ this -> request -> parseWDBRequest ( ) -> getWDBRouting ( ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ this -> processQueryArguments ( ) ; $ input_file = $ this -> getInputFile ( ) ; if ( empty ( $ inpu...
This will distribute the request and return the response
239,737
public function decrypt ( $ crypttext , $ key = null ) { if ( null !== $ key ) { $ this -> _key = md5 ( $ key ) ; } $ crypttext = base64_decode ( $ crypttext ) ; $ plaintext = '' ; $ td = mcrypt_module_open ( $ this -> _cypher , '' , self :: MODE , '' ) ; $ ivsize = mcrypt_enc_get_iv_size ( $ td ) ; $ iv = substr ( $ c...
Decrypt a previously encrypted text
239,738
public function getServiceURL ( $ serviceName , $ isFeedback = false ) { $ serviceName = NotificationServices :: validateServiceName ( $ serviceName ) ; $ serviceType = $ isFeedback ? self :: FEEDBACK_SERVICE : self :: PUSH_SERVICE ; $ environment = $ this -> getEnvironment ( ) ; $ serviceConfig = $ this -> getServiceC...
Gets notification service url by service name
239,739
public function createServiceClient ( $ serviceName , $ isFeedback = false ) { $ serviceUrl = $ this -> getServiceURL ( $ serviceName , $ isFeedback ) ; $ clientClass = sprintf ( 'Zbox\UnifiedPush\NotificationService\%s\%s' , $ serviceName , $ isFeedback ? 'ServiceFeedbackClient' : 'ServiceClient' ) ; $ credentials = $...
Creates client server connection by service name and sender credentials
239,740
public function loadServicesConfig ( ) { $ configPath = $ this -> serviceConfigPath ; if ( ! file_exists ( $ configPath ) ) { throw new InvalidArgumentException ( sprintf ( "Service config file '%s' doesn`t exists" , $ configPath ) ) ; } $ config = json_decode ( file_get_contents ( $ configPath ) , true ) ; if ( ! is_a...
Load notification services connection data
239,741
public static function getFormatByAcceptHeader ( $ header ) { if ( isset ( self :: $ mimeMapper [ $ header ] ) ) { return self :: $ mimeMapper [ $ header ] ; } else { return self :: $ format ; } }
getFormatByAcceptHeader function .
239,742
public static function load ( string $ filename ) { if ( class_exists ( Dotenv :: class ) ) { $ dotenv = new Dotenv ( $ filename ) ; $ dotenv -> load ( ) ; } }
Loads environment variables .
239,743
public static function choose ( $ environment = null ) { if ( ! isset ( $ environment ) ) { if ( isset ( $ _ENV [ "APP_ENV" ] ) ) { switch ( $ _ENV [ "APP_ENV" ] ) { case "dev" : case "development" : default : $ environment = Environment :: DEVELOPMENT ; break ; case "stage" : $ environment = Environment :: STAGE ; bre...
Chooses environment .
239,744
public function getItemsAfter ( ActivityFeedItem $ targetItem ) : array { $ newerItems = [ ] ; foreach ( $ this -> getItems ( ) as $ item ) { if ( $ item -> equals ( $ targetItem ) ) { break ; } $ newerItems [ ] = $ item ; } return $ newerItems ; }
Returns all feed items in this feed that occur after the given item .
239,745
public function merge ( ActivityFeed $ newerFeed ) : ActivityFeed { if ( count ( $ this -> getItems ( ) ) > 0 ) { $ prepend = $ newerFeed -> getItemsAfter ( $ this -> getItems ( ) [ 0 ] ) ; } else { $ prepend = $ newerFeed -> getItems ( ) ; } return new ActivityFeed ( array_merge ( $ prepend , $ this -> getItems ( ) ) ...
Merges this ActivityFeed with a newer feed . Returns a new feed with all new items from the newerFeed prepended to it .
239,746
public function getRouter ( string $ router ) : RouterAbstract { if ( ! array_key_exists ( $ router , $ this -> _routers ) ) $ this -> _routers [ $ router ] = $ this -> getItem ( $ router ) ; return $ this -> _routers [ $ router ] ; }
Get router instance
239,747
protected function isCorrectItem ( \ ReflectionClass $ reflector ) : bool { if ( $ reflector -> isInstance ( $ this ) ) return false ; if ( ! $ reflector -> isSubclassOf ( RouterAbstract :: class ) ) return false ; return true ; }
Is correct item
239,748
public static function generalServiceManager ( Iterable $ serviceConfig = NULL , $ selfRefNames = [ ] ) { if ( ! static :: $ serviceManager ) { if ( is_null ( $ serviceConfig ) ) throw new ServiceException ( sprintf ( "First call of %s must pass a service configuration" , __METHOD__ ) , 13 ) ; $ man = static :: $ servi...
Returns the service manager . The first call of this method should pass a service config info .
239,749
public function get ( $ serviceName ) { $ container = $ this -> serviceData [ $ serviceName ] ?? NULL ; if ( $ container ) { return $ container -> getInstance ( ) ; } if ( in_array ( $ serviceName , $ this -> getSelfReferenceNames ( ) ) ) return $ this ; $ e = new UnknownServiceException ( "Service $serviceName is not ...
Returns the instance of a requested service This method call fails if the service does not exist or something else went wrong during creating the service instance .
239,750
public function set ( string $ serviceName , $ object ) { if ( isset ( $ this -> serviceData [ $ serviceName ] ) || in_array ( $ serviceName , $ this -> getSelfReferenceNames ( ) ) ) { if ( $ this -> replaceExistingServices ( ) ) { trigger_error ( "Service $serviceName is already registered" , E_USER_NOTICE ) ; } else ...
Sets a service
239,751
public function serviceExists ( string $ serviceName ) : bool { return isset ( $ this -> serviceData [ $ serviceName ] ) || in_array ( $ serviceName , $ this -> getSelfReferenceNames ( ) ) ? true : false ; }
Looks if a service with the given name is available
239,752
public function isServiceLoaded ( string $ serviceName ) : bool { if ( $ this -> serviceExists ( $ serviceName ) ) { if ( in_array ( $ serviceName , $ this -> getSelfReferenceNames ( ) ) ) return true ; $ container = $ this -> serviceData [ $ serviceName ] ; return $ container -> isInstanceLoaded ( ) ; } return false ;...
Looks if a service with the given name is available and already is loaded .
239,753
private function _getMapValueHandler ( ) { return function ( $ key , $ value ) { foreach ( $ this -> customArgumentHandler as $ name => $ callable ) { if ( is_callable ( $ callable ) ) { $ value = $ callable ( $ key , $ value ) ; } else trigger_error ( "Custom argument handler $name is not callable" , E_USER_WARNING ) ...
Creates the replacement handler for parameters and service instances
239,754
public function makeServiceInstance ( string $ className , $ arguments = NULL , $ configuration = NULL ) { $ instance = NULL ; $ implInterfaces = class_implements ( $ className ) ; if ( in_array ( ConstructorAwareServiceInterface :: class , $ implInterfaces ) ) { if ( $ args = $ className :: getConstructorArguments ( )...
This method should be used to create service instances . It will check implementations and create it the requested manner .
239,755
public function getServiceClass ( string $ serviceName , bool $ forced = true ) : ? string { if ( ! isset ( $ this -> serviceClassNames [ $ serviceName ] ) ) { if ( $ this -> serviceExists ( $ serviceName ) ) { $ container = $ this -> serviceData [ $ serviceName ] ; if ( $ container -> isInstanceLoaded ( ) ) { $ this -...
Gets the class of a service instance
239,756
public function yieldServices ( array $ serviceNames , array $ classNames , bool $ includeSubclasses = true , bool $ forceClassDetection = true ) { $ matchClass = function ( $ className ) use ( $ includeSubclasses , $ classNames ) { if ( in_array ( $ className , $ classNames ) ) return true ; if ( $ includeSubclasses )...
Yields all services that match required service names or required class names .
239,757
protected function _subjects ( $ path ) { if ( is_file ( $ path ) ) { $ current = new SplFileInfo ( $ path ) ; return $ current -> getExtension ( ) === 'php' ? array ( $ current ) : array ( ) ; } $ files = new RecursiveCallbackFilterIterator ( new RecursiveDirectoryIterator ( $ path ) , function ( $ current , $ key , $...
Retrieves subjects . Will return only PHP files .
239,758
protected function _rules ( ) { $ rules = new Rules ( ) ; $ files = array ( $ this -> config , Libraries :: get ( 'li3_quality' , 'path' ) . '/config/syntax.json' ) ; foreach ( $ files as $ file ) { if ( file_exists ( $ file ) ) { $ this -> out ( "Loading configuration file `{$file}`..." ) ; $ config = json_decode ( fi...
Loads rules configuration .
239,759
public function getWorkflows ( $ order ) { $ workflows = array ( ) ; $ actions = array ( 'confirm' => array ( 'section' => $ this -> getName ( ) , 'title' => 'salesorder.orders.confirm' , 'event' => 'sulu.salesorder.order.confirm.clicked' ) , 'edit' => array ( 'section' => $ this -> getName ( ) , 'title' => 'salesorder...
returns all possible workflows for the current entity
239,760
private function getCreatedAt ( Description $ description ) { $ createdAt = $ description -> getOptionalProperty ( 'createdAt' ) ; return ( $ createdAt !== null ) ? ( new \ DateTimeImmutable ( ) ) -> setTimestamp ( $ createdAt ) : null ; }
Get created at .
239,761
private function getBestPhoto ( Description $ description ) { $ bestPhotoDescription = $ description -> getOptionalProperty ( 'bestPhoto' ) ; if ( $ bestPhotoDescription instanceof Description ) { return $ this -> photoFactory -> create ( $ bestPhotoDescription ) ; } return null ; }
Get best photo .
239,762
private function getRoot ( ) { if ( $ this -> root === NULL ) { $ selector = reset ( $ this -> parameters ) ; $ strategy = key ( $ this -> parameters ) ; if ( $ selector instanceof Element ) { $ this -> root = $ selector ; } else { $ this -> root = $ this -> parent -> findElement ( $ strategy , $ selector ) ; } $ expec...
Get root element of this component .
239,763
public function getInstances ( ) { if ( null === $ this -> instances ) { $ this -> instances = [ ] ; foreach ( $ this -> getAll ( ) as $ className ) { $ className = '\\PHPSemVer\\Trigger\\' . str_replace ( '/' , '\\' , $ className ) ; $ this -> instances [ ] = new $ className ( ) ; } } return $ this -> instances ; }
Get all trigger instances from the config .
239,764
public function actionResetPersonPassword ( $ ccmp_id , $ person_id ) { $ model = $ this -> loadModel ( $ ccmp_id ) ; yii :: import ( 'vendor.dbrisinajumi.person.PersonModule' ) ; $ m = Person :: model ( ) ; $ m -> resetPassword ( $ person_id ) ; $ this -> redirect ( array ( 'adminCustomers' , 'ccmp_id' => $ ccmp_id ) ...
send to user new password
239,765
private function getKeys ( $ argv ) { $ groupKey = null ; $ key = null ; if ( isset ( $ argv [ 0 ] ) ) { if ( $ argv [ 0 ] instanceof Group \ Key ) { $ groupKey = $ argv [ 0 ] ; if ( isset ( $ argv [ 1 ] ) ) { if ( $ argv [ 1 ] instanceof Key ) { $ key = $ argv [ 1 ] ; } else { throw new \ InvalidArgumentException ( "m...
Returns an array to serve as a callable param for call_user_func_array
239,766
public function registerPolicies ( ) { foreach ( $ this -> policies as $ key => $ value ) { Gate :: policy ( $ key , $ value ) ; } }
I cheated this comes from the AuthServiceProvider extended by the App \ Providers \ AuthServiceProvider .
239,767
public function describe ( ) { $ defaultSchema = $ this -> driver -> getDefaultSchema ( ) ; $ description = [ 'schemata' => [ ] , ] ; $ schemata = $ this -> getSchemata ( ) ; foreach ( $ schemata as $ schema ) { if ( $ schema [ 'name' ] == $ defaultSchema ) { $ description [ 'tables' ] = $ this -> describeTables ( $ de...
Returns the description of the database as an array .
239,768
private function throwTableExceptions ( $ tables , $ requestedTables ) { $ foundTables = [ ] ; foreach ( $ tables as $ table ) { $ foundTables [ ] = $ table [ 'name' ] ; } foreach ( $ requestedTables as $ requestedTable ) { if ( array_search ( $ requestedTable , $ foundTables ) === false ) { throw new exceptions \ Tabl...
Throws exceptions for which are found in the list of requested tables but not found in the list of found tables .
239,769
public static function toFile ( Stringset $ set , $ filename ) { try { $ str = self :: toString ( $ set , $ options ) ; if ( ! file_exists ( $ filename ) || is_writable ( $ filename ) ) { file_put_contents ( $ filename , $ str ) ; } else { throw new Exception ( "Cannot write to file" ) ; } } catch ( \ Exception $ e ) {...
Takes a Stringset and a filename and writes a po formatted file .
239,770
public static function toString ( Stringset $ set ) { $ str = '' ; for ( $ i = 0 ; $ i < $ set -> size ( ) ; $ i += 1 ) { $ item = $ set -> item ( $ i ) ; if ( count ( $ item [ 'flags' ] ) > 0 ) { $ str .= "#, " . implode ( ", " , $ item [ 'flags' ] ) . "\n" ; } if ( $ item [ 'context' ] !== null ) { $ str .= "msgctxt ...
Takes a Stringset and an array of options and creates a po formatted string .
239,771
private static function escapeString ( $ str ) { if ( strlen ( $ str ) === 0 ) { return $ str ; } $ str = str_replace ( array ( "\r" , "\t" , "\\" , "\$" , "\v" , "\e" , "\f" , "\"" ) , array ( '\r' , '\t' , '\\\\' , '\$' , '\v' , '\e' , '\f' , '\"' ) , $ str ) ; $ str = str_replace ( "\n" , "\\n\"\n\"" , $ str ) ; $ r...
Adds escapes to characters that are in some way special .
239,772
public static function fromString ( $ str ) { $ stringset = new Stringset ( ) ; $ entry = array ( ) ; $ state = null ; $ line = 1 ; foreach ( explode ( "\n" , $ str ) as $ line ) { $ line = trim ( $ line ) ; if ( strlen ( $ line ) === 0 ) { if ( count ( $ entry ) > 0 ) { $ stringset -> add ( $ entry ) ; $ entry = array...
Takes a string in the format of a po file and returns a Stringset
239,773
private static function parseString ( $ str ) { if ( $ str [ 0 ] !== '"' || $ str [ strlen ( $ str ) - 1 ] !== '"' ) { throw new Exception ( "Invalid string delimiters" ) ; } $ result = '' ; $ start = str_split ( substr ( $ str , 1 , - 1 ) , 1 ) ; $ escaped = false ; $ data = null ; foreach ( $ start as $ chr ) { if ( ...
PHP String parsing without using eval .
239,774
public function go ( ) { if ( $ this -> action == "options" ) { $ file = "options" . $ this -> getExtension ( ) ; } else { if ( $ this -> route -> route == "/" ) { $ file = $ this -> getAction ( ) . $ this -> getExtension ( ) ; } else { $ file = $ this -> route -> resource . "/" . $ this -> getAction ( ) . $ this -> ge...
Load file and dispatch to response
239,775
public function getAction ( ) { if ( $ this -> action ) { return $ this -> action ; } else { $ action = "index" ; switch ( $ _SERVER [ 'REQUEST_METHOD' ] ) { case "GET" : if ( count ( $ this -> getFilterParameters ( ) ) == 0 ) { $ action = "index" ; } else { $ action = "get" ; } break ; case "POST" : $ action = "post" ...
Return current action
239,776
private static function getProps ( $ class ) { if ( $ class == NULL ) { return array ( ) ; } $ class = new \ ReflectionClass ( $ class ) ; $ properties = array_filter ( $ class -> getProperties ( ) , function ( $ prop ) use ( $ class ) { return $ prop -> getDeclaringClass ( ) -> name == $ class -> name ; } ) ; return $...
return props of a class
239,777
private function createService ( stdClass $ serviceData ) { $ this -> comment ( '' ) ; $ this -> comment ( '*************************************' ) ; $ this -> comment ( '* Service creation *' ) ; $ this -> comment ( '*************************************' ) ; $ this -> comment ( $ serviceData -> serv...
Generating service information
239,778
private function loadConfiguration ( ) { $ allFiles = File :: allFiles ( '_automate' ) ; foreach ( $ allFiles as $ file ) if ( strpos ( ( string ) $ file , '.done' ) === false ) $ this -> configurationData [ ] = $ this -> optimizeData ( $ file ) ; }
Loading configuration files
239,779
private function checkPackage ( stdClass $ item ) { if ( ! file_exists ( $ item -> rootDirectory ) ) $ this -> abort ( 'Package ' . $ item -> directory . ' not existing, please create a repository and launch "php artisan hc:new-package" command' ) ; }
Checking package existence
239,780
protected function executeAfterAbort ( ) { foreach ( $ this -> createdFiles as $ value ) { File :: delete ( $ value ) ; $ this -> error ( 'Deleted: ' . $ value ) ; } }
Restoring changed files after the abort Deleting create files
239,781
private function updateActions ( stdClass $ config , stdClass $ serviceData ) { $ servicePermissions = [ "name" => "admin." . $ serviceData -> serviceRouteName , "controller" => $ serviceData -> controllerNamespace . '\\' . $ serviceData -> controllerName , "actions" => [ $ serviceData -> aclPrefix . "_list" , $ servic...
Updating service actions
239,782
private function updateRolesActions ( stdClass $ config , stdClass $ serviceData ) { $ rolesActions = [ "project-admin" => [ $ serviceData -> aclPrefix . "_list" , $ serviceData -> aclPrefix . "_create" , $ serviceData -> aclPrefix . "_update" , $ serviceData -> aclPrefix . "_delete" , ] , ] ; if ( empty ( $ config -> ...
Updating roles actions
239,783
private function updateMenu ( stdClass $ config , stdClass $ serviceData ) { $ menuItem = [ "route" => 'admin.' . $ serviceData -> serviceRouteName . '.index' , "translation" => $ serviceData -> translationsLocation . '.page_title' , "icon" => $ serviceData -> serviceIcon , "aclPermission" => $ serviceData -> aclPrefix...
Updating menu parameter
239,784
private function updateFormManager ( stdClass $ config , stdClass $ serviceData ) { $ config -> formData = json_decode ( json_encode ( $ config -> formData ) , true ) ; if ( ! isset ( $ config -> formData [ $ serviceData -> formID ] ) ) $ config -> formData [ $ serviceData -> formID ] = $ serviceData -> formNameSpace ....
Updating form manager
239,785
public function getConfiguration ( $ namespace , $ element , $ key , $ default = null ) { $ propertyPath = sprintf ( '[%s][%s][%s]' , $ namespace , $ element , $ key ) ; if ( $ value = $ this -> propertyAccessor -> getValue ( $ this -> configurations , $ propertyPath ) ) { return $ value ; } return $ default ; }
Return configuration value under given property path into given namespace or default if not readable .
239,786
protected function startSession ( ) { if ( session_status ( ) == PHP_SESSION_NONE ) { session_start ( ) ; if ( ! $ this -> expireOnClose ) { setcookie ( 'planet_session' , session_id ( ) , time ( ) + ( $ this -> expireTime * 60 ) , '/' , null , false , false ) ; } } }
To start session
239,787
public function pull ( $ name , $ value = '' ) { $ value = $ this -> get ( $ name , $ value ) ; $ this -> delete ( $ name ) ; return $ value ; }
To pull session data
239,788
public function pop ( $ name ) { $ previousValue = $ this -> get ( $ name ) ; $ value = array_pop ( $ previousValue ) ; $ this -> create ( $ name , $ previousValue ) ; return $ value ; }
To pop session data from session array
239,789
public function shift ( $ name ) { $ previousValue = $ this -> get ( $ name ) ; $ value = array_shift ( $ previousValue ) ; $ this -> create ( $ name , $ previousValue ) ; return $ value ; }
To shift session data from session array
239,790
protected function getRealClass ( $ stack , $ extensionNamespace ) { $ stackPath = \ Staq \ Util :: convertNamespaceToPath ( $ stack ) ; $ absolutePath = realpath ( $ this -> extensions [ $ extensionNamespace ] . '/Stack/' . $ stackPath . '.php' ) ; if ( is_file ( $ absolutePath ) ) { $ realClass = $ extensionNamespace...
stack is now a part of the namespace there is no burgers left at my bakery
239,791
public function filter ( $ value ) { if ( ! $ this -> allowComments ) { $ value = preg_replace ( '/<!\-\-.*\-\->/U' , '' , $ value ) ; } $ allowed = '' ; foreach ( $ this -> allowedTags as $ tag ) { $ allowed .= "<{$tag}>" ; } $ value = strip_tags ( $ value , $ allowed ) ; if ( ! empty ( $ this -> allowedTags ) ) { $ a...
Strip the undesired HTML markup
239,792
public function setAllowedTags ( $ tags ) { if ( ! is_array ( $ tags ) ) { $ tags = [ $ tags ] ; } $ this -> allowedTags = $ tags ; return $ this ; }
Set the HTML tags that should be left in the input string
239,793
public function setAllowedAttributes ( $ attributes ) { if ( ! is_array ( $ attributes ) ) { $ attributes = [ $ attributes ] ; } $ this -> allowedAttributes = $ attributes ; return $ this ; }
Set the HTML attributes that should be left in the unstripped tags in the input string
239,794
function write ( $ content , $ inByte = null ) { $ this -> _assertWritable ( ) ; $ stream = $ this -> resource ( ) -> getRHandler ( ) ; $ inByte = ( $ inByte === null ) ? $ this -> getBuffer ( ) : $ inByte ; $ content = ( string ) $ content ; if ( null === $ inByte ) $ ret = fwrite ( $ stream , $ content ) ; else $ ret...
Writes the contents of string to the file stream
239,795
function sendData ( $ data , $ flags = null ) { $ rHandler = $ this -> resource ( ) -> getRHandler ( ) ; if ( $ flags === null ) { if ( $ this -> resource ( ) -> meta ( ) -> getStreamType ( ) == 'udp_socket' ) $ flags = STREAM_PEEK ; else $ flags = STREAM_SOCK_RDM ; } $ ret = @ stream_socket_sendto ( $ rHandler , $ dat...
Sends the specified data through the socket whether it is connected or not
239,796
function rewind ( ) { $ this -> _assertSeekable ( ) ; $ stream = $ this -> resource ( ) -> getRHandler ( ) ; if ( false === rewind ( $ stream ) ) throw new \ RuntimeException ( 'Cannot rewind stream' ) ; return $ this ; }
Move the file pointer to the beginning of the stream
239,797
public function getPagedResults ( $ limit = 50 , $ page = 0 ) { $ dql = sprintf ( self :: DQL_GET_VCSS , VersionControlProvider :: class ) ; return $ this -> getPaginator ( $ dql , $ limit , $ page ) ; }
Get all VCSs paged .
239,798
public function get_callback_reflection ( ) { if ( is_array ( $ this -> callback ) ) { return new \ ReflectionMethod ( $ this -> callback [ 0 ] , $ this -> callback [ 1 ] ) ; } else { return new \ ReflectionFunction ( $ this -> callback ) ; } }
Get a reflection object for the callback function .
239,799
protected function pushClassData ( array $ data , \ ReflectionClass $ reflector ) : array { return $ this -> collectClassData ( $ reflector -> newInstanceWithoutConstructor ( ) , $ data , $ reflector ) ; }
Push class data