idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
48,000 | protected function urlByRouteSectionsMedia ( \ MvcCore \ IRoute & $ route , array & $ params = [ ] , array & $ defaultParams = [ ] , $ routeMethod = NULL ) { $ mediaVersionUrlParam = static :: URL_PARAM_MEDIA_VERSION ; if ( isset ( $ params [ $ mediaVersionUrlParam ] ) ) { $ mediaSiteVersion = $ params [ $ mediaVersion... | Return media site version for result URL as media site version param name string and media site version param value string . |
48,001 | public function field ( $ name , array $ options = [ ] ) { $ options += [ 'features' => null , 'size' => 'beta' , 'help' => true ] ; $ classes = [ ] ; $ classes [ ] = 'use-editor' ; $ classes [ ] = 'editor-size--' . $ options [ 'size' ] ; if ( is_string ( $ options [ 'features' ] ) ) { $ options [ 'features' ] = Settin... | as features . |
48,002 | public function save ( array $ fields = [ ] ) { if ( $ this -> getIsNewRecord ( ) ) { if ( $ this -> parent ) { $ this -> appendTo ( $ this -> parent ) ; } else { $ this -> makeRoot ( ) ; } return parent :: save ( $ fields ) ; } if ( in_array ( 'parent_id' , $ this -> getDirtyAttributes ( ) ) ) { $ saved = parent :: sa... | Create root node if multiple - root tree mode . Update node if it s not new . |
48,003 | public function moveAsRoot ( ) { if ( $ this -> getIsNewRecord ( ) ) { throw new Exception ( 'The node should not be new record.' ) ; } if ( $ this -> isRoot ( ) ) { throw new Exception ( 'The node already is root node.' ) ; } $ delta = 1 - $ this -> lft ; $ this -> objects ( ) -> filter ( [ 'lft__gte' => $ this -> lft... | Move node as new root . |
48,004 | public function isDescendantOf ( $ subj ) { return ( $ this -> lft > $ subj -> lft ) && ( $ this -> rgt < $ subj -> rgt ) && ( $ this -> root === $ subj -> root ) ; } | Determines if node is descendant of subject node . |
48,005 | static public function make_ ( string $ url , string $ method , array $ request_transformer_meta , array $ response_transformer_meta , string $ request_content_type , string $ response_content_type = null ) : self { return new static ( $ url , $ method , Transformer :: make_ ( $ request_transformer_meta ) , Transformer... | Static method make_ |
48,006 | private static function checkOptions ( $ options ) { if ( ! isset ( $ options [ 'retries' ] ) || ! is_int ( $ options [ 'retries' ] ) || $ options [ 'retries' ] <= 0 ) { throw new \ InvalidArgumentException ( 'retry: the options.retries must be an integer with a positive value' ) ; } if ( ! isset ( $ options [ 'interva... | Check the options throw an InvalidArgumentException on invalid format value . |
48,007 | public function createCache ( Application $ app ) { $ cache = new Pimple ; foreach ( $ app [ 'ems.options' ] as $ name => $ options ) { $ cache [ $ name ] = $ cache -> share ( function ( ) use ( $ app , $ cache , $ options ) { $ class = 'Doctrine\Common\Cache\\' . $ options [ 'caching_driver' ] ; switch ( $ options [ '... | Creates the cache instances for the entity managers . |
48,008 | public function createConfig ( Application $ app ) { $ config = new Pimple ; foreach ( $ app [ 'ems.options' ] as $ name => $ options ) { $ config [ $ name ] = $ config -> share ( function ( ) use ( $ app , $ name , $ options ) { $ config = new Configuration ; $ config -> setAutoGenerateProxyClasses ( $ options [ 'prox... | Creates the configuration instances for the entity managers . |
48,009 | public function createEntityManager ( Application $ app ) { $ ems = new Pimple ; foreach ( $ app [ 'ems.options' ] as $ name => $ options ) { $ ems [ $ name ] = $ ems -> share ( function ( ) use ( $ app , $ name , $ options ) { if ( false === isset ( $ options [ 'db' ] ) ) { $ options [ 'db' ] = $ name ; } if ( isset (... | Creates the entity manager instances . |
48,010 | public function createMapping ( Application $ app ) { $ mapping = new Pimple ; foreach ( $ app [ 'ems.options' ] as $ name => $ options ) { $ mapping [ $ name ] = $ mapping -> share ( function ( ) use ( $ app , $ options ) { $ class = 'Doctrine\ORM\Mapping\Driver\\' . $ options [ 'mapping_driver' ] ; switch ( $ options... | Creates the mapping instances for the entity managers . |
48,011 | public function canHandle ( $ type , $ namespace ) { if ( $ type === null ) { if ( $ this -> namespace === null || $ namespace !== $ this -> namespace ) { return false ; } } else { if ( $ this -> type !== $ type ) { return false ; } else if ( $ namespace !== null && $ this -> namespace !== $ namespace ) { return false ... | Determine if the handler can handle an event type and namespace |
48,012 | private function loadNativeServices ( ) : void { self :: $ Memory = MemoryObject :: instance ( ) ; self :: $ Properties = new Properties ( ) ; if ( isset ( $ this -> _services [ 'Debug' ] ) && $ this -> _services [ 'Debug' ] === true && Debug :: isEnabled ( ) ) { self :: $ Debug = new Debug ( ) ; $ this -> startMeasure... | Prepare native static symbolic links for app services |
48,013 | private function loadDynamicServices ( ) : void { $ this -> startMeasure ( __METHOD__ ) ; $ objects = App :: $ Properties -> getAll ( 'object' ) ; if ( ! Any :: isArray ( $ objects ) ) { throw new NativeException ( 'Object configurations is not loaded: /Private/Config/Object.php' ) ; } foreach ( $ objects as $ name => ... | Prepare dynamic static links from object configurations as anonymous functions |
48,014 | public function run ( ) : void { try { $ callClass = $ this -> getCallbackClass ( ) ; $ callMethod = 'action' . self :: $ Request -> getAction ( ) ; $ arguments = self :: $ Request -> getArguments ( ) ; if ( ! method_exists ( $ callClass , $ callMethod ) ) { throw new NotFoundException ( 'Method "' . App :: $ Security ... | Run applications and display output . Main entry point of system . |
48,015 | private function getCallbackClass ( ) { $ cName = ( self :: $ Request -> getCallbackAlias ( ) ?? '\Apps\Controller\\' . env_name . '\\' . self :: $ Request -> getController ( ) ) ; if ( ! class_exists ( $ cName ) ) { throw new NotFoundException ( 'Callback class not found: ' . App :: $ Security -> strip_tags ( $ cName ... | Get callback class instance |
48,016 | final public function setDelegates ( array $ delegates ) { $ this -> delegates = [ ] ; foreach ( $ delegates as $ delegate ) { $ this -> addDelegate ( $ delegate ) ; } return $ this ; } | Assigns a collection of delegare objects . |
48,017 | final protected function hasInDelegates ( $ key ) { foreach ( $ this -> delegates as $ delegate ) { if ( isset ( $ delegate [ $ key ] ) ) { return true ; } } return false ; } | Determines if a delegate object contains the specified key and if its value is not NULL . |
48,018 | final protected function getInDelegates ( $ key ) { foreach ( $ this -> delegates as $ delegate ) { if ( isset ( $ delegate [ $ key ] ) ) { return $ delegate [ $ key ] ; } } return null ; } | Returns the value from the specified key found on the first delegate object . |
48,019 | public static function merge ( $ destination , $ source , bool $ deep = true , bool $ assoc = false ) { if ( ! static :: is ( $ destination , false , true ) ) throw new \ TypeError ( 'Destination must be array(like)' ) ; else if ( ! static :: is ( $ source , true ) ) throw new \ TypeError ( 'Source must be iterable' ) ... | Recursive merge of two arrays |
48,020 | public static function mapList ( $ list , $ map , ? string $ key = null ) : array { if ( ! static :: is ( $ list , true ) ) throw new \ TypeError ( 'The $list must be iterable' ) ; else { $ _list = [ ] ; foreach ( $ list as $ index => $ item ) { if ( ! static :: is ( $ item , false , true ) ) throw new \ TypeError ( 'A... | Re - map an array of arraylikes into a new array |
48,021 | public static function copy ( $ input , bool $ deep = true ) { if ( ! static :: is ( $ input ) ) return $ input ; else { if ( is_array ( $ input ) ) { $ result = [ ] ; foreach ( $ input as $ k => $ e ) { $ result [ $ k ] = $ deep ? static :: copy ( $ e , $ deep ) : $ e ; } } else { if ( method_exists ( $ input , '__clo... | Deep copy of a collection |
48,022 | function MustUseCache ( ) { if ( $ this -> cacheLifetime == 0 ) { return false ; } if ( ! File :: Exists ( $ this -> file ) ) { return false ; } $ now = Date :: Now ( ) ; $ lastMod = File :: GetLastModified ( $ this -> file ) ; if ( $ now -> TimeStamp ( ) - $ lastMod -> TimeStamp ( ) < $ this -> cacheLifetime ) { retur... | Calculates if the cache content needs to be used |
48,023 | protected function setupDriver ( string $ type ) { $ driver = null ; $ driver_class = null ; if ( is_a ( $ type , Driver :: class , true ) ) { $ driver_class = $ type ; $ driver = new $ type ( $ this ) ; } else { $ driver_class = "Wedeto\\DB\\Driver\\" . $ type ; if ( is_a ( $ driver_class , Driver :: class , true ) ) ... | Find a proper driver based on the type parameter in the configuration . |
48,024 | public function getDAO ( string $ class ) { if ( ! isset ( $ this -> dao [ $ class ] ) ) { if ( ! is_subclass_of ( $ class , Model :: class ) ) throw new DAOException ( "$class is not a valid Model" ) ; $ tablename = $ class :: getTablename ( ) ; $ dao = DI :: getInjector ( ) -> newInstance ( DAO :: class , [ 'classnam... | Get a DAO for a model . When none is available a new one will be instantiated . |
48,025 | public function clearCache ( ) { if ( ! empty ( $ this -> schema ) ) { $ this -> schema -> clearCache ( ) ; } $ this -> dao = [ ] ; $ this -> schema = null ; return $ this ; } | Flush all cached DAOs and schema - useful after a schema alteration |
48,026 | public function setDAO ( string $ class , DAO $ dao = null ) { if ( ! is_subclass_of ( $ class , Model :: class ) ) throw new DAOException ( "$class is not a valid Model" ) ; $ this -> dao [ $ class ] = $ dao ; return $ this ; } | Set the DAO for a model manually . |
48,027 | public function prepareQuery ( Query $ query ) { $ parameters = new Parameters ( $ this -> driver ) ; if ( $ this -> pdo === null ) $ this -> connect ( ) ; $ sql = $ this -> driver -> toSQL ( $ parameters , $ query ) ; $ statement = $ this -> prepare ( $ sql ) ; $ parameters -> bindParameters ( $ statement ) ; return $... | Prepare a query and return the PDOStatement |
48,028 | public function executeSQL ( string $ filename ) { $ fh = @ fopen ( $ filename , "r" ) ; if ( $ fh === false ) throw new IOException ( "Unable to open file '$filename'" ) ; $ prefix = $ this -> driver -> getTablePrefix ( ) ; $ statement = '' ; while ( ! feof ( $ fh ) ) { $ line = fgets ( $ fh ) ; $ trimmed = trim ( $ l... | Execute a SQL file in the database . |
48,029 | private function addSubfield ( $ _subfield ) { if ( array_key_exists ( 'subfieldtagrange' , $ _subfield ) ) { $ _subfieldRange = $ this -> handleSubfieldRanges ( $ _subfield [ 'subfieldtagrange' ] ) ; } else { $ _subfieldRange [ ] = $ _subfield [ 'subfieldtag' ] ; } foreach ( $ _subfieldRange as $ subfieldTag ) { $ Sub... | Creates and adds a single subfield from the MARCspecParser result . |
48,030 | private function handleSubfieldRanges ( $ arg ) { if ( strlen ( $ arg ) < 3 ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: SF . InvalidMARCspecException :: LENGTH3 , $ arg ) ; } if ( preg_match ( '/[a-z]/' , $ arg [ 0 ] ) && ! preg_match ( '/[a-z]/' , $ arg [ 2 ] ) ) { throw new InvalidMARCspecExc... | Parses subfield ranges into single subfields . |
48,031 | public static function validatePos ( $ pos ) { $ posLength = strlen ( $ pos ) ; if ( 1 > $ posLength ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR1 , $ pos ) ; } if ( preg_match ( '/[^0-9\-#]/' , $ pos ) ) { throw new InvalidMARCspecException ( InvalidMARCspecE... | validate a position or range . |
48,032 | private function resolveResponseArray ( array $ response ) { if ( $ count = count ( $ response ) ) { if ( $ count === 1 ) { $ response = $ response [ 0 ] ; } } $ this -> firing [ ] = $ response ; return $ response ; } | resolve the return parameter |
48,033 | private function resolveEventAndListeners ( $ event ) { if ( is_object ( $ event ) && $ event instanceof EventDispatch ) { $ name = get_class ( $ event ) ; } else { $ name = $ event ; } if ( is_string ( $ name ) ) { if ( $ this -> hasListiner ( $ name ) && $ listeners = $ this -> getListeners ( $ name ) ) { if ( count ... | resolve the event and listener |
48,034 | private function settingUpRootMapping ( ) { $ arrayServerName = explode ( '.' , $ _SERVER [ 'SERVER_NAME' ] ) ; $ scriptName = rtrim ( str_replace ( $ arrayServerName , '' , dirname ( $ _SERVER [ 'SCRIPT_NAME' ] ) ) , '/\\' ) ; define ( 'BASE_URL' , $ scriptName ) ; define ( 'SYSTEM_ROOT' , $ _SERVER [ 'DOCUMENT_ROOT' ... | Creating BASE_URL & SYSTEM_ROOT |
48,035 | private function loadingConfig ( ) { if ( $ _SERVER [ 'HTTP_HOST' ] == SERVER_DEVELOP ) { if ( ! is_file ( SYSTEM_ROOT . '/config/config.local.php' ) ) @ copy ( SYSTEM_ROOT . '/config/config.sample.php' , SYSTEM_ROOT . '/config/config.local.php' ) ; require_once ( 'config/config.local.php' ) ; } else { if ( ! is_file (... | Loading the configuration files for the website |
48,036 | private function loadingDatabases ( ) { $ database = [ ] ; if ( $ _SERVER [ 'HTTP_HOST' ] == SERVER_DEVELOP ) { if ( ! is_file ( SYSTEM_ROOT . '/config/database.local.php' ) ) @ copy ( SYSTEM_ROOT . '/config/database.sample.php' , SYSTEM_ROOT . '/config/database.local.php' ) ; require_once ( 'config/database.local.php'... | Loading the databases for the websites |
48,037 | protected function makeConfig ( ) { $ this -> _checkConfig ( ) ; if ( empty ( $ this -> _configuration ) || ! ( $ this -> _configuration instanceof Configuration ) ) { $ this -> _configuration = new Configuration ( trim ( $ this -> _config [ 'app' ] [ 'name' ] ) ) ; if ( isset ( $ this -> _config [ 'environment' ] ) &&... | makeConfig Wrap the associative configuration array inside a Configuration class |
48,038 | public function store ( $ dest_folder , Callable $ modifyName = null ) { if ( ! isset ( $ _FILES [ $ this -> _file ] ) ) { return false ; } if ( is_array ( $ _FILES [ $ this -> _file ] [ 'name' ] ) ) { $ count = count ( $ _FILES [ $ this -> _file ] [ 'name' ] ) ; $ stored = [ ] ; $ fails = [ ] ; for ( $ i = 0 ; $ i < $... | Store temporary files to destination path of uploads |
48,039 | public function setSize ( $ size = null ) { $ this -> _size = is_int ( $ size ) ? $ size : self :: DEFAULT_SIZE ; } | Set buffer size |
48,040 | public function create ( $ aData , $ bReturnObject = false ) { $ aTagData = array ( ) ; if ( empty ( $ aData [ 'label' ] ) ) { $ this -> setError ( '"label" is a required field.' ) ; return false ; } else { $ aTagData [ 'label' ] = trim ( $ aData [ 'label' ] ) ; } if ( empty ( $ aData [ 'blog_id' ] ) ) { $ this -> setE... | Creates a new tag |
48,041 | public function update ( $ iId , $ aData ) { $ aTagData = array ( ) ; if ( empty ( $ aData [ 'label' ] ) ) { $ this -> setError ( '"label" is a required field.' ) ; return false ; } else { $ aTagData [ 'label' ] = trim ( $ aData [ 'label' ] ) ; } $ aTagData [ 'slug' ] = $ this -> generateSlug ( $ aData [ 'label' ] , $ ... | Updates an existing tag |
48,042 | public function setCreatedAt ( $ created_at ) { $ this -> created_at = $ created_at !== null ? new \ DateTime ( $ created_at ) : null ; return $ this ; } | Sets the created at |
48,043 | public function setCreatedOn ( $ created_on ) { $ this -> created_on = $ created_on !== null ? new \ DateTime ( $ created_on ) : null ; return $ this ; } | Sets the created on |
48,044 | public function setUpdatedAt ( $ updated_at ) { $ this -> updated_at = $ updated_at !== null ? new \ DateTime ( $ updated_at ) : null ; return $ this ; } | Sets the updated at |
48,045 | public function setUpdatedOn ( $ updated_on ) { $ this -> updated_on = $ updated_on !== null ? new \ DateTime ( $ updated_on ) : null ; return $ this ; } | Sets the updated on |
48,046 | public function setEditedAt ( $ edited_at ) { $ this -> edited_at = $ edited_at !== null ? new \ DateTime ( $ edited_at ) : null ; return $ this ; } | Sets the edited at |
48,047 | public function setEditedOn ( $ edited_on ) { $ this -> edited_on = $ edited_on !== null ? new \ DateTime ( $ edited_on ) : null ; return $ this ; } | Sets the edited on |
48,048 | public function setDeletedAt ( $ deleted_at ) { $ this -> deleted_at = $ deleted_at !== null ? new \ DateTime ( $ deleted_at ) : null ; return $ this ; } | Sets the deleted at |
48,049 | public function setDeletedOn ( $ deleted_on ) { $ this -> deleted_on = $ deleted_on !== null ? new \ DateTime ( $ deleted_on ) : null ; return $ this ; } | Sets the deleted on |
48,050 | public function setActivatedAt ( $ activated_at ) { $ this -> activated_at = $ activated_at !== null ? new \ DateTime ( $ activated_at ) : null ; return $ this ; } | Sets the activated_at |
48,051 | public function setActivatedOn ( $ activated_on ) { $ this -> activated_on = $ activated_on !== null ? new \ DateTime ( $ activated_on ) : null ; return $ this ; } | Sets the activated on |
48,052 | public function setCompletedAt ( $ completed_at ) { $ this -> completed_at = $ completed_at !== null ? new \ DateTime ( $ completed_at ) : null ; return $ this ; } | Sets the completed at |
48,053 | public function setCompletedOn ( $ completed_on ) { $ this -> completed_on = $ completed_on !== null ? new \ DateTime ( $ completed_on ) : null ; return $ this ; } | Sets the completed on |
48,054 | public function newInstance ( $ data = null ) { $ class = $ this -> getClassName ( ) ; $ conv = $ this -> newConverterInstance ( ) ; if ( is_null ( $ data ) ) { $ data = array ( ) ; } if ( $ conv instanceof IListConverter ) { $ data = $ conv ; } $ o = new $ class ( $ data ) ; if ( $ conv instanceof IBaseConverter ) { $... | Creates new instance of current class type Expect a subclass of \ PerrysLambda \ ArrayBase |
48,055 | public function applyDefaults ( array $ defaults ) { foreach ( $ defaults as $ dkey => $ dvalue ) { if ( ! $ this -> exists ( $ dkey ) ) { $ this [ $ dkey ] = $ dvalue ; } } } | Applies given fields to this object if field does not exist |
48,056 | protected function regenerateKeyCache ( ) { if ( is_array ( $ this -> __data ) ) { $ i = 0 ; $ this -> __keycache = array ( ) ; $ this -> __keycacheindex = array ( ) ; foreach ( $ this -> __data as $ key => $ value ) { $ this -> __keycache [ $ key ] = $ i ; $ this -> __keycacheindex [ $ i ] = $ key ; $ i ++ ; } } else ... | Regenerate array key cache |
48,057 | public function getNames ( ) { if ( $ this -> isKeycacheInvalid ( ) ) { $ this -> regenerateKeyCache ( ) ; } if ( is_array ( $ this -> __keycacheindex ) ) { return $ this -> __keycacheindex ; } return array ( ) ; } | Get all field names |
48,058 | public function getNameByValue ( $ value ) { $ i = array_search ( $ value , $ this -> __data , true ) ; if ( $ i === false ) { return null ; } return $ i ; } | Get field name by its value NULL if not exist |
48,059 | public function indexOfKey ( $ key ) { if ( $ this -> isKeycacheInvalid ( ) ) { $ this -> regenerateKeyCache ( ) ; } if ( isset ( $ this -> __keycache [ $ key ] ) ) { return $ this -> __keycache [ $ key ] ; } return - 1 ; } | Index of key |
48,060 | public function indexOfValue ( $ value ) { $ name = $ this -> getNameByValue ( $ value ) ; if ( ! is_null ( $ name ) ) { return $ this -> indexOfKey ( $ name ) ; } return - 1 ; } | Index of element - 1 = element not found |
48,061 | public function & get ( $ field , $ default = null , $ autoset = false ) { if ( $ this -> exists ( $ field ) ) { return $ this -> __data [ $ field ] ; } if ( $ autoset === true ) { $ this -> set ( $ field , $ default ) ; return $ this -> get ( $ field ) ; } return $ default ; } | Get field by its name |
48,062 | public function getScalarAt ( $ i , $ default = null ) { $ name = $ this -> getNameAt ( $ i ) ; if ( ! is_null ( $ name ) ) { return $ this -> getScalar ( $ name , $ default ) ; } return new ScalarProperty ( $ default ) ; } | Get field value as scalar by index |
48,063 | public function getScalar ( $ field , $ default = null , $ autoset = false ) { $ value = $ this -> get ( $ field , $ default , $ autoset ) ; return new ScalarProperty ( $ value ) ; } | Get field value as scalar by field name |
48,064 | public function removeAt ( $ i ) { $ field = $ this -> getNameAt ( $ i ) ; $ this -> removeKey ( $ field ) ; return $ this ; } | Remove field by index |
48,065 | public function removeValue ( $ value ) { $ i = $ this -> getNameByValue ( $ value ) ; if ( $ i >= 0 ) { $ this -> removeKey ( $ i ) ; } return $ this ; } | Remove field by its value |
48,066 | public function removeKey ( $ field ) { if ( $ this -> exists ( $ field ) ) { unset ( $ this -> __data [ $ field ] ) ; $ this -> invalidateKeycache ( ) ; } return $ this ; } | Remove field by name |
48,067 | public function getIsAllKeysValid ( array $ data ) { $ keys = array_keys ( $ data ) ; foreach ( $ keys as $ key ) { if ( ! $ this -> getIsValidKey ( $ key ) ) { return false ; } } return true ; } | Validate all field keys |
48,068 | public function getIsAllValuesValid ( array $ data ) { foreach ( $ data as $ value ) { if ( ! $ this -> getIsValidValue ( $ value ) ) { return false ; } } return true ; } | Validate all field values |
48,069 | public function where ( $ where ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; $ collection = $ this -> newInstance ( ) ; foreach ( $ this as $ record ) { if ( call_user_func ( $ where , $ record ) ) { $ collection -> add ( $ record ) ; } } return $ collection ; } | filter by condition |
48,070 | public function whereFirst ( $ where ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; foreach ( $ this as $ record ) { if ( call_user_func ( $ where , $ record ) ) { return $ record ; } } throw new \ OutOfBoundsException ( ) ; } | Get first item matching to callable |
48,071 | public function whereFirstOrDefault ( $ where , $ default = null ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; foreach ( $ this as $ record ) { if ( call_user_func ( $ where , $ record ) ) { return $ record ; } } return $ default ; } | Get first item matching to callable or default |
48,072 | public function groupBy ( $ group = null ) { $ group = LambdaUtils :: toSelectCallable ( $ group ) ; $ result = new ObjectArray ( array ( ) ) ; if ( $ this instanceof ObjectArray ) { $ result = $ this -> newInstance ( ) ; } foreach ( $ this as $ record ) { $ key = call_user_func ( $ group , $ record ) ; $ data = array ... | Group fields by condition |
48,073 | public function distinct ( $ distinct = null ) { $ distinct = LambdaUtils :: toSelectCallable ( $ distinct ) ; $ keys = array ( ) ; $ collection = $ this -> newInstance ( ) ; foreach ( $ this as $ record ) { $ value = call_user_func ( $ distinct , $ record ) ; $ hash = md5 ( json_encode ( $ value ) ) ; if ( ! isset ( $... | filter duplicate field by condition |
48,074 | public function intersect ( ArrayBase $ comparedata ) { $ cmpvalue = function ( $ v1 , $ v2 ) { return $ v1 == $ v2 ? 0 : ( $ v1 > $ v2 ? 1 : - 1 ) ; } ; $ collection = $ this -> newInstance ( ) ; $ temp = array_uintersect ( $ this -> getData ( ) , $ comparedata -> getData ( ) , $ cmpvalue ) ; $ collection -> setData (... | Intersection to another object |
48,075 | public function except ( ArrayBase $ comparedata ) { $ cmpvalue = function ( $ v1 , $ v2 ) { return $ v1 == $ v2 ? 0 : ( $ v1 > $ v2 ? 1 : - 1 ) ; } ; $ collection = $ this -> newInstance ( ) ; $ temp1 = array_udiff ( $ this -> getData ( ) , $ comparedata -> getData ( ) , $ cmpvalue ) ; $ temp2 = array_udiff ( $ compar... | Difference to another object |
48,076 | public function all ( $ where ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; foreach ( $ this as $ record ) { if ( ! call_user_func ( $ where , $ record ) ) { return false ; } } return true ; } | Check for all fields by condition |
48,077 | public function selectMany ( $ select = null ) { $ select = LambdaUtils :: toSelectCallable ( $ select ) ; $ result = array ( ) ; foreach ( $ this as $ key => $ record ) { $ temp = call_user_func ( $ select , $ record , $ key ) ; if ( is_array ( $ temp ) || $ temp instanceof \ Iterator ) { foreach ( $ temp as $ tempite... | Select a field and merge all arrays into one |
48,078 | public function each ( callable $ each ) { foreach ( $ this -> __data as $ key => & $ record ) { call_user_func_array ( $ each , array ( & $ record , $ key ) ) ; } unset ( $ record ) ; return $ this ; } | Iterate all fields |
48,079 | public function sum ( $ sum = null ) { $ sum = LambdaUtils :: toSelectCallable ( $ sum ) ; $ temp = $ this -> select ( $ sum ) -> toArray ( ) ; return array_sum ( $ temp ) ; } | Calculates the sum of values from given expression |
48,080 | public function min ( $ min = null ) { $ min = LambdaUtils :: toSelectCallable ( $ min ) ; $ temp = $ this -> select ( $ min ) -> toArray ( ) ; return min ( $ temp ) ; } | Find the lowest value from given expression |
48,081 | public function max ( $ max = null ) { $ max = LambdaUtils :: toSelectCallable ( $ max ) ; $ temp = $ this -> select ( $ max ) -> toArray ( ) ; return max ( $ temp ) ; } | Find the biggest value from given expression |
48,082 | public function avg ( $ avg = null ) { $ avg = LambdaUtils :: toSelectCallable ( $ avg ) ; return ( $ this -> sum ( $ avg ) / $ this -> length ( ) ) ; } | Find the average of the values from given expression |
48,083 | public function joinString ( $ join = null , $ glue = ", " ) { $ join = LambdaUtils :: toSelectCallable ( $ join ) ; $ temp = $ this -> select ( $ join ) -> toArray ( ) ; return implode ( $ glue , $ temp ) ; } | Join values from expression to one string |
48,084 | public function take ( $ length ) { if ( ! is_int ( $ length ) ) { throw new \ InvalidArgumentException ( ) ; } if ( $ length >= 0 && $ length > $ this -> length ( ) ) { $ length = $ this -> length ( ) ; } elseif ( $ length < 0 && $ length < ( 0 - $ this -> length ( ) ) ) { $ length = 0 - $ this -> length ( ) ; } $ tem... | Take first x fields |
48,085 | public function skip ( $ offset ) { if ( ! is_int ( $ offset ) ) { throw new \ InvalidArgumentException ( ) ; } if ( $ offset < 0 || $ offset >= $ this -> length ( ) ) { throw new \ OutOfBoundsException ( ) ; } $ temp = $ this -> newInstance ( ) ; $ temp -> setData ( array_slice ( $ this -> getData ( ) , $ offset ) ) ;... | Skip x fields |
48,086 | public function newRequest ( RequestParametersInterface $ parameters = null , ReaderInterface $ stdin = null ) { return new Request ( Role :: responder ( ) , $ this -> nextRequestId ++ , true , $ parameters , $ stdin ) ; } | Creates a new responder request . |
48,087 | public function handle ( RequestInterface $ request ) : RequestInterface { if ( $ this -> token === '' || $ this -> key === '' ) { throw new AuthorizationException ( 'Could not create api token, missing or empty arguments' ) ; } return $ request -> withHeader ( $ this -> key , $ this -> token ) ; } | Get a request with the headers associated with the authorization . |
48,088 | public function getCSRFCookie ( ) { $ cookie = $ this -> _browserInterface -> getCookie ( $ this -> _csrf_cookiename ) ; if ( ! $ cookie ) throw new SecureRequestHelper \ CSRFException ( 'CSRF cookie has not been initialized' ) ; return $ cookie ; } | Get CSRF cookie value |
48,089 | private static function getMappedType ( $ type ) { if ( ! isset ( self :: $ mappedTypes [ $ type ] ) ) { throw MysqliException :: mappedTypeDoesNotExist ( $ type ) ; } return self :: $ mappedTypes [ $ type ] ; } | Gets the mapped type . |
48,090 | private function bindValues ( array $ values ) { $ this -> bindedParameters = array ( ) ; $ this -> bindedTypes = array ( ) ; $ this -> bindedValues = array ( ) ; foreach ( $ values as $ parameter => $ value ) { if ( is_int ( $ parameter ) ) { $ parameter ++ ; } $ this -> bindValue ( $ parameter , $ value ) ; } } | Binds values on the statement . |
48,091 | private function bindParameters ( ) { $ bindedParameterReferences = array ( implode ( '' , $ this -> bindedTypes ) ) ; $ lobParameters = array ( ) ; $ null = null ; foreach ( $ this -> bindedParameters as $ key => & $ parameter ) { if ( isset ( $ this -> bindedTypes [ $ key - 1 ] ) && ( $ this -> bindedTypes [ $ key - ... | Binds the parameters on the driver statement . |
48,092 | private function bindResultFields ( ) { $ resultMetadata = $ this -> mysqliStatement -> result_metadata ( ) ; if ( $ resultMetadata !== false ) { $ this -> resultFields = array ( ) ; foreach ( $ resultMetadata -> fetch_fields ( ) as $ field ) { $ this -> resultFields [ ] = $ field -> name ; } $ resultMetadata -> free (... | Binds the driver result fields . |
48,093 | private function bindResult ( ) { $ this -> result = array_fill ( 0 , count ( $ this -> resultFields ) , null ) ; $ resultReferences = array ( ) ; foreach ( $ this -> result as $ key => & $ result ) { $ resultReferences [ $ key ] = & $ result ; } call_user_func_array ( array ( $ this -> mysqliStatement , 'bind_result' ... | Binds the driver statement result . |
48,094 | public function createFromImportedData ( $ data ) { $ group = new Group ( $ data [ 'name' ] , $ data [ 'include_pattern' ] , $ data [ 'exclude_pattern' ] ) ; if ( isset ( $ data [ 'type' ] ) ) { $ group -> setType ( $ data [ 'type' ] ) ; } $ group -> setOrdering ( $ data [ 'ordering' ] ) ; foreach ( $ data [ 'classes' ... | Create Group instance from imported data . |
48,095 | public function getRules ( ) { $ rules = [ static :: FIRST_NAME => "required|max:100" , static :: LAST_NAME => "required|max:100" , static :: EMAIL => "required|max:100|email|unique:users,email,{$this->id},id" , ] ; if ( ! $ this -> id ) { $ rules [ static :: PWD_FIELD ] = 'required|min:' . config ( 'app.model.user.pas... | Return array of rules for model validation |
48,096 | protected function renameFile ( EntityInterface $ entity , $ target ) { if ( $ entity -> getFilename ( ) && strpos ( $ entity -> getFilename ( ) , 'tmp' ) !== false ) { $ filename = $ entity -> getFilename ( ) ; $ entity -> setFilename ( $ target . pathinfo ( $ filename , PATHINFO_BASENAME ) ) ; $ root = $ this -> root... | Rename file if it in the temp folder . |
48,097 | private function handle ( Request $ request ) : Response { $ router = $ this -> getInstance ( Router :: class ) ; if ( $ router -> match ( $ request -> getPathInfo ( ) , $ request -> getMethod ( ) ) ) { $ match = $ router -> getMatch ( ) ; $ handler = $ match -> getHandler ( ) ; if ( is_object ( $ handler ) && $ handle... | Turn a request into a response |
48,098 | static function FirstChildOf ( Content $ content ) { $ provider = self :: GetTreeProvider ( $ content ) ; if ( ! $ provider ) { return null ; } $ item = $ provider -> ItemByContent ( $ content ) ; return $ provider -> ContentByItem ( $ provider -> FirstChildOf ( $ item ) ) ; } | Returns the first child of the content |
48,099 | public static function hasCommand ( String $ label ) : Bool { return ( isset ( Command :: $ commands [ $ label ] ) ) ? true : false ; } | Checks if a command is registered . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.