idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
49,500
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 .
49,501
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 .
49,502
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
49,503
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 .
49,504
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 .
49,505
public function get ( Target $ target , array $ subjects ) : Acl { return $ this -> strategy -> load ( $ target , $ subjects , $ this ) ; }
Gets an access control list for a Target .
49,506
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 .
49,507
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
49,508
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
49,509
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
49,510
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
49,511
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
49,512
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
49,513
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
49,514
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
49,515
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
49,516
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
49,517
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
49,518
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
49,519
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
49,520
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
49,521
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
49,522
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
49,523
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
49,524
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
49,525
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
49,526
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 .
49,527
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 .
49,528
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 .
49,529
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 .
49,530
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
49,531
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
49,532
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
49,533
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
49,534
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
49,535
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
49,536
public function setIdentifier ( $ identifier ) { if ( false === is_array ( $ identifier ) ) { $ identifier = [ $ identifier ] ; } $ this -> identifier = $ identifier ; }
Sets the identifier
49,537
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
49,538
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
49,539
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
49,540
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
49,541
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
49,542
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
49,543
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 .
49,544
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 .
49,545
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 .
49,546
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 .
49,547
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 .
49,548
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 .
49,549
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 .
49,550
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 .
49,551
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 .
49,552
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 .
49,553
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 .
49,554
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 .
49,555
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 .
49,556
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 .
49,557
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
49,558
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 .
49,559
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 .
49,560
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 .
49,561
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 .
49,562
public function updateLocation ( Location $ location , $ andFlush = true ) { $ this -> objectManager -> persist ( $ location ) ; if ( $ andFlush ) { $ this -> objectManager -> flush ( ) ; } }
Updates a Location .
49,563
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
49,564
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
49,565
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 .
49,566
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 .
49,567
public function writeDebugLog ( $ val ) { if ( $ this -> debugMode === false ) { return ; } $ this -> runlog .= $ this -> getLogSection ( ) . '> ' . $ val . "\n" ; }
Write one or more lines to the debug log
49,568
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 .
49,569
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 .
49,570
public function setLimit ( $ limit ) { $ message = 'Given limit must be a positive number.' ; Assertion :: numeric ( $ limit , $ message ) ; Assertion :: min ( $ limit , 0 , $ message ) ; $ this -> limit = $ limit ; }
Defines the amount of entities to be fetched from the information provider .
49,571
protected function persist ( array $ data ) { Assertion :: notEmpty ( $ this -> persistors , 'No persistor attached.' , DataAggregatorException :: NO_PERSISTOR_ATTACHED ) ; foreach ( $ this -> persistors as $ persistor ) { try { $ persistor -> persist ( $ data ) ; } catch ( PersistorException $ e ) { $ this -> getLogge...
Forwards the gathered data to every registered output handler .
49,572
public function attachLoader ( LoaderInterface $ loader , $ key = '' ) { if ( empty ( $ key ) ) { $ this -> loaders [ ] = $ loader ; } else { $ this -> loaders [ $ key ] = $ loader ; } }
Adds given loader to registry .
49,573
public function attachPersistor ( PersistorInterface $ persistor , $ key = '' ) { if ( empty ( $ key ) ) { $ this -> persistors [ ] = $ persistor ; } else { $ this -> persistors [ $ key ] = $ persistor ; } }
Adds the given persistor to the collection of output handlers
49,574
public static function make ( string $ path , int $ ifExists = File :: MAKE_FILE_EXISTS_THROW_EXCEPTION ) : File { $ exists = File :: exists ( $ path ) ; if ( $ exists ) { if ( $ ifExists === File :: MAKE_FILE_EXISTS_OVERWRITE ) { unlink ( $ path ) ; } else if ( $ ifExists === File :: MAKE_FILE_EXISTS_OPEN ) { return n...
Makes a file .
49,575
public function write ( string $ str ) { $ handler = fopen ( $ this -> _path , "w" ) ; fwrite ( $ handler , $ str ) ; fclose ( $ handler ) ; }
Writes a string to the file .
49,576
public function read ( int $ length = 1 , int $ offset = 0 ) : string { return substr ( $ this -> getContent ( ) , $ offset , $ length ) ; }
Returns a string of specified length from file .
49,577
public function readLine ( int $ line = 1 ) : string { $ lines = file ( $ this -> _path ) ; if ( $ line > count ( $ lines ) ) { throw new LineNumberAboveFileLines ( $ this -> _path , $ line , count ( $ lines ) ) ; } if ( $ line <= 0 ) { $ line = 1 ; } return $ lines [ ( $ line - 1 ) ] ; }
Returns a single line from file .
49,578
public function setExtension ( string $ extension ) { $ old = $ this -> getPath ( ) ; $ new = $ this -> getLocation ( ) . DIRECTORY_SEPARATOR . $ this -> getName ( ) ; if ( ! empty ( $ extension ) ) { $ new .= ".{$extension}" ; } if ( rename ( $ old , $ new ) ) { $ this -> _extension = $ extension ; } }
Renames file extension .
49,579
public function onPreRoute ( MvcEvent $ event ) { $ serviceManager = $ event -> getApplication ( ) -> getServiceManager ( ) ; $ router = $ event -> getRouter ( ) ; $ config = $ serviceManager -> get ( 'Config' ) ; $ config = isset ( $ config [ 'asset_manager' ] ) && ( is_array ( $ config [ 'asset_manager' ] ) || $ conf...
Late - binding asset routes .
49,580
public function onPostRoute ( MvcEvent $ e ) { $ matches = $ e -> getRouteMatch ( ) ; if ( ! $ matches instanceof Router \ RouteMatch ) { return ; } $ routeName = $ matches -> getMatchedRouteName ( ) ; $ routeName = explode ( '/' , $ routeName , 2 ) ; $ routeName = $ routeName [ 0 ] ; if ( $ routeName !== 'asset_manage...
Listen to the route event and determine if an asset should be loaded .
49,581
private function doRun ( ) { $ dispatcher = ( new DispatcherInjector ) -> build ( ) ; if ( ( $ response = $ dispatcher -> signal ( 'kernel.request' ) ) instanceof ResponseInterface ) { return $ response ; } $ resolver = $ this -> getResolver ( ) ; if ( ( $ response = $ dispatcher -> signal ( 'kernel.route' , [ 'resolve...
Real run application
49,582
public function getWidth ( ) : int { if ( ! $ this -> loadImageInfo ( ) ) { throw InvalidOperationException :: format ( 'Invalid call to %s: file \'%s\' is not a valid image' , __METHOD__ , $ this -> fullPath ) ; } return $ this -> width ; }
Gets the image width in pixels .
49,583
public function getHeight ( ) : int { if ( ! $ this -> loadImageInfo ( ) ) { throw InvalidOperationException :: format ( 'Invalid call to %s: file \'%s\' is not a valid image' , __METHOD__ , $ this -> fullPath ) ; } return $ this -> height ; }
Gets the image height in pixels .
49,584
public static function createImageSetFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'title' ] , $ postValues [ 'width' ] , $ postValues [ 'height' ] , $ postValues [ 'method' ] ) ) { $ imageSetObject = new \ stdClass ( ) ; $ imageSetObject -> title = $ postValues [ 'title' ] ; $ imageSetObject -> slug = ...
Ceate image set from post values
49,585
public function isUpdateAvailable ( $ user , $ version_key , $ schema_version ) { $ user_fields_version = $ this -> getSetting ( $ version_key , 'user_internal' , $ user ) ; if ( ! $ user_fields_version ) { $ user_fields_version = 0 ; } if ( $ user_fields_version < $ schema_version ) { return true ; } return false ; }
Returns true if there is a update of the user fields
49,586
public function loadSettingDefaults ( array $ fields , $ user ) { $ user = $ this -> container -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; foreach ( $ fields as $ field ) { if ( ! $ this -> getSetting ( $ field [ 'setting_key' ] , $ field [ 'focus' ] , $ user ) ) { if ( ! isset ( $ field [ 'default_v...
Loading of settings needed for the app Called if it s the first time or user need update of settings
49,587
public function loadObjectSettingsDefaults ( $ object_id ) { $ em = $ this -> getEntityManager ( ) ; $ object = $ em -> getRepository ( 'ACSACSPanelBundle:Service' ) -> find ( $ object_id ) ; $ object_fields = $ object -> getType ( ) -> getFieldTypes ( ) ; return $ object_fields ; }
Create the settings configured for specified object
49,588
public function getSetting ( $ setting_key , $ focus = null , $ user = null ) { $ params = array ( ) ; $ params [ 'setting_key' ] = $ setting_key ; if ( $ focus ) { $ params [ 'focus' ] = $ focus ; } if ( $ user ) { $ params [ 'user' ] = $ user ; } $ setting = $ this -> findOneBy ( $ params ) ; if ( $ setting ) { retur...
Get setting by parameters
49,589
public function setSetting ( $ setting_key , $ focus , $ value , $ context = '' , $ user = null ) { $ em = $ this -> getEntityManager ( ) ; $ params = array ( ) ; $ params [ 'setting_key' ] = $ setting_key ; $ params [ 'focus' ] = $ focus ; if ( $ context ) { $ params [ 'context' ] = $ context ; } if ( $ user ) { $ par...
Sets a setting value
49,590
public function getContexts ( $ user ) { $ em = $ this -> getEntityManager ( ) ; $ contexts_rep = $ em -> getRepository ( 'ACSACSPanelBundle:PanelSetting' ) ; $ query = $ contexts_rep -> createQueryBuilder ( 'ps' ) -> select ( 'ps.context' ) -> where ( 'ps.user = ?1' ) -> andWhere ( 'ps.context NOT LIKE ?2' ) -> andWhe...
Returns the context used to organize the settings view
49,591
function loadUserFields ( ) { $ user_fields = array ( ) ; $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( SettingsEvents :: BEFORE_LOAD_USERFIELDS , new FilterUserFieldsEvent ( $ user_fields , $ this -> container ) ) ; array_merge ( $ user_fields , $ user_fields = $ this -> container -> getParameter ( "...
Load the settings array to pass to form
49,592
public function getFilePath ( IFile $ file ) : ? string { if ( $ this -> filePathClosure !== null ) { return \ call_user_func ( $ this -> filePathClosure , $ file ) ; } if ( $ file instanceof ExternalFile ) { return $ file -> getActualPath ( ) ; } return $ file -> getId ( ) !== null ? $ this -> getFileDirectory ( $ fil...
Returns file path in contentFS
49,593
public function getAssetPath ( IFile $ file , string $ formatName ) : string { return implode ( '/' , array_filter ( [ Type :: $ folderPrefix [ $ file -> getType ( ) ] . '_' . $ formatName , $ file -> getModelAlias ( ) , mb_substr ( $ file -> getHash ( ) , 0 , $ this -> cacheHashLength ) , $ this -> getAssetName ( $ fi...
Returns path in asset filesystem
49,594
public function getAssetName ( IFile $ file ) : string { if ( $ this -> assetNameClosure !== null ) { return \ call_user_func ( $ this -> assetNameClosure , $ file ) ; } return $ file -> getId ( ) . '_' . $ file -> getFullName ( ) ; }
File name in asset directory
49,595
public function getFileDirectory ( IFile $ file ) : string { return implode ( DIRECTORY_SEPARATOR , array_filter ( [ $ this -> directory , $ this -> getDirectoryHash ( ( string ) $ file -> getId ( ) ) , ] ) ) ; }
Returns target directory for uploaded file
49,596
public function whatYouWantAction ( Request $ request ) { if ( $ this -> container -> getParameter ( 'anime_db.catalog.installed' ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'home' ) ) ; } $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( ) ; if ( $ response -> isNotModified ( $ request ) ) {...
What you want .
49,597
public function pow ( $ v , int $ dPlaces = 0 ) : RealNumber { $ d = new RealNumber ( $ v ) ; return new RealNumber ( bcpow ( $ this -> value ( ) , $ d -> value ( ) , $ this -> useDecimalPlaces ( $ dPlaces ) ) ) ; }
Eleva o valor atual pelo expoente indicado .
49,598
public function sqrt ( int $ dPlaces = 0 ) : RealNumber { return new RealNumber ( bcsqrt ( $ this -> value ( ) , $ this -> useDecimalPlaces ( $ dPlaces ) ) ) ; }
Retorna a raiz do valor atual pelo operando indicado .
49,599
public function add ( $ name , callable $ command , $ default = false ) { $ commandName = strtolower ( $ name ) ; if ( isset ( $ this -> _command [ $ commandName ] ) ) { throw new \ Console \ Exception \ Runtime ( 'Duplicated command.' ) ; } if ( ! is_null ( $ this -> _default ) && $ default ) { throw new \ Console \ E...
Add console command