idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
58,800
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 .
58,801
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
58,802
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
58,803
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
58,804
public function drop ( ) { $ filepath = $ this -> file -> getFilePath ( ) ; unset ( $ this -> file ) ; if ( ! file_exists ( $ filepath ) ) { unlink ( $ filepath ) ; } return true ; }
Removes the Collection database file
58,805
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
58,806
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
58,807
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
58,808
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
58,809
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
58,810
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
58,811
public static function getFormatByAcceptHeader ( $ header ) { if ( isset ( self :: $ mimeMapper [ $ header ] ) ) { return self :: $ mimeMapper [ $ header ] ; } else { return self :: $ format ; } }
getFormatByAcceptHeader function .
58,812
public static function load ( string $ filename ) { if ( class_exists ( Dotenv :: class ) ) { $ dotenv = new Dotenv ( $ filename ) ; $ dotenv -> load ( ) ; } }
Loads environment variables .
58,813
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 .
58,814
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 .
58,815
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 .
58,816
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
58,817
protected function isCorrectItem ( \ ReflectionClass $ reflector ) : bool { if ( $ reflector -> isInstance ( $ this ) ) return false ; if ( ! $ reflector -> isSubclassOf ( RouterAbstract :: class ) ) return false ; return true ; }
Is correct item
58,818
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 .
58,819
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 .
58,820
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
58,821
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
58,822
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 .
58,823
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
58,824
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 .
58,825
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
58,826
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 .
58,827
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 .
58,828
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 .
58,829
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
58,830
private function getCreatedAt ( Description $ description ) { $ createdAt = $ description -> getOptionalProperty ( 'createdAt' ) ; return ( $ createdAt !== null ) ? ( new \ DateTimeImmutable ( ) ) -> setTimestamp ( $ createdAt ) : null ; }
Get created at .
58,831
private function getBestPhoto ( Description $ description ) { $ bestPhotoDescription = $ description -> getOptionalProperty ( 'bestPhoto' ) ; if ( $ bestPhotoDescription instanceof Description ) { return $ this -> photoFactory -> create ( $ bestPhotoDescription ) ; } return null ; }
Get best photo .
58,832
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 .
58,833
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 .
58,834
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
58,835
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
58,836
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 .
58,837
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 .
58,838
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 .
58,839
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 .
58,840
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 .
58,841
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 .
58,842
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
58,843
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 .
58,844
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
58,845
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
58,846
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
58,847
private function createService ( stdClass $ serviceData ) { $ this -> comment ( '' ) ; $ this -> comment ( '*************************************' ) ; $ this -> comment ( '* Service creation *' ) ; $ this -> comment ( '*************************************' ) ; $ this -> comment ( $ serviceData -> serv...
Generating service information
58,848
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
58,849
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
58,850
protected function executeAfterAbort ( ) { foreach ( $ this -> createdFiles as $ value ) { File :: delete ( $ value ) ; $ this -> error ( 'Deleted: ' . $ value ) ; } }
Restoring changed files after the abort Deleting create files
58,851
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
58,852
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
58,853
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
58,854
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
58,855
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 .
58,856
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
58,857
public function pull ( $ name , $ value = '' ) { $ value = $ this -> get ( $ name , $ value ) ; $ this -> delete ( $ name ) ; return $ value ; }
To pull session data
58,858
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
58,859
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
58,860
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
58,861
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
58,862
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
58,863
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
58,864
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
58,865
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
58,866
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
58,867
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 .
58,868
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 .
58,869
protected function pushClassData ( array $ data , \ ReflectionClass $ reflector ) : array { return $ this -> collectClassData ( $ reflector -> newInstanceWithoutConstructor ( ) , $ data , $ reflector ) ; }
Push class data
58,870
protected function collectClassData ( $ item , array $ data , \ ReflectionClass $ reflector ) : array { foreach ( $ this -> getClassVariants ( $ reflector , $ item ) as $ name ) { $ key = $ this -> getItemKey ( $ name ) ; if ( ! array_key_exists ( $ key , $ data [ 'data' ] ) || $ this -> isItemGreedy ( $ data [ 'data' ...
Collect class data
58,871
protected function addClassData ( array $ data , string $ key , \ ReflectionClass $ reflector , $ item , $ variant ) : array { $ data [ 'data' ] [ $ key ] = $ this -> getClassData ( $ reflector , $ item , $ variant ) ; return $ data ; }
Add class data
58,872
protected function isItemGreedy ( array $ info , \ ReflectionClass $ reflector , $ item ) : bool { $ base = new \ ReflectionClass ( $ info [ 'class' ] ) ; if ( $ reflector -> isSubclassOf ( $ base -> getName ( ) ) ) return true ; if ( ! $ base -> isSubclassOf ( $ reflector -> getName ( ) ) ) throw new \ LogicException ...
Returns true if item is greedy
58,873
protected function getClassBaseNames ( $ item ) : array { $ basenames = array ( ) ; $ reflector = new \ ReflectionClass ( $ item ) ; do { if ( ! $ reflector -> isAbstract ( ) ) { $ docComment = $ reflector -> getDocComment ( ) ; if ( $ docComment && strpos ( $ docComment , '@easy-extend-base' ) !== false ) { $ basename...
Get class base names
58,874
protected function getClassTraits ( \ ReflectionClass $ reflector ) : array { $ class = $ reflector -> getName ( ) ; $ traits = array ( ) ; do { $ traits = array_merge ( class_uses ( $ class ) , $ traits ) ; } while ( $ class = get_parent_class ( $ class ) ) ; foreach ( $ traits as $ trait ) $ traits = array_merge ( cl...
Get class traits
58,875
public function getItemData ( $ name ) : array { if ( func_num_args ( ) > 1 ) $ name = func_get_args ( ) ; if ( ! $ this -> hasItemData ( $ name ) ) return $ this -> getItemDataNotFound ( $ name ) ; return $ this -> getData ( ) [ $ this -> getItemKey ( $ name ) ] ; }
Get item data
58,876
public function hasItemData ( $ name ) : bool { if ( func_num_args ( ) > 1 ) $ name = func_get_args ( ) ; return array_key_exists ( $ this -> getItemKey ( $ name ) , $ this -> getData ( ) ) ; }
Has item data
58,877
public function getItemKey ( $ name ) : string { if ( func_num_args ( ) > 1 ) $ name = func_get_args ( ) ; if ( is_array ( $ name ) ) return implode ( '|' , $ name ) ; return ( string ) $ name ; }
Returns item key
58,878
public function isValid ( ) { $ valid = $ this -> valid ; if ( $ this -> isMultiple ( ) ) { $ valid = $ this -> isMultipleValid ( ) ; } return $ valid ; }
Check if the value is valid
58,879
protected function isMultipleValid ( ) { if ( ! $ this -> isRendering ( ) ) { return empty ( $ this -> invalidInstances ) ; } return ! in_array ( $ this -> getInstance ( ) , $ this -> invalidInstances ) ; }
Validates when input is set to be multiple
58,880
protected function validateArray ( array $ values , $ context ) { foreach ( $ values as $ key => $ value ) { $ valid = $ this -> getValidationChain ( ) -> validates ( $ value , $ context ) ; if ( ! $ valid ) { $ this -> setInvalid ( $ key ) ; } } }
Validates input when is set to be multiple
58,881
public function addValidator ( $ validator , $ message = null ) { try { $ msg = $ message ; if ( is_array ( $ message ) ) { $ msg = array_shift ( $ message ) ; $ this -> context = $ message ; } $ validator = StaticValidator :: create ( $ validator , $ msg ) ; $ this -> getValidationChain ( ) -> add ( $ validator ) ; if...
Adds a validator to the validation chain
58,882
public function getReferer ( ) { $ referer = null ; if ( array_key_exists ( self :: REFERER_KEY , $ this -> serverData ) ) { $ referer = $ this -> serverData [ self :: REFERER_KEY ] ; } return $ referer ; }
Get the HTTP REFERER from the server data .
58,883
public function collect ( MvcEvent $ mvcEvent ) { $ layout = $ mvcEvent -> getViewModel ( ) ; $ blocks = [ ] ; foreach ( $ this -> layout -> getBlocks ( ) as $ blockId => $ block ) { if ( $ parentBlock = $ block -> getOption ( 'parent' ) ) { $ captureTo = $ parentBlock . '::' . $ block -> captureTo ( ) ; } else { $ cap...
collect data for zdt
58,884
private function resolveTemplate ( $ template ) { $ template = str_replace ( getcwd ( ) , '' , $ this -> viewResolver -> resolve ( $ template ) ) ; return $ template ; }
retrieve resolved template path
58,885
function meta ( ) { if ( ! $ this -> _rMetaInfo ) $ this -> _rMetaInfo = new MetaReaderOfPhpResource ( $ this -> getRHandler ( ) ) ; return $ this -> _rMetaInfo ; }
Meta Data About Handler
58,886
function removeFilter ( iFilterStream $ filter ) { $ filterName = $ filter -> getLabel ( ) ; if ( isset ( $ this -> attachedFilters [ $ filterName ] ) ) { $ filterRes = $ this -> attachedFilters [ $ filterName ] ; stream_filter_remove ( $ filterRes ) ; unset ( $ this -> attachedFilters [ $ filterName ] ) ; } return $ t...
Remove Given Filter From Resource
58,887
public function select ( array $ configs , $ options ) { $ label = ( ! empty ( $ options [ 'name' ] ) ? ucwords ( $ options [ 'name' ] ) : '' ) ; return ' <div class="input-field"> ' . parent :: plainSelect ( array_merge ( [ 'id' => $ this -> genId ( $ label ) , ] , $ configs ) , $ options ) . ( empty ( $...
Generate a select .
58,888
public function textarea ( array $ options , $ text = '' ) { $ label = ( ! empty ( $ options [ 'name' ] ) ? ucwords ( $ options [ 'name' ] ) : '' ) ; return ' <div class="input-field"> ' . parent :: plainTextarea ( array_merge ( [ 'class' => 'materialize-textarea' , 'id' => $ this -> genId ( $...
Generate a textarea .
58,889
public function input ( array $ options ) { $ label = ( ! empty ( $ options [ 'name' ] ) ? ucwords ( $ options [ 'name' ] ) : '' ) ; return ' <div class="input-field"> ' . parent :: plainInput ( array_merge ( [ 'class' => 'validate' , 'id' => $ this -> genId ( $ label ) , ] , $ options ) ) . ( emp...
Generate an input area .
58,890
final public function addPropertyIf ( Bool $ condition = null , String $ property , $ value = null ) { if ( $ condition == true ) { $ this -> softProperties [ $ property ] = $ value ; } }
Adds a property to list of soft properties if condition is true .
58,891
final public function addPropertyIfNot ( Bool $ condition = null , String $ property , $ value = null ) { if ( $ condition == false ) { $ this -> softProperties [ $ property ] = $ value ; } }
Adds a property to list of soft properties if condition is false .
58,892
public function hasRelation ( String $ label ) : Bool { if ( isset ( $ this -> relations [ $ label ] ) ) { return true ; } return false ; }
Checks if model is related to another model .
58,893
protected function toSql ( $ fields = null ) : QueryBuilder { $ queryBuilder = $ this -> queryBuilder ( ) -> select ( $ fields ) -> from ( $ this -> table ) ; $ orderBy = [ ] ; if ( isset ( Model :: $ findOptions [ 'asc' ] ) ) { $ orderBy [ ] = Model :: $ findOptions [ 'asc' ] . ' ASC' ; } if ( isset ( Model :: $ findO...
Returns a prepared query that will be used by other find methods .
58,894
protected function isAccessible ( String $ property ) : Bool { if ( in_array ( $ property , $ this -> accessibleProperties ( ) ) ) { return true ; } return false ; }
Checks if a property can be accessed .
58,895
private static function getPostfix ( Option $ Option ) { $ postfix = '' ; if ( $ Option -> getType ( ) == Option :: TYPE_STRING ) { $ postfix .= ':' ; if ( ! $ Option -> isRequired ( ) ) { $ postfix .= ':' ; } } return $ postfix ; }
Method to build getopt parameter postfix for option
58,896
private function getOptionsSearchStrings ( ) { if ( empty ( $ this -> searchStringsCache ) ) { $ this -> searchStringsCache = array ( 0 => '' , 1 => array ( ) , ) ; foreach ( $ this -> parameters as $ Option ) { $ postfix = self :: getPostfix ( $ Option ) ; $ this -> searchStringsCache [ 0 ] .= $ Option -> getShort ( )...
Method to get getopt parameters for command line parsing
58,897
public function parse ( $ panic = false ) { list ( $ shorts , $ longs ) = $ this -> getOptionsSearchStrings ( ) ; $ options = getopt ( $ shorts , $ longs ) ; $ Exception = null ; foreach ( $ this -> parameters as $ Option ) { $ short = $ Option -> getShort ( ) ; $ long = $ Option -> getLong ( ) ; switch ( true ) { case...
POSIX parse command line method
58,898
public function displayHelp ( ) { $ string = 'Using: ' . $ this -> script . ' ' . $ this -> command . ' ' ; $ where = array ( ) ; foreach ( $ this -> parameters as $ Option ) { $ short = $ Option -> getShort ( ) ; $ long = $ Option -> getLong ( ) ; $ temp = '-' . $ short . '|--' . $ long ; if ( ! $ Option -> isRequired...
Display command help
58,899
private function setOptionValue ( Option $ Option , $ value ) { $ Option -> setValue ( $ value ) ; $ long = $ Option -> getLong ( ) ; if ( isset ( $ this -> events [ $ long ] ) ) { $ Handler = $ this -> events [ $ long ] ; $ Handler ( $ long , $ value ) ; } }
Method to set option value and call event handler if needed