idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
228,900 | public function initCache ( Cache $ cache , $ enableCache = false ) { $ this -> cache = $ cache ; $ this -> isCacheEnabled = $ enableCache ; if ( $ enableCache ) { $ this -> cache -> enable ( ) ; } else { $ this -> cache -> disable ( ) ; } return $ this ; } | Set cache instance & enable cache if it is specified . |
228,901 | public static function boot ( $ filename = null , Injector $ injector = null , $ directory = null ) { $ directory = $ directory === null ? getcwd ( ) : $ directory ; $ injector = $ injector === null ? new Injector : $ injector ; $ system = new Filesystem ( new Local ( $ directory ) ) ; $ injector -> share ( $ system ) ... | Prepares the console application . |
228,902 | protected static function paths ( Blueprint $ blueprint , $ directory , $ filename = null ) { $ yaml = file_exists ( $ filename ) ? file_get_contents ( $ filename ) : '' ; $ yaml = str_replace ( array ( '\\' , '/' ) , DIRECTORY_SEPARATOR , $ yaml ) ; $ yaml = str_replace ( '%%CURRENT_DIRECTORY%%' , $ directory , $ yaml... | Prepares the paths that are defined from a YAML file . |
228,903 | public function iShouldSeeInTheOutput ( $ string ) { if ( strpos ( $ this -> output , $ string ) === false ) { throw new Exception ( sprintf ( 'Did not see "%s" in output "%s"' , $ string , $ this -> output ) ) ; } } | Validate command output . |
228,904 | protected function decodeRequest ( $ class , Context $ ctx = null ) { $ container = $ this -> container ; $ request = $ container -> get ( 'request' ) ; $ serializerFormat = $ this -> container -> get ( 'ac_web_services.negotiator' ) -> negotiateRequestFormat ( $ request ) ; $ data = $ request -> getContent ( ) ; if ( ... | Convenience method for decoding incoming API data . The data format is determined via a negotiation service and then deserialized . |
228,905 | protected function validate ( $ obj ) { $ errors = $ this -> container -> get ( 'validator' ) -> validate ( $ obj ) ; if ( count ( $ errors ) > 0 ) { throw new ValidationException ( $ errors ) ; } } | Convenience validation method that will automatically throw custom ValidationExceptions when validation fails . |
228,906 | public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ groups = $ this -> getGroups ( ) ; $ having = $ this -> getHaving ( ) ; if ( count ( $ groups ) === 0 ) throw new QueryException ( "No groups in GROUP BY clause" ) ; $ drv = $ params -> getDriver ( ) ; $ parts = array ( ) ; foreach ( $ groups as $ ... | Write a GROUPBY clause as SQL query syntax |
228,907 | protected function getCartProductInCart ( CartProductInterface $ cartProduct , CartInterface $ cart ) { return $ this -> getRepository ( ) -> findOneBy ( [ 'id' => $ cartProduct -> getId ( ) , 'cart' => $ cart ] ) ; } | Returns an item from cart |
228,908 | public function setUserClass ( string $ classname ) { if ( ! class_exists ( $ classname ) || ! is_subclass_of ( $ classname , UserInterface :: class ) ) throw new DomainException ( "Invalid user class: $classname" ) ; $ this -> user_class = $ classname ; return $ this ; } | Set the UserInterface class that represents users . |
228,909 | public function setGroupClass ( string $ classname ) { if ( ! class_exists ( $ classname ) || ! is_subclass_of ( $ classname , GroupInterface :: class ) ) throw new DomainException ( "Invalid group class: $classname" ) ; $ this -> group_class = $ classname ; return $ this ; } | Set the GroupInterface class that represents groups . |
228,910 | public function getUserFromSession ( Session $ session ) { $ cl = $ this -> getUserClass ( ) ; $ this -> user = new $ cl ; $ this -> user -> obtainFromSession ( $ session ) ; return $ this -> user ; } | Obtain the current user from the active session |
228,911 | public function getUser ( string $ userid ) { $ cl = $ this -> getUserClass ( ) ; $ user = new $ cl ; return $ user -> obtainByUserID ( $ userid ) ; } | Obtain a user by its user ID . |
228,912 | public function getGroup ( string $ groupid ) { $ cl = $ this -> getGroupClass ( ) ; $ group = new $ cl ; return $ group -> obtainByGroupID ( $ groupid ) ; } | Obtain a group by its group ID . |
228,913 | public function login ( string $ username , string $ password , Session $ session ) { if ( $ session -> has ( 'authentication' , 'user_id' ) ) { throw new AuthenticationError ( "Already logged in" , AuthenticationError :: DUPLICATE_SESSION ) ; } $ cl = $ this -> getUserClass ( ) ; $ this -> user = new $ cl ; try { $ th... | Check if the provided details contain a valid login . |
228,914 | public function hash ( string $ password ) { $ algorithm = $ this -> config -> dget ( 'algorithm' , PASSWORD_DEFAULT ) ; $ options [ 'cost' ] = $ this -> config -> dget ( 'cost' , 10 ) ; return password_hash ( $ password , $ algorithm , $ options ) ; } | Create a hash of the password |
228,915 | public function verify ( string $ password , string $ hash ) { if ( substr ( $ hash , 0 , 1 ) !== "$" ) { $ salt = $ this -> config -> dget ( 'salt' , '' ) ; $ append = $ this -> config -> dget ( 'salt_placement' , 'append' ) === 'append' ; $ to_hash = $ append ? $ password . $ salt : $ salt . $ password ; $ pw_hash = ... | Check if the password matches the provided hash . The password should come from user input the hash from persistent storage . |
228,916 | public function needsRehash ( string $ hash ) { if ( substr ( $ hash , 0 , 1 ) !== "$" ) return true ; $ algorithm = $ this -> config -> dget ( 'algorithm' , PASSWORD_DEFAULT ) ; $ options [ 'cost' ] = $ this -> config -> dget ( 'cost' , 10 ) ; return password_needs_rehash ( $ hash , $ algorithm , $ options ) ; } | Check if the password needs a rehash |
228,917 | public function checkLength ( $ value ) { if ( strlen ( $ value ) != 8 ) { $ this -> setCheck ( false ) ; } else { $ this -> setCheck ( true ) ; } return parent :: checkLength ( $ value ) ; } | Overrides parent checkLength |
228,918 | protected function getFluidTemplateObject ( $ filename ) { $ view = GeneralUtility :: makeInstance ( StandaloneView :: class ) ; $ view -> setLayoutRootPaths ( [ 'EXT:backend/Resources/Private/Layouts' ] ) ; if ( \ Gilbertsoft \ Warranty \ Utility \ Adapter :: isCompatVersion ( '8.7' ) ) { $ view -> setPartialRootPaths... | Returns a new standalone view shorthand function |
228,919 | protected function parseFile ( $ file ) { $ this -> file = $ file ; if ( ! strncasecmp ( __FILE__ , 'phar://' , 7 ) ) { $ this -> file = tempnam ( sys_get_temp_dir ( ) , 'Wordlists' ) ; copy ( $ file , $ this -> file ) ; } $ this -> db = new \ PDO ( 'sqlite:' . $ this -> file ) ; $ metadata = $ this -> db -> query ( 'S... | Parse the content of a SQLite file representing a list of words . |
228,920 | public function count ( ) { $ this -> countQuery -> execute ( ) ; $ res = $ this -> countQuery -> fetchColumn ( ) ; $ this -> countQuery -> closeCursor ( ) ; return ( int ) $ res ; } | Returns the number of words in the list . |
228,921 | public function findWord ( $ word ) { $ key = $ this -> collator -> getSortKey ( $ word ) ; if ( substr ( $ key , - 1 ) === "\0" ) { $ key = substr ( $ key , 0 , - 1 ) ; } $ this -> existsQuery -> execute ( array ( ':key' => $ key ) ) ; $ res = $ this -> existsQuery -> fetchColumn ( ) ; $ this -> existsQuery -> closeCu... | Look for a word in the list . |
228,922 | public function offsetGet ( $ offset ) { if ( ! is_int ( $ offset ) ) { throw new \ Erebot \ InvalidValueException ( 'An integer was expected' ) ; } $ this -> getQuery -> execute ( array ( ':offset' => $ offset ) ) ; $ res = $ this -> getQuery -> fetchColumn ( ) ; $ this -> getQuery -> closeCursor ( ) ; if ( $ res == '... | Returns the word at the given offset . |
228,923 | public function getMetadata ( $ type ) { if ( $ type == self :: METADATA_NAME ) { return $ this -> name ; } if ( $ type == self :: METADATA_FILE ) { return $ this -> file ; } if ( ! array_key_exists ( $ type , $ this -> metadata ) ) { throw new \ Erebot \ InvalidValueException ( 'Invalid metadata type "' . $ type . '"'... | Returns metadata associated with the list . |
228,924 | public function insert ( $ q , $ data ) { if ( is_string ( $ q ) ) { $ this -> defaults [ 'table' ] = $ q ; $ q = [ ] ; } extract ( $ this -> defaults ) ; extract ( $ q ) ; if ( ! $ table ) throw new Exception ( "table [$tabel] not defined" , 1 ) ; $ sql = 'INSERT INTO ' . $ table . ' ' . '(' . implode ( ', ' , array_k... | inserts a record |
228,925 | public function query ( $ sql , $ data = [ ] ) { $ this -> _init ( ) ; try { $ q = $ this -> db -> prepare ( $ sql ) ; } catch ( PDOException $ e ) { throw new Exception ( $ e -> getMessage ( ) ) ; } foreach ( $ data as $ k => $ v ) { $ $ k = $ v ; $ q -> bindParam ( ':' . $ k , $ $ k ) ; } $ result = $ q -> execute ( ... | Verifies if a condition can return records |
228,926 | public function generateProxyCode ( \ ReflectionClass $ ref ) { $ methods = $ this -> collectProxyMethods ( $ ref ) ; $ implements = [ '\KoolKode\Context\Scope\ScopedProxyInterface' ] ; $ code = 'namespace ' . $ ref -> getNamespaceName ( ) . ' { ' ; $ code .= 'if(!class_exists(' . var_export ( $ ref -> name . '__scoped... | Generates the PHP code of a scoped proxy for the given type . |
228,927 | protected function collectProxyMethods ( \ ReflectionClass $ ref ) { $ methods = [ ] ; foreach ( $ ref -> getMethods ( ) as $ method ) { if ( $ method -> isStatic ( ) || $ method -> isPrivate ( ) ) { continue ; } if ( substr ( $ method -> getName ( ) , 0 , 2 ) == '__' ) { continue ; } if ( $ method -> isFinal ( ) ) { t... | Collects all public instance methods of the given type using reflection . |
228,928 | private function addMeta ( $ page , $ key , $ value ) { $ meta = new PageMeta ( ) ; $ meta -> setMetaKey ( $ key ) ; $ meta -> setMetaValue ( $ value ) ; $ meta -> setPage ( $ page ) ; return $ meta ; } | Add meta to page |
228,929 | protected function pushKeys ( $ namespace , $ key , $ reference ) { $ fullKey = $ this -> getPrefix ( ) . sha1 ( $ namespace ) . ':' . $ key ; foreach ( explode ( '|' , $ namespace ) as $ segment ) { $ this -> store -> connection ( ) -> sadd ( $ this -> referenceKey ( $ segment , $ reference ) , $ fullKey ) ; } } | Store a reference to the cache key against the reference key . |
228,930 | 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 . |
228,931 | 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 . |
228,932 | 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 . |
228,933 | 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 . |
228,934 | 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 . |
228,935 | 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_ |
228,936 | 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 . |
228,937 | 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 . |
228,938 | 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 . |
228,939 | 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 . |
228,940 | 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 . |
228,941 | 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 |
228,942 | 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 |
228,943 | 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 |
228,944 | 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 . |
228,945 | 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 |
228,946 | final public function setDelegates ( array $ delegates ) { $ this -> delegates = [ ] ; foreach ( $ delegates as $ delegate ) { $ this -> addDelegate ( $ delegate ) ; } return $ this ; } | Assigns a collection of delegare objects . |
228,947 | 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 . |
228,948 | 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 . |
228,949 | 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 |
228,950 | 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 |
228,951 | 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 |
228,952 | 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 |
228,953 | 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 . |
228,954 | 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 . |
228,955 | 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 |
228,956 | 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 . |
228,957 | 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 |
228,958 | 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 . |
228,959 | 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 . |
228,960 | 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 . |
228,961 | 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 . |
228,962 | private function resolveResponseArray ( array $ response ) { if ( $ count = count ( $ response ) ) { if ( $ count === 1 ) { $ response = $ response [ 0 ] ; } } $ this -> firing [ ] = $ response ; return $ response ; } | resolve the return parameter |
228,963 | 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 |
228,964 | 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 |
228,965 | 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 |
228,966 | 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 |
228,967 | 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 |
228,968 | 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 |
228,969 | public function setSize ( $ size = null ) { $ this -> _size = is_int ( $ size ) ? $ size : self :: DEFAULT_SIZE ; } | Set buffer size |
228,970 | 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 |
228,971 | 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 |
228,972 | public function setCreatedAt ( $ created_at ) { $ this -> created_at = $ created_at !== null ? new \ DateTime ( $ created_at ) : null ; return $ this ; } | Sets the created at |
228,973 | public function setCreatedOn ( $ created_on ) { $ this -> created_on = $ created_on !== null ? new \ DateTime ( $ created_on ) : null ; return $ this ; } | Sets the created on |
228,974 | public function setUpdatedAt ( $ updated_at ) { $ this -> updated_at = $ updated_at !== null ? new \ DateTime ( $ updated_at ) : null ; return $ this ; } | Sets the updated at |
228,975 | public function setUpdatedOn ( $ updated_on ) { $ this -> updated_on = $ updated_on !== null ? new \ DateTime ( $ updated_on ) : null ; return $ this ; } | Sets the updated on |
228,976 | public function setEditedAt ( $ edited_at ) { $ this -> edited_at = $ edited_at !== null ? new \ DateTime ( $ edited_at ) : null ; return $ this ; } | Sets the edited at |
228,977 | public function setEditedOn ( $ edited_on ) { $ this -> edited_on = $ edited_on !== null ? new \ DateTime ( $ edited_on ) : null ; return $ this ; } | Sets the edited on |
228,978 | public function setDeletedAt ( $ deleted_at ) { $ this -> deleted_at = $ deleted_at !== null ? new \ DateTime ( $ deleted_at ) : null ; return $ this ; } | Sets the deleted at |
228,979 | public function setDeletedOn ( $ deleted_on ) { $ this -> deleted_on = $ deleted_on !== null ? new \ DateTime ( $ deleted_on ) : null ; return $ this ; } | Sets the deleted on |
228,980 | public function setActivatedAt ( $ activated_at ) { $ this -> activated_at = $ activated_at !== null ? new \ DateTime ( $ activated_at ) : null ; return $ this ; } | Sets the activated_at |
228,981 | public function setActivatedOn ( $ activated_on ) { $ this -> activated_on = $ activated_on !== null ? new \ DateTime ( $ activated_on ) : null ; return $ this ; } | Sets the activated on |
228,982 | public function setCompletedAt ( $ completed_at ) { $ this -> completed_at = $ completed_at !== null ? new \ DateTime ( $ completed_at ) : null ; return $ this ; } | Sets the completed at |
228,983 | public function setCompletedOn ( $ completed_on ) { $ this -> completed_on = $ completed_on !== null ? new \ DateTime ( $ completed_on ) : null ; return $ this ; } | Sets the completed on |
228,984 | 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 |
228,985 | 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 |
228,986 | 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 |
228,987 | public function getNames ( ) { if ( $ this -> isKeycacheInvalid ( ) ) { $ this -> regenerateKeyCache ( ) ; } if ( is_array ( $ this -> __keycacheindex ) ) { return $ this -> __keycacheindex ; } return array ( ) ; } | Get all field names |
228,988 | 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 |
228,989 | public function indexOfKey ( $ key ) { if ( $ this -> isKeycacheInvalid ( ) ) { $ this -> regenerateKeyCache ( ) ; } if ( isset ( $ this -> __keycache [ $ key ] ) ) { return $ this -> __keycache [ $ key ] ; } return - 1 ; } | Index of key |
228,990 | 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 |
228,991 | 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 |
228,992 | 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 |
228,993 | 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 |
228,994 | public function removeAt ( $ i ) { $ field = $ this -> getNameAt ( $ i ) ; $ this -> removeKey ( $ field ) ; return $ this ; } | Remove field by index |
228,995 | public function removeValue ( $ value ) { $ i = $ this -> getNameByValue ( $ value ) ; if ( $ i >= 0 ) { $ this -> removeKey ( $ i ) ; } return $ this ; } | Remove field by its value |
228,996 | public function removeKey ( $ field ) { if ( $ this -> exists ( $ field ) ) { unset ( $ this -> __data [ $ field ] ) ; $ this -> invalidateKeycache ( ) ; } return $ this ; } | Remove field by name |
228,997 | 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 |
228,998 | public function getIsAllValuesValid ( array $ data ) { foreach ( $ data as $ value ) { if ( ! $ this -> getIsValidValue ( $ value ) ) { return false ; } } return true ; } | Validate all field values |
228,999 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.