idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
230,400 | protected function toEntityCollection ( $ result ) { switch ( true ) { case is_object ( $ result ) && is_subclass_of ( $ result , $ this -> collectionClass ) : $ collection = $ result ; break ; case $ result instanceof Collection : $ collection = new $ this -> collectionClass ( $ result -> toArray ( ) ) ; break ; case ... | Convert given array or Collection result set to managed entity collection class . |
230,401 | private function createFilteredQuery ( array $ filters ) { $ qb = $ this -> createQuery ( 'entity' ) ; foreach ( $ filters as $ field => $ filter ) { $ qb -> andWhere ( is_array ( $ filter ) ? sprintf ( 'entity.%s in (:%s)' , $ field , $ field ) : sprintf ( 'entity.%s = :%s' , $ field , $ field ) ) -> setParameter ( sp... | create query an filter it with given data . |
230,402 | public function validateParameters ( & $ parameters ) { if ( ! isset ( $ parameters [ 'username' ] ) ) { throw new InvalidArgumentException ( 'The \'username\' parameter must be defined for the Password grant type' , InvalidArgumentException :: MISSING_PARAMETER ) ; } elseif ( ! isset ( $ parameters [ 'password' ] ) ) ... | Adds a specific Handling of the parameters |
230,403 | public function handle ( RequestInterface $ request ) : RequestInterface { return $ request -> withHeader ( 'Authorization' , sprintf ( 'Basic %s' , base64_encode ( sprintf ( '%s:%s' , $ this -> user , $ this -> password ) ) ) ) ; } | Get the http headers associated with the authorization . |
230,404 | function equals ( $ other ) { if ( ! ( $ other instanceof Address ) ) { return false ; } return $ this === $ other || $ this -> asString ( ) === $ other -> asString ( ) ; } | Returns whether the address is equal to another given address . |
230,405 | public function getStartDate ( ) { $ now = $ this -> getNow ( ) ; $ endOfDay = $ this -> getToday ( ) -> modify ( '+18 hours' ) ; $ currentDay = $ this -> getToday ( ) ; if ( $ now > $ endOfDay ) { $ currentDay -> modify ( '+1 day' ) ; } return $ currentDay ; } | Gets the start date for the timeline |
230,406 | public function isBetween ( \ DateTime $ dateTime , \ DateTime $ start , \ DateTime $ end ) { return $ dateTime >= $ start && $ dateTime <= $ end ; } | Checks if a given date is beween a given start and end date |
230,407 | public function http404Action ( ) : void { $ header = Http :: status ( 404 ) ; $ this -> view -> header ( $ header ) ; $ this -> view -> snippet ( 'Base::error/http-404.phtml' ) ; $ this -> view -> assign ( 'message' , $ header ) ; } | default action for unknown pages |
230,408 | public static function getUtcDateTime ( BaseDateTime $ date ) { $ newDate = new BaseDateTime ( ) ; $ newDate -> setTimestamp ( $ date -> getTimestamp ( ) ) ; $ newDate -> setTimezone ( new DateTimeZone ( 'UTC' ) ) ; return $ newDate ; } | Converts the current date time object to UTC time . |
230,409 | public static function getUserDateTime ( BaseDateTime $ date , $ timezone = '' ) { $ newDate = new BaseDateTime ( ) ; $ newDate -> setTimestamp ( $ date -> getTimestamp ( ) ) ; if ( is_string ( $ timezone ) && ! empty ( $ timezone ) ) { $ timezone = new DateTimeZone ( $ timezone ) ; } if ( empty ( $ timezone ) ) { $ ti... | Converts the UTC date time object to user time . |
230,410 | public static function getSpan ( BaseDateTime $ date1 , BaseDateTime $ date2 , $ type = self :: SPAN_HOURS , $ absolute = TRUE ) { $ diff = $ date1 -> diff ( $ date2 , $ absolute ) ; $ span = 0 ; switch ( $ type ) { case self :: SPAN_YEARS : $ span = ( int ) $ diff -> y ; break ; case self :: SPAN_MONTHS : $ span = $ d... | Returns the span between the two dates . |
230,411 | public function setResources ( $ resources ) { if ( false === is_array ( $ resources ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ resources ) ) , E_USER_ERROR ) ; } $ this -> resources = $ resources ; } | Sets the resources |
230,412 | public function hasResource ( $ resource ) { if ( null !== $ resource && false === is_string ( $ resource ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ resource ) ) , E_USER_ERROR ) ; } return true === array_key_exists ( $ resource ,... | Check if a resource exists |
230,413 | public function route ( ) { global $ logger ; try { $ urlInterpreter = new UrlInterpreter ( ) ; $ command = $ urlInterpreter -> getCommand ( ) ; $ router = new Router ( $ command ) ; $ logger -> debug ( 'Routing to : ' . $ command -> getControllerName ( ) ) ; $ router -> route ( ) ; } catch ( Exception $ e ) { throw ne... | route Handles incoming requests . |
230,414 | public static function getExtensionMediaType ( string $ extension , ? string $ defaultMediaType = null ) : ? string { return self :: getMediaTypes ( ) [ strtolower ( $ extension ) ] ?? $ defaultMediaType ; } | Returns the media type for a given extension . |
230,415 | public static function getFilenameMediaType ( string $ filename , ? string $ defaultMediaType = null ) : ? string { if ( preg_match ( '|\\.([^.]+)$|u' , $ filename , $ matches ) ) { return self :: getExtensionMediaType ( $ matches [ 1 ] ) ; } return $ defaultMediaType ; } | Returns the media type for a given file name . |
230,416 | public static function getMediaTypeExtensions ( string $ mediaType ) : array { $ mediaType = strtolower ( $ mediaType ) ; $ extensions = [ ] ; foreach ( self :: getMediaTypes ( ) as $ extension => $ listMediaType ) { if ( $ listMediaType == $ mediaType ) { $ extensions [ ] = $ extension ; } } return $ extensions ; } | Returnes all the known extensions for a given media type . |
230,417 | public function count ( ) { return ( self :: $ assigned [ $ this -> type ] - self :: START_AT + self :: INCREMENT ) / self :: INCREMENT ; } | How many keys have been instantiated so far |
230,418 | public function next ( SourceBuffer $ generator ) { while ( isset ( $ this -> tokens [ $ this -> index ] ) ) { $ tok = $ this -> tokens [ $ this -> index ++ ] ; if ( is_array ( $ tok ) ) { switch ( $ tok [ 0 ] ) { case T_COMMENT : $ generator -> append ( $ tok ) ; $ this -> comment = '' ; continue 2 ; case T_WHITESPACE... | Read the next token from the stream comments and whitespace will be ignored . |
230,419 | public function peek ( $ distance = 1 ) { if ( $ distance < 0 ) { throw new \ InvalidArgumentException ( 'Peek must be a lookahead => distance must be greater than or equal to 0' ) ; } $ idx = $ this -> index + $ distance - 1 ; while ( isset ( $ this -> tokens [ $ idx ] ) ) { $ tok = $ this -> tokens [ $ idx ++ ] ; if ... | Lookahead at a token relative to the current position . |
230,420 | public function preceededBy ( $ token ) { if ( is_integer ( $ token ) ) { $ tok = $ this -> tokens [ $ this -> index - 1 ] ; if ( is_array ( $ tok ) && $ tok [ 0 ] == $ token ) { return true ; } } else { return $ token == $ this -> tokens [ $ this -> index - 1 ] ; } } | Check if the token at the current position is preceeded by the given token . |
230,421 | public function previous ( ) { if ( isset ( $ this -> tokens [ $ this -> index - 2 ] ) ) { return $ this -> tokens [ $ this -> index - 2 ] ; } return false ; } | Get the previous token returns false when there is no such token . |
230,422 | public function preceedingTokens ( array $ types ) { $ result = [ ] ; for ( $ x = $ this -> index - 2 ; $ x >= 0 ; $ x -- ) { $ tok = $ this -> tokens [ $ x ] ; if ( is_array ( $ tok ) ) { switch ( $ tok [ 0 ] ) { case T_COMMENT : case T_WHITESPACE : continue 2 ; } if ( ! in_array ( $ tok [ 0 ] , $ types , true ) ) { b... | Get all preceeding tokens matching the given token types will stop when a token is encountered that does not match the given filter . |
230,423 | private function createCache ( $ renderedContent ) { if ( ! CmsComponent :: isCmsLoggedIn ( ) ) { Cache :: getInstance ( ) -> setCacheForPath ( Request :: $ requestUri , $ renderedContent , json_encode ( ResponseHeaders :: getHeaders ( ) ) ) ; } } | Sets the new cache unless a cms user is logged in |
230,424 | private function getBundleClass ( SplFileInfo $ fileInfo ) { $ reflection = new ReflectionFile ( $ fileInfo -> getRealPath ( ) ) ; $ baseName = $ fileInfo -> getBasename ( '.php' ) ; foreach ( $ reflection -> getNamespaces ( ) as $ namespace ) { return $ namespace . '\\' . $ baseName ; } return null ; } | Returns FQCN for file |
230,425 | public static function alias ( $ file , array $ paths = array ( ) ) { if ( empty ( $ file ) ) { return '[internal]' ; } $ file = static :: ds ( $ file ) ; foreach ( array ( 'vendor' , 'app' , 'modules' , 'resources' , 'temp' , 'views' , 'web' ) as $ type ) { $ constant = strtoupper ( $ type ) . '_DIR' ; if ( empty ( $ ... | Parse the file path to remove absolute paths and replace with a constant name . |
230,426 | public static function ds ( $ path , $ endSlash = false ) { $ path = str_replace ( array ( '\\' , '/' ) , static :: SEPARATOR , $ path ) ; if ( $ endSlash && substr ( $ path , - 1 ) !== static :: SEPARATOR ) { $ path .= static :: SEPARATOR ; } return $ path ; } | Converts OS directory separators to the standard forward slash . |
230,427 | public static function includePath ( $ paths ) { $ current = array ( get_include_path ( ) ) ; if ( is_array ( $ paths ) ) { $ current = array_merge ( $ current , $ paths ) ; } else { $ current [ ] = $ paths ; } $ path = implode ( static :: DELIMITER , $ current ) ; set_include_path ( $ path ) ; return $ path ; } | Define additional include paths for PHP to detect within . |
230,428 | public static function join ( array $ paths , $ above = true , $ join = true ) { $ clean = array ( ) ; $ parts = array ( ) ; $ ds = static :: SEPARATOR ; $ up = 0 ; foreach ( $ paths as $ path ) { if ( ! is_string ( $ path ) ) { throw new InvalidTypeException ( 'Path parts must be strings' ) ; } $ path = trim ( static ... | Join all path parts and return a normalized path . |
230,429 | public static function relativeTo ( $ from , $ to ) { if ( static :: isRelative ( $ from ) || static :: isRelative ( $ to ) ) { throw new InvalidArgumentException ( 'Cannot determine relative path without two absolute paths' ) ; } $ ds = static :: SEPARATOR ; $ from = explode ( $ ds , static :: ds ( $ from , true ) ) ;... | Determine the relative path between two absolute paths . |
230,430 | public static function toNamespace ( $ path ) { $ path = static :: ds ( static :: stripExt ( $ path ) ) ; foreach ( array ( 'lib' , 'src' ) as $ folder ) { if ( mb_strpos ( $ path , $ folder . static :: SEPARATOR ) !== false ) { $ paths = explode ( $ folder . static :: SEPARATOR , $ path ) ; $ path = $ paths [ 1 ] ; } ... | Converts a path to a namespace package . |
230,431 | public static function toPath ( $ path , $ ext = 'php' , $ root = '' ) { $ ds = static :: SEPARATOR ; $ path = static :: ds ( $ path ) ; $ dirs = explode ( $ ds , $ path ) ; $ file = array_pop ( $ dirs ) ; $ path = implode ( $ ds , $ dirs ) . $ ds . str_replace ( '_' , $ ds , $ file ) ; if ( $ ext && mb_substr ( $ path... | Converts a namespace to a relative or absolute file system path . |
230,432 | public function addImage ( $ key , $ location , $ caption = '' , $ geolocation = '' , $ title = '' , $ license = '' ) { $ node = $ this -> get ( $ key ) ; if ( ! is_null ( $ node ) ) { $ node -> addImage ( new SitemapImage ( $ location , $ caption , $ geolocation , $ title , $ license ) ) ; $ this -> hasImages = true ;... | Adding an image at a specific index in our array of SitemapUrls |
230,433 | public function assert ( array $ subjects , string $ verb , Target $ target ) : void { try { if ( $ this -> get ( $ target , $ subjects ) -> can ( $ subjects , $ verb ) ) { return ; } } catch ( \ Exception $ ex ) { throw new Exception \ Forbidden ( "Access denied to $verb the target" , 0 , $ ex ) ; } throw new Exceptio... | Asserts that one of the provided subjects can verb the Target . |
230,434 | public function can ( array $ subjects , string $ verb , Target $ target ) : bool { try { return $ this -> get ( $ target , $ subjects ) -> can ( $ subjects , $ verb ) ; } catch ( \ Exception $ ex ) { } return false ; } | Whether any of the provided subjects has permission to verb the Target . |
230,435 | public function get ( Target $ target , array $ subjects ) : Acl { return $ this -> strategy -> load ( $ target , $ subjects , $ this ) ; } | Gets an access control list for a Target . |
230,436 | public function getAll ( array $ targets , array $ subjects ) : array { $ acls = [ ] ; if ( $ this -> strategy instanceof MultiStrategy ) { $ acls = $ this -> strategy -> loadAll ( $ targets , $ subjects , $ this ) ; } else { foreach ( $ targets as $ target ) { $ acls [ ( string ) $ target ] = $ this -> strategy -> loa... | Gets access control lists for several Targets . |
230,437 | public function render ( ) { $ render = new Render ( $ this ) ; if ( $ this -> getMode ( ) === static :: MODE_SIMPLE ) { return $ render -> simpleRende ( ) ; } else { return $ render -> standartRende ( ) ; } } | rende the pagination to string |
230,438 | public function rendeToArray ( ) { $ render = new Render ( $ this ) ; if ( $ this -> getMode ( ) === static :: MODE_SIMPLE ) { return $ render -> simpleRendeArray ( ) ; } else { return $ render -> standartRendeArray ( ) ; } } | rende the pagination to an array |
230,439 | public function addProvider ( $ providerOrClass ) { $ prov = $ this -> getProviderInstance ( $ providerOrClass ) ; $ class = get_class ( $ prov ) ; if ( isset ( $ this -> providers [ $ class ] ) ) { throw new LogicException ( Message :: get ( Message :: EXT_PROVIDER_DUPPED , get_class ( $ prov ) ) , Message :: EXT_PROV... | Add provider to the registry |
230,440 | public function getProviderInstance ( $ providerOrClass ) { if ( is_a ( $ providerOrClass , ProviderAbstract :: PROVIDER_CLASS , true ) ) { if ( ! is_object ( $ providerOrClass ) ) { $ providerOrClass = new $ providerOrClass ; } return $ providerOrClass ; } else { throw new LogicException ( Message :: get ( Message :: ... | Get the provider object |
230,441 | public function filterBySourceId ( $ sourceId = null , $ comparison = null ) { if ( is_array ( $ sourceId ) ) { $ useMinMax = false ; if ( isset ( $ sourceId [ 'min' ] ) ) { $ this -> addUsingAlias ( PageTableMap :: COL_SOURCE_ID , $ sourceId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset (... | Filter the query on the source_id column |
230,442 | public function filterByPageid ( $ pageid = null , $ comparison = null ) { if ( is_array ( $ pageid ) ) { $ useMinMax = false ; if ( isset ( $ pageid [ 'min' ] ) ) { $ this -> addUsingAlias ( PageTableMap :: COL_PAGEID , $ pageid [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ pageid [ '... | Filter the query on the pageid column |
230,443 | public function filterByDisplaytitle ( $ displaytitle = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ displaytitle ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PageTableMap :: COL_DISPLAYTITLE , $ displaytitle , $ comparison ) ; } | Filter the query on the displaytitle column |
230,444 | public function filterByPageImageFree ( $ pageImageFree = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ pageImageFree ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PageTableMap :: COL_PAGE_IMAGE_FREE , $ pageImageFree , $ comparison ) ; } | Filter the query on the page_image_free column |
230,445 | public function filterByWikibaseItem ( $ wikibaseItem = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ wikibaseItem ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PageTableMap :: COL_WIKIBASE_ITEM , $ wikibaseItem , $ comparison ) ; } | Filter the query on the wikibase_item column |
230,446 | public function filterByDisambiguation ( $ disambiguation = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ disambiguation ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PageTableMap :: COL_DISAMBIGUATION , $ disambiguation , $ comparison ) ; } | Filter the query on the disambiguation column |
230,447 | public function filterByDefaultsort ( $ defaultsort = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ defaultsort ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PageTableMap :: COL_DEFAULTSORT , $ defaultsort , $ comparison ) ; } | Filter the query on the defaultsort column |
230,448 | public function useSourceQuery ( $ relationAlias = null , $ joinType = Criteria :: LEFT_JOIN ) { return $ this -> joinSource ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Source' , '\Attogram\SharedMedia\Orm\SourceQuery' ) ; } | Use the Source relation Source object |
230,449 | public function filterByC2P ( $ c2P , $ comparison = null ) { if ( $ c2P instanceof \ Attogram \ SharedMedia \ Orm \ C2P ) { return $ this -> addUsingAlias ( PageTableMap :: COL_ID , $ c2P -> getPageId ( ) , $ comparison ) ; } elseif ( $ c2P instanceof ObjectCollection ) { return $ this -> useC2PQuery ( ) -> filterByPr... | Filter the query by a related \ Attogram \ SharedMedia \ Orm \ C2P object |
230,450 | public function useC2PQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinC2P ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'C2P' , '\Attogram\SharedMedia\Orm\C2PQuery' ) ; } | Use the C2P relation C2P object |
230,451 | public function useM2PQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinM2P ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'M2P' , '\Attogram\SharedMedia\Orm\M2PQuery' ) ; } | Use the M2P relation M2P object |
230,452 | public function clear ( ) { $ files = glob ( Path :: get ( 'cache-shared' ) . '*' ) ; if ( true === is_array ( $ files ) ) { foreach ( $ files as $ file ) { $ file = new File ( $ file ) ; $ file -> delete ( ) ; } } return $ this ; } | Clear all cache files |
230,453 | public function clearExpired ( ) { $ files = glob ( Path :: get ( 'cache-shared' ) . '*' ) ; if ( true === is_array ( $ files ) && count ( $ files ) > 0 ) { foreach ( $ files as $ file ) { $ file = new File ( $ file ) ; $ expiration = $ this -> extractExpiration ( $ file ) ; if ( $ expiration -> time <= time ( ) ) { $ ... | Clear all expired cache |
230,454 | private function generateName ( $ key , $ expiration = null ) { if ( null !== $ expiration && false === ( '-' . intval ( $ expiration ) == '-' . $ expiration ) ) { return trigger_error ( sprintf ( 'Argument 2 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ expiration ) ) , E_USER_ERRO... | Generates the cache file name |
230,455 | private function extractExpiration ( File $ file ) { $ expiration = explode ( '-' , $ file -> entity ( ) -> getName ( ) ) ; if ( count ( $ expiration ) > 2 ) { return ( object ) [ 'time' => $ expiration [ 2 ] , 'expiration' => $ expiration [ 1 ] ] ; } return ( object ) [ 'time' => 0 , 'expiration' => 0 ] ; } | Returns the expiration time of cache file |
230,456 | public static function create ( $ sqlType ) { $ matches = array ( ) ; if ( ! ( bool ) preg_match ( '`([a-z]+)\(?([0-9]*)\)? ?(.*)`' , $ sqlType , $ matches ) ) { throw new \ Exception ( ) ; } $ type = ( string ) $ matches [ 1 ] ; $ display = ( int ) $ matches [ 2 ] ; $ other = ( string ) $ matches [ 3 ] ; switch ( strt... | Instantiate new type . |
230,457 | protected function & resolveKey ( $ key ) { if ( strpos ( $ key , '.' ) !== false ) { $ parts = explode ( '.' , $ key ) ; $ config = & $ this -> config ; while ( is_array ( $ config ) && ( $ part = array_shift ( $ parts ) ) !== null ) { if ( ! isset ( $ config [ $ part ] ) && array_key_exists ( $ part , $ config ) ) { ... | Resolve a key to it s value . |
230,458 | protected function getParentChildKeys ( $ key ) { $ parts = explode ( '.' , $ key ) ; $ child = array_pop ( $ parts ) ; return [ implode ( '.' , $ parts ) , $ child ] ; } | Get the parent key and the child part of the key . |
230,459 | protected function merge ( $ key , $ result ) { if ( is_null ( $ key ) ) { $ this -> config = array_merge ( $ this -> config , $ result ) ; } elseif ( strpos ( $ key , '.' ) === false ) { if ( ! isset ( $ this -> config [ $ key ] ) && ! array_key_exists ( $ key , $ this -> config ) ) { throw new KeyDoesNotExistExceptio... | Merge values into a key . |
230,460 | public function setTable ( $ table ) { if ( false === is_string ( $ table ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ table ) ) , E_USER_ERROR ) ; } $ this -> table = $ table ; return $ this ; } | Set the current table |
230,461 | public function getTable ( ) { if ( null === $ this -> table ) { $ path = $ this -> getNamespace ( $ this , [ 'directory' , 'entity' ] , [ 'directory' , 'entity' ] ) . Application :: get ( [ 'prefix' , 'entity' ] ) ; $ path = str_replace ( DIRECTORY_SEPARATOR , '\\' , $ path ) ; $ class = new \ ReflectionClass ( get_cl... | Returns the table from current namespace or from table variable if set |
230,462 | public function setDateFormat ( $ formats ) { if ( false === is_array ( $ formats ) ) { $ formats = [ $ formats ] ; } $ this -> date_formats = $ formats ; return $ this ; } | Adds a string or array of date formats so selected dates which matches the formats will be converted automatically to Date Objects |
230,463 | public function convertToJson ( $ convert = true ) { if ( false === is_bool ( $ convert ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type Boolean, "%s" given' , __METHOD__ , gettype ( $ convert ) ) , E_USER_ERROR ) ; } $ this -> convert_json = $ convert ; return $ this ; } | Columns containing valid JSON will be converted to Array s automatically |
230,464 | public function fromArray ( $ data ) { if ( false === is_array ( $ data ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type Array, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } $ this -> beforeLoad ( ) ; foreach ( $ data as $ column => $ value ) { $ value = $ thi... | Converts given array to entity data |
230,465 | public function toArray ( ) { $ class = new \ ReflectionClass ( $ this ) ; $ props = $ class -> getProperties ( ) ; $ data = [ ] ; foreach ( $ props as $ prop ) { if ( $ class -> name === $ prop -> class ) { if ( true === isset ( $ this -> { $ prop -> name } ) ) { $ data [ $ prop -> name ] = $ this -> { $ prop -> name ... | Returns all variables to a single Array |
230,466 | public function setIdentifier ( $ identifier ) { if ( false === is_array ( $ identifier ) ) { $ identifier = [ $ identifier ] ; } $ this -> identifier = $ identifier ; } | Sets the identifier |
230,467 | public function setExclude ( $ exclude ) { if ( false === is_array ( $ exclude ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type Array, "%s" given' , __METHOD__ , gettype ( $ exclude ) ) , E_USER_ERROR ) ; } $ this -> exclude = $ exclude ; return $ this ; } | Sets exclude column names to be excluded when entity is saved . This will prevent data saved to MySQL generated columns which will trigger an error |
230,468 | public function getIdentifier ( ) { if ( false === isset ( $ this -> identifier ) ) { $ cl = new \ ReflectionClass ( $ this ) ; return trigger_error ( sprintf ( 'No table identifier specified in "%s" class' , $ cl -> getFileName ( ) ) , E_USER_ERROR ) ; } return $ this -> identifier ; } | Returns the identifier |
230,469 | public function save ( ) { if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( 'Adapter is not set. Set the adapter with the setAdapter() method' , E_USER_ERROR ) ; } $ this -> beforeSave ( ) ; $ class = new \ ReflectionClass ( get_class ( $ this ) ) ; $ values = $ this -> toArray ( ) ; $ columns = [ ] ; ... | Inserts or updates entity based on identifier |
230,470 | public function delete ( ) { if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( 'Adapter is not set. Set the adapter with the setAdapter() method' , E_USER_ERROR ) ; } $ this -> beforeDelete ( ) ; $ class = new \ ReflectionClass ( get_class ( $ this ) ) ; $ identifiers = $ this -> getIdentifier ( ) ; $ v... | Delete the current entitiy based on identifier |
230,471 | public function convertToDate ( $ value ) { foreach ( $ this -> date_formats as $ format ) { if ( false !== \ DateTime :: createFromFormat ( $ format , $ value ) ) { $ d = new DateTime ( $ value ) ; $ d -> createFromFormat ( $ format , $ value ) ; if ( $ d && $ d -> format ( $ format ) == $ value ) { $ d -> saveFormat ... | Tries to check if given value is a valid date . If so return the used format and returns a sFire DateTime object . Otherwise returns the given value |
230,472 | public function convertJsonToArray ( $ value ) { if ( true === $ this -> convert_json ) { if ( true === is_string ( $ value ) ) { $ tmp = @ json_decode ( $ value , true ) ; if ( true === ( json_last_error ( ) == JSON_ERROR_NONE ) ) { $ value = $ tmp ; } } } return $ value ; } | Tries covnert values to JSON strings . Otherwise returns the given value |
230,473 | public function get ( $ key , $ default = null ) { if ( ! isset ( $ this -> _configs [ $ key ] ) ) { $ cfg = get_cfg_var ( $ key ) ; if ( $ cfg !== false ) { return $ cfg ; } return $ default ; } return $ this -> _configs [ $ key ] ; } | Get config info . |
230,474 | public function compile ( ContainerBuilder $ builder , $ proxyCachePath = NULL , array $ additionalProxies = [ ] ) { try { return $ this -> compileBuilder ( $ builder , $ proxyCachePath , $ additionalProxies ) ; } finally { $ this -> methods = [ ] ; $ this -> namespaceContextCache = [ ] ; } } | Generate PHP code of an optimized DI container from the given builder . |
230,475 | protected function compileBuilder ( ContainerBuilder $ builder , $ proxyCachePath = NULL , array $ additionalProxies = [ ] ) { $ imports = [ DelegateBinding :: class , ContextLookupException :: class , InjectionPoint :: class , InjectionPointInterface :: class ] ; $ code = '<?php' . "\n\n" ; $ code .= 'namespace ' . $ ... | Compiles the given container builder and takes care of scoped proxy generation . |
230,476 | protected function compileBinding ( Binding $ binding ) { $ prop = str_replace ( '\\' , '_' , $ binding -> getTypeName ( ) ) ; $ code = "\tpublic function binding_" . $ prop . "() {\n\n" ; $ code .= "\t\t\t\$binding = new DelegateBinding(" . var_export ( $ binding -> getTypeName ( ) , true ) ; $ code .= ', ' . var_expo... | Compiles PHP code for the given binding . |
230,477 | protected function compileInlineFactoryBinding ( Binding $ binding ) { $ code = '' ; $ num = count ( $ this -> methods ) ; $ ref = new \ ReflectionFunction ( $ binding -> getTarget ( ) ) ; $ sig = $ this -> generateReplacementMethodSignature ( $ ref , $ num ) ; $ body = $ this -> extractClosureCode ( $ ref ) ; $ this -... | Compiles an inline factory binding by creating a replacement method in the DI container . |
230,478 | protected function compileMarkerLookup ( array $ marked ) { $ code = '' ; foreach ( $ marked as $ markerType => $ markedBindings ) { $ code .= "\tpublic function markedBindings_" . str_replace ( '\\' , '_' , $ markerType ) . "() {\n" ; $ code .= "\t\tstatic \$bindings;\n" ; $ code .= "\t\tif(\$bindings === NULL) {\n" ;... | Compiles lookup methods for marked bindings . |
230,479 | protected function compileScopedProxies ( ContainerBuilder $ builder , $ proxyCachePath , array $ additionalProxies = [ ] ) { $ code = "\t\tpublic function loadScopedProxy(\$typeName) {\n" ; $ code .= "\t\tswitch(\$typeName) {\n" ; $ proxyTypes = [ ] ; foreach ( $ builder -> getProxyBindings ( ) as $ binding ) { $ ref ... | Compiles scoped proxy types and saves them on the filesystem . |
230,480 | protected function compileSetterInjector ( Binding $ binding , $ wrapClosure = true ) { $ setters = $ binding -> getMarkers ( SetterInjection :: class ) ; if ( empty ( $ setters ) ) { return 'NULL' ; } $ setterTypeName = $ binding -> isImplementationBinding ( ) ? $ binding -> getTarget ( ) : $ binding -> getTypeName ( ... | Compile a setter injector for a binding . |
230,481 | protected function collectSetterMethods ( \ ReflectionClass $ ref , SetterInjection $ setter ) { $ methods = [ ] ; foreach ( $ ref -> getMethods ( ) as $ method ) { if ( $ method -> isStatic ( ) || $ method -> isAbstract ( ) || ! $ method -> isPublic ( ) ) { continue ; } if ( $ setter -> accept ( $ method ) ) { $ metho... | Collect all matching setter injetion methods for the given type . |
230,482 | protected function generateCallCode ( $ typeName , \ ReflectionFunction $ ref , $ num , array $ prepend = [ ] , array $ resolvers = NULL ) { $ code = '$this->call_' . $ num . '(' ; foreach ( $ ref -> getParameters ( ) as $ i => $ param ) { if ( $ i != 0 ) { $ code .= ', ' ; } if ( array_key_exists ( $ i , $ prepend ) )... | Generate code calling a replacement method with arguments . |
230,483 | protected function generateReplacementMethodSignature ( \ ReflectionFunction $ ref , $ num ) { $ code = 'protected function call_' . $ num . '(' ; foreach ( $ ref -> getParameters ( ) as $ i => $ param ) { if ( $ i != 0 ) { $ code .= ', ' ; } if ( NULL !== ( $ ptype = $ this -> getParamType ( $ param ) ) ) { $ code .= ... | Generate a signature for a method replacing the given closure . |
230,484 | protected function extractClosureCode ( \ ReflectionFunction $ ref ) { $ file = $ ref -> getFileName ( ) ; $ lines = file ( $ file , FILE_IGNORE_NEW_LINES ) ; if ( isset ( $ this -> namespaceContextCache [ $ file ] ) ) { $ namespaceContext = $ this -> namespaceContextCache [ $ file ] ; } else { $ tokens = token_get_all... | Extract code of the given closure and process it for use in a replacement method . |
230,485 | protected function generateNamespaceContext ( array & $ tokens ) { $ namespaceContext = new NamespaceContext ( ) ; for ( $ size = count ( $ tokens ) , $ i = 0 ; $ i < $ size ; $ i ++ ) { if ( is_array ( $ tokens [ $ i ] ) ) { switch ( $ tokens [ $ i ] [ 0 ] ) { case T_NAMESPACE : $ namespace = '' ; for ( $ i ++ ; $ i <... | Read namespace context from the given PHP source tokens . |
230,486 | protected function readImport ( array $ tokens , & $ i , NamespaceContext $ context ) { $ import = '' ; for ( $ size = count ( $ tokens ) ; $ i < $ size ; $ i ++ ) { if ( is_array ( $ tokens [ $ i ] ) ) { switch ( $ tokens [ $ i ] [ 0 ] ) { case T_WHITESPACE : case T_COMMENT : case T_DOC_COMMENT : continue 2 ; case T_N... | Read a PHP import statement and register it with the given namespace context . |
230,487 | public function isToday ( ) : bool { return $ this -> date -> format ( 'Y-m-d' ) === Date :: now ( $ this -> date -> timezone ( ) ) -> format ( 'Y-m-d' ) ; } | checks if it represents the current day |
230,488 | private function mapDataToFactObjects ( array $ data ) { return array_map ( function ( $ factData ) { return ( new Fact ) -> setText ( $ factData [ 'text' ] ) -> setGroups ( $ factData [ 'groups' ] ) ; } , $ data ) ; } | Converts an array of data to an array of Fact objects . |
230,489 | private function bindStatementParameters ( DriverStatementInterface $ statement , array $ parameters , array $ types ) { foreach ( $ parameters as $ key => $ parameter ) { if ( is_int ( $ key ) ) { $ placeholder = $ key + 1 ; } else { $ placeholder = ':' . $ key ; } if ( isset ( $ types [ $ key ] ) ) { list ( $ paramet... | Binds typed parameters to a statement . |
230,490 | private function createQueryDebugger ( $ query , array $ parameters = array ( ) , array $ types = array ( ) ) { if ( $ this -> getConfiguration ( ) -> getDebug ( ) ) { return new QueryDebugger ( $ query , $ parameters , $ types ) ; } } | Creates a query debugger if the query needs to be debugged . |
230,491 | private function debugQuery ( QueryDebugger $ queryDebugger = null ) { if ( $ queryDebugger === null ) { return ; } $ queryDebugger -> stop ( ) ; $ this -> getConfiguration ( ) -> getEventDispatcher ( ) -> dispatch ( Events :: QUERY_DEBUG , new QueryDebugEvent ( $ queryDebugger ) ) ; } | Debugs a query . |
230,492 | public function updateLocation ( Location $ location , $ andFlush = true ) { $ this -> objectManager -> persist ( $ location ) ; if ( $ andFlush ) { $ this -> objectManager -> flush ( ) ; } } | Updates a Location . |
230,493 | public function refreshLocation ( Location $ location ) { $ refreshedLocation = $ this -> findLocationBy ( array ( 'id' => $ location -> getId ( ) ) ) ; if ( null === $ refreshedLocation ) { throw new UsernameNotFoundException ( sprintf ( 'User with ID "%d" could not be reloaded.' , $ location -> getId ( ) ) ) ; } retu... | Refreshed a Location by Location Instance |
230,494 | protected function buildRecursive ( $ key , $ value ) { $ url = '' ; if ( is_array ( $ value ) ) { foreach ( $ value as $ key2 => $ val ) { if ( $ part = $ this -> buildRecursive ( $ key . '[' . $ key2 . ']' , $ val ) ) { $ url .= ( $ url ? '&' : '' ) . $ part ; } } } else { $ url .= ( $ url ? '&' : '' ) . urlencode ( ... | arrays in request |
230,495 | protected function validateFilterOptions ( array $ options , array $ validOptions ) { foreach ( $ options as $ option => $ value ) { if ( ! array_key_exists ( $ option , $ validOptions ) ) { throw new FilterOptionValidatorException ( sprintf ( 'Option "%s" is not found in valid option list: [%s].' , $ option , implode ... | Validates filter options . |
230,496 | protected function setFilterOptions ( FilterOptionInterface $ filter , array $ options , array $ validOptions ) { foreach ( $ options as $ option => $ value ) { if ( ! array_key_exists ( 'setter' , $ validOptions [ $ option ] ) ) { throw new FilterOptionException ( sprintf ( 'Key "setter" is not present in option "%s" ... | Sets filter options . Options must be validated before setting them . |
230,497 | public function writeDebugLog ( $ val ) { if ( $ this -> debugMode === false ) { return ; } $ this -> runlog .= $ this -> getLogSection ( ) . '> ' . $ val . "\n" ; } | Write one or more lines to the debug log |
230,498 | public function run ( ) { Assertion :: notEmpty ( $ this -> loaders , 'No loader attached.' , DataAggregatorException :: NO_LOADER_ATTACHED ) ; foreach ( $ this -> loaders as $ identifier => $ loader ) { $ this -> executeLoader ( $ loader ) ; } } | Executes the processing of every attached loader . |
230,499 | protected function executeLoader ( LoaderInterface $ loader ) { $ offset = 0 ; try { while ( $ result = $ loader -> load ( $ this -> limit , $ offset ) ) { $ this -> persist ( $ result ) ; $ offset += $ this -> limit ; } } catch ( LoaderException $ e ) { $ this -> getLogger ( ) -> error ( $ e -> getMessage ( ) ) ; } } | Runs the addressed loader to retrieve its data . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.