idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
52,300
public function load ( $ file ) { $ retVal = array ( ) ; try { $ retVal = SymFonyYaml :: parse ( $ file ) ; } catch ( \ Exception $ e ) { throw new YamlException ( $ e -> getmessage ( ) , $ e -> getCode ( ) , $ e ) ; } return $ this -> filter ( self :: ON_YAML_LOAD_FILTER , $ retVal , $ file ) ; }
Parses yaml file and returns an array .
52,301
public function save ( $ array , $ file ) { try { ob_start ( ) ; $ this -> dump ( $ array ) ; $ data = ob_get_clean ( ) ; file_put_contents ( $ file , $ this -> filter ( self :: ON_YAML_SAVE_FILTER , $ data , $ array , $ file ) ) ; } catch ( \ Exception $ e ) { throw new YamlException ( $ e -> getMessage ( ) , $ e -> g...
Save array as yml to file .
52,302
public function getEntityName ( ) { $ tags = $ this -> getTags ( ) ; if ( isset ( $ tags [ 'entity-name' ] ) ) { return $ tags [ 'entity-name' ] ; } $ name = ucwords ( $ this -> name ) ; $ name = \ str_replace ( '_' , '' , $ name ) ; return $ name ; }
The name of this relation as per the Bond convention Uppercase first letter . Replace _ with
52,303
public function getLinks ( ) { if ( isset ( $ this -> links ) ) { return $ this -> links ; } $ this -> links = array ( ) ; foreach ( $ this -> getAttributes ( ) as $ column ) { if ( $ column -> isUnique ( ) and ( $ references = $ column -> getIsReferencedBy ( ) ) ) { foreach ( $ references as $ reference ) { if ( $ ref...
Get array of links to this table
52,304
public function getAttributes ( $ includeParents = true ) { if ( ! $ this -> columns ) { $ this -> columns = $ this -> catalog -> pgAttributes -> findByAttrelid ( $ this -> oid ) -> sortByAttnum ( ) ; } $ output = $ this -> columns -> copy ( ) ; if ( ! $ includeParents ) { $ output -> filter ( function ( $ attribute ) ...
Get all columns on this relation
52,305
public function isLogTable ( $ default = false ) { $ tags = $ this -> getTags ( ) ; if ( array_key_exists ( 'isLogTable' , $ tags ) ) { return boolval ( $ tags [ 'isLogTable' ] ) ; } elseif ( array_key_exists ( 'logging' , $ tags ) ) { return true ; } return ( bool ) $ default ; }
Is this relation a logTable ( ie is it tagged logtable
52,306
public static function normalizeConfig ( $ config , $ key , $ plural = null ) { if ( null === $ plural ) { $ plural = $ key . 's' ; } if ( isset ( $ config [ $ plural ] ) ) { return $ config [ $ plural ] ; } if ( isset ( $ config [ $ key ] ) ) { if ( is_string ( $ config [ $ key ] ) || ! is_int ( key ( $ config [ $ key...
Normalizes a configuration entry .
52,307
public function addProvider ( string $ name , Provider $ provider ) : self { $ this -> providers [ $ name ] = $ provider ; return $ this ; }
Adds a new Provider .
52,308
public function eager ( string $ name , string $ type , $ factory ) : self { $ provider = new Provider ( $ type , $ factory ) ; $ this -> eager [ ] = $ name ; return $ this -> addProvider ( $ name , $ provider ) ; }
Adds a singleton component to be instantiated after the container is .
52,309
public function lazy ( string $ name , string $ type , $ factory ) : self { return $ this -> addProvider ( $ name , new Provider ( $ type , $ factory ) ) ; }
Adds a singleton component to be instantiated on demand .
52,310
public function proto ( string $ name , string $ type , $ factory ) : self { return $ this -> addProvider ( $ name , new Provider ( $ type , $ factory , false ) ) ; }
Adds a component that provides a new instance each time it s instantiated .
52,311
public function build ( Container $ parent = null ) : Objects { $ container = new Objects ( $ this -> providers , $ parent ) ; if ( ! empty ( $ this -> eager ) ) { foreach ( $ this -> eager as $ v ) { $ container -> get ( $ v ) ; } } $ this -> providers = [ ] ; $ this -> eager = [ ] ; return $ container ; }
Builds a container using the settings called .
52,312
public function setConfig ( $ config ) { if ( is_string ( $ config ) ) { $ this -> config = $ this -> createConfig ( $ config ) ; } elseif ( is_array ( $ config ) ) { $ this -> config = $ this -> createConfig ( $ config ) ; } elseif ( $ config instanceof ConfigInterface ) { $ this -> config = $ config ; } else { throw ...
Sets the object s configuration container .
52,313
public function config ( $ key = null , $ default = null ) { if ( $ this -> config === null ) { $ this -> config = $ this -> createConfig ( ) ; } if ( $ key !== null ) { if ( $ this -> config -> has ( $ key ) ) { return $ this -> config -> get ( $ key ) ; } elseif ( ! is_string ( $ default ) && is_callable ( $ default ...
Gets the object s configuration container or a specific key from the container .
52,314
protected function getData ( $ key ) { $ cacheKey = $ this -> key ( $ key ) ; return array_key_exists ( $ cacheKey , $ this -> cache ) ? $ this -> cache [ $ this -> key ( $ key ) ] : false ; }
Performs a fetch of our data from the cache without logging in the logger . That allows this method to be used in other functions .
52,315
public function getPort ( ) { if ( $ this -> port ) { return $ this -> port ; } elseif ( isset ( self :: $ defaultPorts [ $ this -> scheme ] ) ) { return self :: $ defaultPorts [ $ this -> scheme ] ; } return null ; }
Get the port part of the URl .
52,316
public function combine ( $ url ) { $ url = static :: fromString ( $ url ) ; if ( ! $ this -> isAbsolute ( ) && $ url -> isAbsolute ( ) ) { $ url = $ url -> combine ( $ this ) ; } $ parts = $ url -> getParts ( ) ; if ( $ parts [ 'scheme' ] ) { return new static ( $ parts [ 'scheme' ] , $ parts [ 'host' ] , $ parts [ 'u...
Combine the URL with another URL and return a new URL instance .
52,317
public static function fromNative ( ) { $ args = func_get_args ( ) ; $ firstName = new StringLiteral ( $ args [ 0 ] ) ; $ middleName = new StringLiteral ( $ args [ 1 ] ) ; $ lastName = new StringLiteral ( $ args [ 2 ] ) ; return new self ( $ firstName , $ middleName , $ lastName ) ; }
Returns a Name objects form PHP native values
52,318
public function sameValueAs ( ValueObjectInterface $ name ) { if ( false === Util :: classEquals ( $ this , $ name ) ) { return false ; } return $ this -> getFullName ( ) == $ name -> getFullName ( ) ; }
Tells whether two names are equal by comparing their values
52,319
public static function insertElement ( array $ array , $ element , $ position ) { $ res = array_slice ( $ array , 0 , $ position , true ) ; if ( is_array ( $ element ) ) { $ res = array_merge ( $ res , $ element ) ; } else { array_push ( $ res , $ element ) ; } $ res = array_merge ( $ res , array_slice ( $ array , $ po...
Adds a given element into the array on the given position without replacing the old entry
52,320
public static function getPrevKey ( $ key , array $ array ) { $ keys = array_keys ( $ array ) ; $ found_index = array_search ( $ key , $ keys ) ; if ( $ found_index === false || $ found_index === 0 ) return false ; return $ keys [ $ found_index - 1 ] ; }
Returns the previous key from an array
52,321
public static function getNextKey ( $ key , array $ array ) { $ keys = array_keys ( $ array ) ; $ found_index = array_search ( $ key , $ keys ) ; if ( $ found_index === false || $ found_index + 1 === count ( $ keys ) ) return false ; return $ keys [ $ found_index + 1 ] ; }
Returns the next key from an array
52,322
public function lengthGreaterThan ( $ number ) { Argument :: i ( ) -> test ( 1 , 'numeric' ) ; return strlen ( ( string ) $ this -> value ) > ( float ) $ number ; }
Returns true if the value length is greater than the passed argument
52,323
protected function isSoftBool ( $ string ) { if ( ! is_scalar ( $ string ) || $ string === null ) { return false ; } $ string = ( string ) $ string ; return $ string == '0' || $ string == '1' ; }
Test if 0 or 1 or string 1 oe 0
52,324
protected function isSoftFloat ( $ number ) { if ( ! is_scalar ( $ number ) || $ number === null ) { return false ; } $ number = ( string ) $ number ; return preg_match ( '/^[-+]?(\d*)?\.\d+$/' , $ number ) ; }
Test if float or string float
52,325
protected function isSoftInteger ( $ number ) { if ( ! is_scalar ( $ number ) || $ number === null ) { return false ; } $ number = ( string ) $ number ; return preg_match ( '/^[-+]?\d+$/' , $ number ) ; }
Test if integer or string integer
52,326
protected function isSoftSmall ( $ value ) { if ( ! is_scalar ( $ value ) || $ value === null ) { return false ; } $ value = ( float ) $ value ; return $ value >= 0 && $ value <= 9 ; }
Returns true if the value is between 0 and 9
52,327
static function arrayMerge ( ) { $ output = [ ] ; foreach ( func_get_args ( ) as $ array ) { foreach ( $ array as $ key => $ value ) { $ output [ $ key ] = isset ( $ output [ $ key ] ) ? array_merge ( $ output [ $ key ] , $ value ) : $ value ; } } return $ output ; }
Array merge including integers as key
52,328
static function arrayGet ( & $ var , $ key , $ default = null ) { $ toks = explode ( '.' , $ key ) ; for ( $ i = 0 ; $ i < count ( $ toks ) ; $ i ++ ) { $ var = & $ var [ $ toks [ $ i ] ] ; } return is_array ( $ var ) || is_object ( $ var ) ? json_decode ( json_encode ( $ var ) ) : ( is_null ( $ var ) && ! is_null ( $ ...
Array get using dots to traverse keys
52,329
static function arraySet ( & $ var , $ key , $ val ) { $ toks = explode ( '.' , $ key ) ; for ( $ i = 0 ; $ i < count ( $ toks ) ; $ i ++ ) { $ var = & $ var [ $ toks [ $ i ] ] ; } $ var = $ val ; }
Set array key value using dots to traverse keys
52,330
static function arrayUnset ( & $ var , $ key ) { $ toks = explode ( '.' , $ key ) ; $ toks_len = count ( $ toks ) ; $ last = null ; for ( $ i = 0 ; $ i < $ toks_len - 1 ; $ i ++ ) { $ var = & $ var [ $ toks [ $ i ] ] ; } if ( isset ( $ toks [ $ toks_len - 1 ] ) ) { $ last = $ toks [ $ toks_len - 1 ] ; } if ( $ last ) u...
Remove array key using dots to traverse keys
52,331
public static function fromOther ( FileViewFinder $ otherFinder ) { $ copy = new static ( $ otherFinder -> getFilesystem ( ) , $ otherFinder -> getPaths ( ) , $ otherFinder -> getExtensions ( ) ) ; if ( $ otherFinder instanceof FallbackFileViewFinder ) { $ copy -> setFallbackDir ( $ otherFinder -> getFallbackDir ( ) ) ...
Copy a FileViewFinder to a FallbackFileViewFinder
52,332
public function createFromImportedData ( $ name , $ data ) { $ class = new GroupClass ( $ name ) ; foreach ( $ data as $ parameterName => $ parameterData ) { $ class -> addParameter ( $ this -> getGroupParameterFactory ( ) -> createFromImportedData ( $ parameterName , $ parameterData ) ) ; } return $ class ; }
Create GroupClass instance from imported data .
52,333
public function get ( $ id ) { if ( $ id instanceof \ Closure ) { return $ id ( $ this ) ; } if ( ! $ this -> has ( $ id ) ) { $ service = $ this -> factory -> create ( $ id , $ this ) ; $ this -> repository -> set ( $ id , $ service ) ; } return $ this -> repository -> get ( $ id ) ; }
Get a service or params and create it first if it s not already defined .
52,334
public function set ( $ id , $ service ) { if ( ! $ this -> has ( $ id ) ) { $ this -> repository -> set ( $ id , $ service ) ; } }
Bypass factory and register a service directly into repository .
52,335
public function triggerContextBound ( ExpressContext $ context ) { if ( $ this -> eventDispatcher ) { $ this -> eventDispatcher -> notify ( new ExpressContextBoundEvent ( $ context ) ) ; } }
Trigger the context - bound event for the given context .
52,336
public function generateXmlSchemaBuilders ( ) { $ result = [ ] ; foreach ( $ this -> helpers -> findAll ( ) as $ key => $ helper ) { list ( $ namespace , $ name ) = explode ( '>' , $ key , 2 ) ; if ( empty ( $ result [ $ namespace ] ) ) { $ result [ $ namespace ] = new HelperXmlSchemaBuilder ( $ namespace ) ; } $ resul...
Generate XML - schema builders for each registered view helper namespace .
52,337
public static function fromQName ( $ name ) { $ types = SchemaTypes :: getInstance ( ) ; if ( $ name instanceof QName ) { if ( empty ( $ name -> prefix ) ) { $ prefix = $ types -> getPrefixForNamespace ( $ name -> namespaceURI ) ; if ( $ prefix ) $ name -> prefix = $ prefix ; } $ qname = "{$name->prefix}:{$name->localN...
The qualified name of the element
52,338
public function toString ( ) { if ( $ this -> void ) { return '<' . $ this -> tag . $ this -> createAttributes ( ) . ' />' ; } else { return '<' . $ this -> tag . $ this -> createAttributes ( ) . '>' . $ this -> recursivelyStringify ( $ this -> content ) . '</' . $ this -> tag . '>' ; } }
Generates the HTML and will recursively generate HTML out of inner content .
52,339
public function toArray ( ) { return [ 'tag' => $ this -> tag , 'void' => $ this -> void , 'attributes' => $ this -> attributes , 'content' => $ this -> recursivelyArrayify ( $ this -> content ) ] ; }
Return our element as an array .
52,340
public function append ( $ content = null ) { if ( null === $ content ) { return ; } else if ( is_array ( $ content ) ) { foreach ( $ content as $ row ) { $ this -> content [ ] = $ row ; } } else { $ this -> content [ ] = $ content ; } return $ this ; }
Append content into an element .
52,341
public function attributes ( array $ attributes ) { $ this -> attributes = array_replace ( $ this -> attributes , $ this -> markup -> attributes ( $ this -> tag , $ attributes ) ) ; return $ this ; }
Change attributes of an element .
52,342
public function prepend ( $ content = null ) { if ( null === $ content ) { return ; } else if ( is_array ( $ content ) ) { foreach ( array_reverse ( $ content ) as $ row ) { array_unshift ( $ this -> content , $ row ) ; } } else { array_unshift ( $ this -> content , $ content ) ; } return $ this ; }
Prepend content into an element .
52,343
public function open ( ) { if ( is_file ( $ this -> filename ) ) { $ fileData = file_get_contents ( $ this -> filename ) ; if ( false === $ fileData ) { throw new IOException ( 'Unable to get the contents of the json file!' ) ; } } else { $ fileData = null ; if ( ! $ this -> createIfNotExists ) { throw new FileNotFound...
Opens the json file .
52,344
public function set ( $ key , $ value ) { $ this -> assertOpened ( ) ; $ this -> contents [ ( string ) $ key ] = $ value ; }
Overwrites a record with the key parameter .
52,345
public function get ( $ key ) { $ this -> assertOpened ( ) ; $ key = ( string ) $ key ; if ( isset ( $ this -> contents [ $ key ] ) ) { return $ this -> contents [ $ key ] ; } return null ; }
Returns a record that originates from the opened json file .
52,346
public function clear ( ) { $ this -> assertOpened ( ) ; foreach ( $ this -> contents as $ key => $ value ) { unset ( $ this -> contents [ $ key ] ) ; } }
Deletes all of the records .
52,347
public function close ( ) { if ( null !== $ this -> contents ) { $ result = file_put_contents ( $ this -> filename , json_encode ( $ this -> contents ) ) ; if ( false === $ result ) { throw new IOException ( 'Unable to write to file!' ) ; } $ this -> contents = null ; } }
Writes any pending changes to the opened json file and disposes of the class .
52,348
public function _normalizeCallable ( $ callable ) { if ( $ callable instanceof Closure ) { return $ callable ; } if ( ! ( is_object ( $ callable ) && is_callable ( $ callable ) ) ) { try { $ callable = $ this -> _normalizeString ( $ callable ) ; if ( strpos ( $ callable , '::' , 1 ) === false ) { return $ callable ; } ...
Normalizes a callable such that it is possible to distinguish between function and method formats .
52,349
public function addValue ( string $ key , $ value ) { if ( $ this -> count === $ this -> maxVars ) { throw new DecodeException ( "max_input_variables exceeded" ) ; } if ( ( $ openPos = strpos ( $ key , "[" ) ) !== false && ( $ closePos = strpos ( $ key , "]" ) ) !== false && $ openPos < $ closePos ) { $ this -> addNest...
Add a value to the collection
52,350
protected function addNestedValue ( string $ key , $ value , int $ pos ) { $ levels = ( strpos ( $ key , "][" ) !== false ) ? explode ( "][" , substr ( $ key , $ pos + 1 , - 1 ) ) : [ substr ( $ key , $ pos + 1 , - 1 ) ] ; array_unshift ( $ levels , substr ( $ key , 0 , $ pos ) ) ; $ levelLen = count ( $ levels ) ; if ...
Add a value that has a nested key
52,351
private function getUsesDeclarations ( ) { asort ( $ this -> usesDeclarations ) ; $ output = [ ] ; foreach ( $ this -> usesDeclarations as $ namespace ) { $ output [ ] = sprintf ( 'use %s;' , $ namespace ) ; } return new Format ( $ output ) ; }
Get uses declaration
52,352
private function getClassDeclaration ( ) { return new Format ( sprintf ( '%sclass %s%s%s' , $ this -> isAbstract ? 'abstract ' : '' , $ this -> class , $ this -> getImplementOrExtendsDeclaration ( 'extends' , $ this -> extends ) , $ this -> getImplementOrExtendsDeclaration ( 'implements' , $ this -> implements ) ) ) ; ...
Get class declaration
52,353
private function getClassBody ( ) { $ this -> classComponents -> sort ( function ( PhpClassComponent $ a , PhpClassComponent $ b ) { if ( $ a :: SORT_ORDERING == $ b :: SORT_ORDERING ) { return $ a -> name < $ b -> name ? - 1 : 1 ; } return ( $ a :: SORT_ORDERING < $ b :: SORT_ORDERING ) ? - 1 : 1 ; } ) ; $ output = [ ...
Get class body
52,354
public static function get ( ) : array { return [ 'csrf_token' => CSRF :: generate ( ) , 'errors' => Variable :: has ( 'validation.errors' ) ? Variable :: get ( 'validation.errors' ) : ( new ValidatorFactory ( ) ) -> make ( [ ] , [ ] ) -> errors ( ) , 'old' => Variable :: has ( 'form.old' ) ? Variable :: get ( 'form.ol...
Get global variables
52,355
private static function loadAssets ( ) { $ am = \ Yii :: app ( ) -> assetManager ; $ cs = \ Yii :: app ( ) -> clientScript ; self :: $ _assetsUrl = $ am -> publish ( realpath ( __DIR__ . '/../assets' ) ) ; $ script = YII_DEBUG ? 'jquery-unveil.js' : 'jquery-unveil.min.js' ; $ cs -> registerScriptFile ( self :: $ _asset...
Publishes the required assets
52,356
public function get_default_path ( ) { if ( ! defined ( 'ABSPATH' ) ) { throw \ RuntimeException ( 'ABSPATH constant is not defined. Something is very wrong!' ) ; } $ default_path = $ this -> default_path ; if ( defined ( 'QB_CUSTOM_THEME_PATH' ) ) { $ default_path = QB_CUSTOM_THEME_PATH ; } $ result = ABSPATH . $ def...
Get default path
52,357
public function validate_path ( $ path ) { $ result = null ; $ path = ( string ) $ path ; if ( empty ( $ path ) ) { return 'Empty path is not allowed' ; } if ( DIRECTORY_SEPARATOR === substr ( $ path , - 1 , 1 ) ) { return "Path ends in slash [$path]" ; } return $ result ; }
Validate given path
52,358
public function register_path ( $ dir = null , $ persistent = true ) { $ result = false ; $ dir = ( string ) $ dir ; $ persistent = ( bool ) $ persistent ; if ( empty ( $ dir ) ) { $ dir = $ this -> get_default_path ( ) ; } $ path_fail_reason = $ this -> validate_path ( $ dir ) ; if ( $ path_fail_reason ) { return new ...
Register custom theme path
52,359
public function toString ( ) { $ metaString = '#' ; $ metaString .= $ this -> fields [ 'MetaName' ] ; if ( ! empty ( $ this -> fields [ 'MetaValue' ] ) ) $ metaString .= '="' . $ this -> fields [ 'MetaValue' ] . '"' ; return $ metaString ; }
Returns the string representation of this MetaPartial
52,360
static function join ( $ glue , array $ list , callable $ manipulator ) { $ glued = '' ; foreach ( $ list as $ key => $ value ) { $ item = $ manipulator ( $ key , $ value ) ; if ( $ item !== false ) { $ glued .= $ glue . $ item ; } } if ( ! empty ( $ glued ) ) { $ glued = substr ( $ glued , strlen ( $ glue ) ) ; } retu...
PHP join with a callback
52,361
public function setAdapter ( $ adapter , $ options = null ) { $ adapter = ucfirst ( strtolower ( $ adapter ) ) ; if ( Zend_Loader :: isReadable ( 'Zend/Validate/Barcode/' . $ adapter . '.php' ) ) { $ adapter = 'Zend_Validate_Barcode_' . $ adapter ; } if ( ! class_exists ( $ adapter ) ) { Zend_Loader :: loadClass ( $ ad...
Sets a new barcode adapter
52,362
public function addObserver ( ObserverInterface $ observerObject ) { if ( is_null ( $ observerObject ) ) { throw new ObservableException ( 'Given observer is null.' , E_WARNING ) ; } else { $ this -> getObserverSetObject ( ) -> add ( $ observerObject ) ; } }
add a observer to the observable
52,363
public function notifyObservers ( $ arg = null ) { if ( $ this -> hasChanged ( ) ) { foreach ( $ this -> getObserverSetObject ( ) as $ observerObject ) { $ observerObject -> update ( $ this , $ arg ) ; } $ this -> clearChanged ( ) ; } }
notify all observer
52,364
private function registerClients ( array $ config , ContainerBuilder $ container ) { foreach ( $ config [ 'clients' ] as $ clientType => $ clients ) { $ clientFQCN = ( $ clientType == 'apns' ) ? 'LinkValue\MobileNotifBundle\Client\ApnsClient' : 'LinkValue\MobileNotifBundle\Client\GcmClient' ; foreach ( $ clients as $ c...
Register each client as service such as link_value_mobile_notif . clients . the_client_type . my_custom_client_name
52,365
public static function get_settings ( ) { if ( ! class_exists ( 'GFWebAPI' ) ) { return false ; } $ settings = get_option ( 'gravityformsaddon_gravityformswebapi_settings' ) ; if ( empty ( $ settings ) || ! $ settings [ 'enabled' ] ) { return false ; } $ forms = [ ] ; $ method = 'GET' ; $ expires = strtotime ( self :: ...
Get the settings need to Gravity Forms .
52,366
private static function calculate_signature ( $ string , $ private_key ) { $ hash = hash_hmac ( 'sha1' , $ string , $ private_key , true ) ; return rawurlencode ( base64_encode ( $ hash ) ) ; }
Get the signature .
52,367
public function display ( $ file , $ directory = null , $ directOutput = false ) { $ output = Factory :: getInstance ( ) -> output ; $ directory = ( is_null ( $ directory ) ? $ this -> directory : $ directory ) ; if ( $ directOutput === true ) { echo $ this -> get ( $ file , $ directory ) ; } else { $ output -> append_...
Retrieve a template file using a string and a directory and immediatly parse it to the output class .
52,368
public function get ( $ file , $ directory = null ) : string { $ directory = ( is_null ( $ directory ) ? $ this -> directory : $ directory ) ; Logger :: newLevel ( "Loading template file '" . $ file . "' in '" . $ directory . "'" ) ; $ this -> loadTemplateEngines ( ) ; if ( is_null ( $ this -> current_engine ) ) { $ th...
Retrieve a template file using a string and a directory .
52,369
public function getEngineFromExtension ( $ extension ) : TemplateEngine { if ( isset ( $ this -> file_extensions [ strtolower ( $ extension ) ] ) ) { return $ this -> engines [ $ this -> file_extensions [ strtolower ( $ extension ) ] ] ; } throw new LayoutException ( 'Could not get Template Engine. No engine has corres...
Retrieve a Template Engine from a File Extension .
52,370
public function getFileFromString ( $ string , $ directory , $ extensions = array ( ) ) : string { $ directory = preg_replace ( '#/+#' , '/' , ( ! is_null ( $ directory ) ? $ directory : $ this -> directory ) . DS ) ; if ( strpbrk ( $ directory , "\\/?%*:|\"<>" ) === TRUE || strpbrk ( $ string , "\\/?%*:|\"<>" ) === TR...
Converts a layout string to a file using the directory and the used extensions .
52,371
public function setFileFromString ( $ string , $ directory , $ extensions = array ( ) ) { $ this -> file = $ this -> getFileFromString ( $ string , $ directory , $ extensions ) ; $ this -> directory = preg_replace ( '#/+#' , '/' , ( ! is_null ( $ directory ) ? $ directory : $ this -> directory ) . DS ) ; }
Converts a layout string to a file using the directory and the used extensions . It also sets the file variable of this class .
52,372
public function setEngine ( $ name ) : bool { $ this -> loadTemplateEngines ( ) ; if ( isset ( $ this -> engines [ $ name ] ) ) { $ this -> current_engine = $ this -> engines [ $ name ] ; Logger :: log ( 'Set the Template Engine to ' . $ name ) ; return true ; } throw new LayoutException ( 'Could not set engine. Engine...
Set the engine for the next layout .
52,373
public function getEngine ( $ name ) : TemplateEngine { $ this -> loadTemplateEngines ( ) ; if ( isset ( $ this -> engines [ $ name ] ) ) { return $ this -> engines [ $ name ] ; } throw new LayoutException ( 'Could not return engine. Engine does not exist' , 1 ) ; }
Get a loaded template engine .
52,374
public function registerEngine ( $ engineClass , $ engineName , $ engineFileExtensions = array ( ) ) : bool { if ( isset ( $ this -> engines [ $ engineName ] ) ) { throw new LayoutException ( "Could not register engine. Engine '" . $ engineName . "' already registered" , 1 ) ; } if ( $ engineClass instanceof TemplateEn...
Register a new template engine .
52,375
public function loadTemplateEngines ( ) { if ( ! $ this -> engines_loaded ) { Events :: fireEvent ( 'layoutLoadEngineEvent' ) ; $ this -> registerEngine ( new PHPEngine ( ) , 'PHP' , array ( 'php' ) ) ; $ this -> registerEngine ( new JsonEngine ( ) , 'JSON' , array ( 'json' ) ) ; $ this -> registerEngine ( new SmartyEn...
Load the template engines by sending a layoutLoadEngineEvent .
52,376
public function reset ( ) { if ( ! is_null ( $ this -> current_engine ) ) { $ this -> current_engine -> reset ( ) ; } $ this -> engines = array ( ) ; $ this -> engines_loaded = false ; $ this -> file_extensions = array ( ) ; $ this -> current_engine = null ; $ this -> assigned_variables = array ( ) ; $ this -> director...
Resets the layout manager to its default state .
52,377
protected function remapPublishStates ( array $ config , ContainerBuilder $ container ) { $ publishStates = array ( ) ; foreach ( $ config as $ role ) { $ publishStates [ $ role [ 'value' ] ] = $ role [ 'name' ] ; } $ container -> setParameter ( 'manhattan.publish.states' , $ publishStates ) ; }
Remaps parsed array for default into Choices field
52,378
public function prepend ( ContainerBuilder $ container ) { $ bundles = $ container -> getParameter ( 'kernel.bundles' ) ; if ( isset ( $ bundles [ 'ManhattanPublishBundle' ] ) ) { $ loader = new Loader \ YamlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config' ) ) ; $ loader -> load ( 'config.y...
Prepend extension to load in config file
52,379
public function redirect ( $ path , $ status = 301 ) { if ( ! $ this -> asWidget ) { $ response = ( new ResponseInjector ) -> build ( ) ; if ( ! $ response ) { throw new Exception ( 'Component `response` not configured' ) ; } $ response = $ response -> withStatus ( $ status ) ; $ response = $ response -> getHeaderLine ...
Redirect user to path
52,380
public function params ( $ params ) { if ( false === is_array ( $ params ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } $ this -> params = $ params ; return $ this ; }
Set the parameters
52,381
public function domain ( $ domain , $ protocol = null ) { if ( false === is_string ( $ domain ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ domain ) ) , E_USER_ERROR ) ; } if ( false === Router :: routeExists ( $ this -> identifier ,...
Set the domain name with HTTP protocol
52,382
public function seconds ( $ seconds ) { if ( false === ( '-' . intval ( $ seconds ) == '-' . $ seconds ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ seconds ) ) , E_USER_ERROR ) ; } $ this -> seconds = $ seconds ; return $ this ; }
Set the amount of seconds
52,383
public function execute ( $ code = null ) { if ( null !== $ code && false === ( '-' . intval ( $ code ) == '-' . $ code ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ code ) ) , E_USER_ERROR ) ; } $ this -> setUrl ( ) ; if ( null !==...
Execute forward with options HTTP status code
52,384
public function deleteImages ( ) { $ thumb = false ; $ img = false ; if ( file_exists ( $ this -> path ) ) { unlink ( $ this -> path ) ; } if ( file_exists ( $ this -> thumbnailPath ) ) { unlink ( $ this -> thumbnailPath ) ; } $ img = ! file_exists ( $ this -> path ) ; $ thumb = ! file_exists ( $ this -> thumbnailPath ...
Phisically remove images that are related to this doument entity . It does not touch anything on the database!
52,385
private function parseFileToDOM ( $ file ) { try { $ dom = XmlUtils :: loadFile ( $ file , array ( $ this , 'validateSchema' ) ) ; } catch ( \ InvalidArgumentException $ e ) { throw new InvalidArgumentException ( sprintf ( 'Unable to parse file "%s".' , $ file ) , $ e -> getCode ( ) , $ e ) ; } $ this -> validateExtens...
Parses a XML file to a \ DOMDocument .
52,386
private function validateExtensions ( \ DOMDocument $ dom , $ file ) { foreach ( $ dom -> documentElement -> childNodes as $ node ) { if ( ! $ node instanceof \ DOMElement || 'http://symfony.com/schema/dic/services' === $ node -> namespaceURI ) { continue ; } if ( ! $ this -> container -> hasExtension ( $ node -> names...
Validates an extension .
52,387
private function loadFromExtensions ( \ DOMDocument $ xml ) { foreach ( $ xml -> documentElement -> childNodes as $ node ) { if ( ! $ node instanceof \ DOMElement || self :: NS === $ node -> namespaceURI ) { continue ; } $ values = static :: convertDomElementToArray ( $ node ) ; if ( ! is_array ( $ values ) ) { $ value...
Loads from an extension .
52,388
public function setScope ( $ scope ) { if ( in_array ( $ scope , $ this -> scopes ) === false ) { throw Exception \ Scope :: invalidScope ( $ scope , $ this -> scopes ) ; } $ this -> scope = $ scope ; return $ this ; }
Set the current scope
52,389
public function parseBlockComment ( $ blockComment ) { $ blockCommentLines = $ this -> parseBlockCommentLines ( $ blockComment ) ; return new Element \ DocumentationBlock ( $ this -> parseBlockCommentTags ( $ blockCommentLines ) , $ this -> parseBlockCommentSummary ( $ blockCommentLines ) , $ this -> parseBlockCommentB...
Parse a documentation block comment .
52,390
public function value ( $ value ) { if ( ! is_array ( $ value ) ) { if ( strpbrk ( $ value , Lexer :: ESCAPED_STRING ) !== false ) { if ( ! ( substr ( $ value , 0 , 1 ) == '"' && substr ( $ value , - 1 ) == '"' ) ) { return '(' . addcslashes ( $ value , Lexer :: ESCAPED_STRING_PAREN_ENCAPSED ) . ')' ; } } return $ valu...
Compile a value
52,391
public function isAnInExpression ( TreeExpression $ expr ) { $ count = $ expr -> count ( ) ; if ( $ count <= 1 || strtolower ( $ expr -> getValue ( ) ) != 'or' ) return false ; $ children = $ expr -> getChildren ( ) ; if ( ! $ children [ 0 ] instanceof FieldExpression ) return false ; for ( $ i = 1 ; $ i < $ count ; $ ...
Can be the tree expression converted in a FIELD IN ... expression?
52,392
static function xmlData ( $ string , $ cdata = false ) { $ string = str_replace ( "]]>" , "]]]]><![CDATA[>" , $ string ) ; if ( ! $ cdata ) $ string = "<![CDATA[$string]]>" ; return $ string ; }
Normalize the string for XML tag content data
52,393
static function compressCSS ( $ code ) { $ code = self :: clearWhitespaces ( $ code ) ; $ code = preg_replace ( '/ ?\{ ?/' , "{" , $ code ) ; $ code = preg_replace ( '/ ?\} ?/' , "}" , $ code ) ; $ code = preg_replace ( '/ ?\; ?/' , ";" , $ code ) ; $ code = preg_replace ( '/ ?\> ?/' , ">" , $ code ) ; $ code = preg_re...
Returns compressed content of given CSS code
52,394
public function putErrors ( $ errors ) { if ( ! is_array ( $ errors ) && ! ( $ errors instanceof MessageProvider ) ) { $ errors = [ $ errors ] ; } $ this -> errors -> merge ( $ errors ) ; }
Puts more errors in its message bag .
52,395
public function syncAction ( ) { $ this -> manager -> syncPackages ( PackageHelperInterface :: DEFAULT_PACKAGE_BUNDLE_TYPE ) ; $ this -> manager -> syncPackages ( PackageHelperInterface :: DEFAULT_PACKAGE_THEME_TYPE ) ; $ this -> manager -> getFlashHelper ( ) -> addSuccess ( 'package.flash.sync.success' ) ; return $ th...
Action used to sync packages from remote servers ie . packagist . org
52,396
public function notifyAction ( Request $ request ) { $ token = $ this -> getHttpRequestVerifier ( ) -> verify ( $ request ) ; $ gateway = $ this -> getPayum ( ) -> getGateway ( $ token -> getGatewayName ( ) ) ; $ gateway -> execute ( $ notify = new Notify ( $ token ) ) ; $ payment = $ notify -> getFirstModel ( ) ; $ ev...
Notify action .
52,397
public function doneAction ( Request $ request ) { $ debug = $ this -> container -> getParameter ( 'kernel.debug' ) ; $ token = $ this -> getHttpRequestVerifier ( ) -> verify ( $ request ) ; $ gateway = $ this -> getPayum ( ) -> getGateway ( $ token -> getGatewayName ( ) ) ; $ gateway -> execute ( $ done = new Done ( $...
Done action .
52,398
public function add ( TrackedObject $ tracked ) { $ id = $ tracked -> getID ( ) ; if ( isset ( $ this -> map [ $ id ] ) ) { return ; } $ this -> map [ $ id ] = $ tracked ; $ this -> adapter -> watch ( $ tracked ) ; }
Add a new TrackedObject into map
52,399
public function addChangeSet ( $ tracked , $ eventMask ) { if ( $ tracked instanceof TrackedObject ) { $ path = $ tracked -> getResource ( ) ; if ( $ this -> fileOnly && ! $ tracked -> getResource ( ) instanceof FileResource ) { return ; } } else { $ path = $ tracked ; } $ event = new FilesystemEvent ( $ path , $ event...
Add a new event to changeset