idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
53,600
public function getLocaleNativeAttribute ( ) { $ locale = $ this -> getAttributeFromArray ( 'locale' ) ; try { return localization ( ) -> getSupportedLocales ( ) -> get ( $ locale ) -> native ( ) ; } catch ( \ Exception $ e ) { return strtoupper ( $ locale ) ; } }
Get the locale s native name .
53,601
public function runningInStrictMode ( ) : bool { $ strictMode = true ; $ settings = $ this -> getSettings ( ) ; if ( is_array ( $ settings ) && ! empty ( $ settings ) ) { $ mode = $ settings [ 'mode' ] ; if ( $ mode != self :: STRICT_MODE ) { $ strictMode = false ; } } return $ strictMode ; }
Checks if T3v DataMapper is running in strict mode .
53,602
public function runningInFallbackMode ( ) : bool { $ fallbackMode = false ; $ settings = $ this -> getSettings ( ) ; if ( is_array ( $ settings ) && ! empty ( $ settings ) ) { $ mode = $ settings [ 'mode' ] ; if ( $ mode === self :: FALLBACK_MODE ) { $ fallbackMode = true ; } } return $ fallbackMode ; }
Checks if T3v DataMapper is running in fallback mode .
53,603
protected function __initInputValidate ( array & $ data ) { if ( ! is_array ( $ data ) ) { throw \ Exception ( "Entity\Base expects a array for it's first argument" ) ; } switch ( static :: $ inputValidate ) { case self :: VALIDATE_DISABLE : break ; case self :: VALIDATE_STRIP : $ data = \ array_intersect_key ( $ data ...
Constructor input validation . External to the constructor so that the constructor may itself be overloaded more easily .
53,604
public function copy ( $ deep = false ) { $ data = $ this -> data ; foreach ( static :: $ keyProperties as $ key ) { $ data [ $ key ] = null ; } foreach ( $ data as $ key => $ value ) { if ( is_object ( $ value ) and ! ( $ value instanceof self ) ) { $ data [ $ key ] = clone $ value ; } } try { if ( $ repository = $ th...
Make a shallow copy of a object clearing it s key fields
53,605
public function markDeleted ( ) { try { if ( $ repository = $ this -> r ( ) ) { $ repository -> detach ( $ this ) ; } } catch ( EntityMissingEntityManagerException $ e ) { } $ this -> checksum = null ; return $ this ; }
Mark a entity as deleted
53,606
public function markPersisted ( ) { try { if ( $ repository = $ this -> r ( ) ) { $ repository -> isNew ( $ this , false ) ; } } catch ( EntityMissingEntityManagerException $ e ) { } $ this -> checksumReset ( ) ; $ this -> clearDataInitialStore ( ) ; return $ this ; }
Mark a entity as persisted
53,607
public function uidGet ( ) { if ( isset ( $ this -> uid ) ) { return $ this -> uid -> key ; } elseif ( $ key = $ this -> keyGet ( $ this ) ) { return $ key ; } $ this -> uid = new Uid ( $ this ) ; return $ this -> uid -> key ; }
Get a uid for a object . This uid has the following properties .
53,608
protected function readOnlySafetyCheck ( ) { switch ( static :: $ isReadOnly ) { case self :: FULL_ACCESS : return false ; case self :: READONLY_DISABLE : return true ; case self :: READONLY_EXCEPTION : throw new ReadonlyException ( "Entity is readonly" ) ; case self :: READONLY_ON_PERSIST : if ( $ this -> isNew ( ) !=...
Is this object readonly?
53,609
public function initalPropertySet ( $ key , $ value ) { if ( is_array ( $ this -> dataInitial ) and $ repository = $ this -> r ( ) and in_array ( $ key , $ repository -> initialProperties ) ) { $ initialValue = $ this -> get ( $ key , self :: READONLY_EXCEPTION , $ source = self :: DATA ) ; if ( $ initialValue !== $ va...
InitialPropertiesSet helper method
53,610
public static function keyGet ( $ data ) { $ class = get_called_class ( ) ; if ( $ data instanceof $ class ) { $ keys = array ( ) ; foreach ( static :: $ keyProperties as $ property ) { $ value = $ data -> get ( $ property ) ; if ( $ value instanceof Base ) { $ value = call_user_func ( array ( get_class ( $ value ) , '...
Key entity key
53,611
public function canValidateProperty ( $ key ) { return isset ( $ this -> data [ $ key ] ) and is_object ( $ this -> data [ $ key ] ) and $ this -> data [ $ key ] instanceof Base ; }
Has validation property?
53,612
private function filterSpecialCharacters ( $ string ) { $ string = str_replace ( '<' , ' <' , $ string ) ; $ string = strip_tags ( $ string ) ; $ string = trim ( $ string ) ; $ string = iconv ( 'UTF-8' , 'ASCII//TRANSLIT//IGNORE' , $ string ) ; $ string = str_replace ( array ( '+' , '=' , '!' , ',' , '.' , ';' , ':' , ...
Filter out all special characters like punctuation and characters with accents
53,613
public function fetchAll ( $ params = [ ] ) { return $ this -> table -> select ( function ( Select $ select ) { $ select -> columns ( [ ] ) ; $ select -> join ( $ this -> roleTableName , sprintf ( '%s.role_id=%s.role_id' , $ this -> roleTableName , $ this -> table -> getTable ( ) ) ) ; $ select -> where ( [ 'user_id' =...
Fetch all or a subset of resources
53,614
private function addCurrencySymbol ( string $ value , ? string $ currency = null ) : string { $ currency = $ currency ?? $ this -> defaultCurrency ; $ locale = \ Locale :: getDefault ( ) ; if ( ! isset ( self :: $ patterns [ $ locale ] ) ) { self :: $ patterns [ $ locale ] = [ ] ; } if ( ! isset ( self :: $ patterns [ ...
Adds the currency symbol when missing .
53,615
private function removeCurrencySymbol ( string $ value , string $ currency ) : string { $ locale = \ Locale :: getDefault ( ) ; if ( ! isset ( self :: $ patterns [ $ locale ] [ $ currency ] ) ) { $ this -> addCurrencySymbol ( '123' , $ currency ) ; } return preg_replace ( '#(\s?' . preg_quote ( self :: $ patterns [ $ l...
Removes the currency symbol .
53,616
public function getFirst ( $ sql = null ) { if ( $ sql ) { $ this -> setLastQuery ( $ sql ) ; try { $ result = $ this -> db -> query ( $ sql ) ; } catch ( \ PDOException $ e ) { throw new DatabaseException ( $ e -> getMessage ( ) . '<br>' . $ this -> getLastQuery ( ) [ 0 ] ) ; } $ data = $ this -> fetchAssoc ( $ result...
Return the first the matching row
53,617
public function getById ( $ id ) { $ sql = "SELECT * FROM " . $ this -> getTable ( ) . " WHERE " . $ this -> getPrimaryKey ( ) . " = " . intval ( $ id ) . ";" ; try { $ result = $ this -> db -> query ( $ sql ) ; } catch ( \ PDOException $ e ) { throw new DatabaseException ( $ e -> getMessage ( ) . '<br>' . $ sql ) ; } ...
Select a row by id from this table
53,618
public function setConnectionInfo ( array $ connections ) { foreach ( $ connections as $ connectionInfo ) { if ( empty ( $ connectionInfo [ 'hostname' ] ) ) $ connectionInfo [ 'hostname' ] = 'localhost' ; if ( empty ( $ connectionInfo [ 'port' ] ) ) $ connectionInfo [ 'port' ] = 3306 ; if ( empty ( $ connectionInfo [ '...
Validates required values are present for a database connection .
53,619
public function getConnection ( ) { if ( empty ( $ this -> connection ) ) { if ( empty ( $ this -> connectionConfig ) || ! is_array ( $ this -> connectionConfig ) ) throw new DatabaseException ( "Connection config is empty or not an array." ) ; $ connCount = count ( $ this -> connectionConfig ) ; for ( $ i = 0 ; $ i < ...
Gets the current PDO connection object
53,620
public function readField ( $ sql ) { $ result = $ this -> read ( $ sql ) ; $ result -> setFetchMode ( PDO :: FETCH_COLUMN , 0 ) ; $ row = $ result -> fetch ( ) ; unset ( $ result ) ; return $ row ; }
Returns the first column of the first row of the result set
53,621
public function readCol ( $ sql ) { $ result = $ this -> read ( $ sql ) ; $ row = $ result -> fetchAll ( PDO :: FETCH_COLUMN , 0 ) ; unset ( $ result ) ; return $ row ; }
Returns an array of values for the first column of the result set
53,622
public function readOne ( $ sql ) { $ result = $ this -> readAll ( $ sql , false ) ; if ( count ( $ result ) > 0 ) { return $ result [ 0 ] ; } }
Returns the first row of the result set as an associative array regardless of the overall number of rows
53,623
public function readAll ( $ sql , $ calcFoundRows = false ) { $ result = $ this -> read ( $ calcFoundRows ? $ this -> insertPagingFlag ( $ sql ) : $ sql ) ; $ rows = $ result -> fetchAll ( PDO :: FETCH_ASSOC ) ; unset ( $ result ) ; unset ( $ sql ) ; return $ rows ; }
Returns an associative array of rows and columns
53,624
public function bulkInsertRecords ( $ tablename , $ parameters , $ limit = 25 ) { if ( empty ( $ parameters ) ) throw new DatabaseException ( 'bulkInsertRecords: no parameters.' ) ; $ count = 0 ; $ tcount = 0 ; $ totalcount = count ( $ parameters ) ; foreach ( $ parameters as $ value ) { if ( ! is_array ( $ value ) ) t...
Inserts multiple records utilizing less INSERT statements .
53,625
public function insertRecord ( $ tablename , $ parameters , $ ignore = false ) { if ( empty ( $ parameters ) ) throw new DatabaseException ( 'insertRecord: no parameters.' ) ; $ insert_fields = array ( ) ; $ insert_values = array ( ) ; foreach ( $ parameters as $ name => $ value ) { $ insert_fields [ ] = $ name ; $ ins...
Provides a convenience method for inserting an single row of columns and values into a database table
53,626
public function updateRecord ( $ tablename , $ parameters , $ where ) { $ update = array ( ) ; foreach ( $ parameters as $ name => $ value ) { $ update [ ] = "$name = " . $ this -> quote ( $ value ) . "" ; } $ sql = "UPDATE " . $ tablename . " SET " . implode ( "," , $ update ) . " WHERE " . $ where ; return $ this -> ...
Provides convenience method for updating columns on a table for 1 or many records matching a WHERE clause
53,627
public function deleteRecord ( $ tablename , $ where ) { if ( ! empty ( $ tablename ) && ! empty ( $ where ) ) { $ sql = "DELETE FROM " . $ tablename . " WHERE " . $ where ; return $ this -> write ( $ sql , DatabaseInterface :: AFFECTED_ROWS ) ; } }
Provides convenience method for deleting records matching a WHERE clause
53,628
public function quote ( $ var ) { if ( is_null ( $ var ) || strtoupper ( $ var ) == 'NULL' ) return 'NULL' ; if ( $ var instanceof Date ) $ var = $ this -> DateFactory -> toStorageDate ( $ var ) -> toMySQLDate ( ) ; return $ this -> getConnection ( ) -> quote ( $ var ) ; }
Returns escaped value automatically wrapped in single quotes
53,629
public function read ( $ sql ) { $ sql = ( string ) $ sql ; $ conn = $ this -> getConnection ( ) ; $ this -> Benchmark -> start ( 'sql-query' ) ; try { $ result = $ conn -> query ( $ sql ) ; } catch ( PDOException $ pe ) { $ errorMessage = $ pe -> getMessage ( ) ; $ this -> Logger -> debug ( array ( 'Conn' => $ this ->...
Runs the SQL query in read - only mode from the database
53,630
public function import ( $ filename ) { if ( ! file_exists ( $ filename ) ) { throw new Exception ( "File not found: $filename" ) ; } $ sql_queries = file_get_contents ( $ filename ) ; $ sql_queries = $ this -> _removeRemarks ( $ sql_queries ) ; $ sql_queries = StringUtils :: smartSplit ( $ sql_queries , ";" , "'" , "\...
Imports and runs sql contained in the specified file . The file must contain only valid sql .
53,631
private function _removeRemarks ( $ sql ) { $ sql = preg_replace ( '/\n{2,}/' , "\n" , preg_replace ( '/^[-].*$/m' , "\n" , $ sql ) ) ; $ sql = preg_replace ( '/\n{2,}/' , "\n" , preg_replace ( '/^#.*$/m' , "\n" , $ sql ) ) ; return $ sql ; }
remove_remarks will strip the sql comment lines out of an uploaded sql file
53,632
public function identifyEntity ( ModelInterface $ model , & $ entity , $ identifier ) { $ primaryKeys = $ model -> primaryFields ( ) ; if ( count ( $ primaryKeys ) !== 1 ) { return ; } $ field = reset ( $ primaryKeys ) -> name ( ) ; $ this -> setPropertyValue ( $ entity , $ field , $ identifier ) ; }
Assigns passed identifier to primary key Possible only when entity has one primary key
53,633
public function getPropertyValue ( $ entity , $ field , $ default = null ) { $ this -> assertEntity ( $ entity ) ; if ( is_array ( $ entity ) || $ entity instanceof \ ArrayAccess ) { return isset ( $ entity [ $ field ] ) ? $ entity [ $ field ] : $ default ; } $ ref = $ this -> getReflection ( $ entity ) ; if ( ! $ ref ...
Returns property value
53,634
public function setPropertyValue ( & $ entity , $ field , $ value ) { $ this -> assertEntity ( $ entity ) ; if ( is_array ( $ entity ) || $ entity instanceof \ ArrayAccess ) { $ entity [ $ field ] = $ value ; return ; } $ ref = $ this -> getReflection ( $ entity ) ; if ( ! $ ref -> hasProperty ( $ field ) ) { $ entity ...
Sets property value
53,635
private function getReflection ( $ object ) { $ key = get_class ( $ object ) ; if ( ! array_key_exists ( $ key , $ this -> buffer ) ) { $ this -> buffer [ $ key ] = new \ ReflectionClass ( $ object ) ; } return $ this -> buffer [ $ key ] ; }
Returns object reflection instance
53,636
private function getProperty ( \ ReflectionClass $ ref , $ property ) { $ prop = $ ref -> getProperty ( $ property ) ; $ prop -> setAccessible ( true ) ; return $ prop ; }
Returns object property instance
53,637
public function addPropertyValue ( & $ entity , $ field , $ value ) { $ container = $ this -> getPropertyValue ( $ entity , $ field , $ entity ) ; if ( ! is_array ( $ container ) ) { $ container = empty ( $ container ) ? [ ] : [ $ container ] ; } $ container [ ] = $ value ; $ this -> setPropertyValue ( $ entity , $ fie...
Adds value to array property If property is not an array - will be converted into one preserving existing value as first element
53,638
public function getTableAlias ( $ table_name = null ) { if ( ! $ table_name ) { $ table_name = $ this -> getTableName ( ) ; } $ bits = explode ( "_" , $ table_name ) ; $ alias = '' ; foreach ( $ bits as $ bit ) { $ alias .= strtolower ( substr ( $ bit , 0 , 1 ) ) ; } return $ alias ; }
Get the short alias name of a table .
53,639
public function getTablePrimaryKey ( ) { trigger_error ( 'getTablePrimaryKey() is deprecated. Use getIDField() instead.' , E_USER_DEPRECATED ) ; $ keys = $ this -> getPrimaryKeyIndex ( ) ; return isset ( $ keys [ 0 ] ) ? $ keys [ 0 ] : false ; }
Get table primary key column name
53,640
public function getPrimaryKeyIndex ( ) { $ database = DatabaseLayer :: getInstance ( ) ; $ columns = array ( ) ; if ( $ this instanceof VersionedActiveRecord ) { $ schema = $ this -> getClassSchema ( ) ; $ firstColumn = reset ( $ schema ) [ 'name' ] ; $ columns = [ $ firstColumn => $ firstColumn , "sequence" => "sequen...
Get a unique key to use as an index
53,641
public function getId ( ) { $ col = $ this -> getIDField ( ) ; if ( property_exists ( $ this , $ col ) ) { $ id = $ this -> $ col ; if ( $ id > 0 ) { return $ id ; } } return false ; }
Get object ID
53,642
public function getLabel ( ) { if ( property_exists ( $ this , '_label_column' ) ) { if ( property_exists ( $ this , $ this -> _label_column ) ) { $ label_column = $ this -> _label_column ; return $ this -> $ label_column ; } } if ( property_exists ( $ this , 'name' ) ) { return $ this -> name ; } if ( property_exists ...
Get a label for the object . Perhaps a Name or Description field .
53,643
public function __calculateSaveDownRows ( ) { if ( ! $ this -> _columns ) { foreach ( get_object_vars ( $ this ) as $ potential_column => $ discard ) { switch ( $ potential_column ) { case 'table' : case substr ( $ potential_column , 0 , 1 ) == "_" : break ; default : $ this -> _columns [ ] = $ potential_column ; break...
Work out which columns should be saved down .
53,644
public function save ( $ automatic_reload = true ) { $ this -> preSave ( ) ; $ this -> __fieldFix ( ) ; $ this -> __calculateSaveDownRows ( ) ; $ primary_key_column = $ this -> getIDField ( ) ; $ data = array ( ) ; foreach ( $ this -> _columns as $ column ) { if ( $ column != $ primary_key_column || $ this instanceof V...
Save the selected record . This will do an INSERT or UPDATE as appropriate
53,645
public function reload ( ) { $ item = $ this -> getById ( $ this -> getId ( ) ) ; if ( $ item !== false ) { $ this -> loadFromRow ( $ item ) ; return $ this ; } else { return false ; } }
Reload the selected record
53,646
public function delete ( ) { $ database = DatabaseLayer :: getInstance ( ) ; $ delete = $ database -> delete ( $ this -> getTableName ( ) , $ this -> getTableAlias ( ) ) ; $ delete -> setModel ( $ this ) ; $ delete -> condition ( $ this -> getIDField ( ) , $ this -> getId ( ) ) ; $ delete -> execute ( $ this -> getClas...
Delete the selected record
53,647
public static function getBySlug ( $ slug ) { $ slug_parts = explode ( "-" , $ slug , 2 ) ; $ class = get_called_class ( ) ; $ temp_this = new $ class ( ) ; $ primary_key = $ temp_this -> getIDField ( ) ; return self :: search ( ) -> where ( $ primary_key , $ slug_parts [ 0 ] ) -> execOne ( ) ; }
Pull a database record by the slug we re given .
53,648
public function __fieldFix ( ) { $ schema = $ this -> getClassSchema ( ) ; foreach ( $ this -> __calculateSaveDownRows ( ) as $ column ) { if ( ! isset ( $ schema [ $ column ] [ 'type' ] ) ) { throw new Exception ( "No type hinting/docblock found for '{$column}' in '" . get_called_class ( ) . "'." , E_USER_WARNING ) ; ...
Fix types of fields to match definition
53,649
protected function respondNotFound ( $ message = '' ) { if ( empty ( $ message ) ) { $ message = ucfirst ( $ this -> baseClass ) . ' does not exist' ; } return $ this -> respondWithError ( $ message , 404 ) ; }
Respond with an error in case the resource request is not found
53,650
public function loadMessages ( $ className ) { $ map = [ ] ; if ( class_exists ( $ className ) ) { $ class = new \ ReflectionClass ( $ className ) ; $ file = $ class -> getFileName ( ) ; $ nfile = substr_replace ( $ file , '.' . $ this -> language . '.php' , - 4 ) ; if ( file_exists ( $ nfile ) ) { $ res = include $ nf...
Load language file from the same directory of message class .
53,651
public function setNewValue ( $ attribute , $ value ) { $ this -> assertValidAttribute ( $ attribute ) ; $ this -> documentChangeSet [ $ attribute ] [ 1 ] = $ value ; $ this -> getDocumentManager ( ) -> getUnitOfWork ( ) -> setDocumentChangeSet ( $ this -> getDocument ( ) , $ this -> documentChangeSet ) ; }
Sets the new value of this attribute .
53,652
private function assertValidAttribute ( $ attribute ) { if ( ! isset ( $ this -> documentChangeSet [ $ attribute ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Attribute "%s" is not a valid attribute of the document "%s" in PreUpdateEventArgs.' , $ attribute , get_class ( $ this -> getDocument ( ) ) ) ) ; } ...
Asserts the attribute exists in changeset .
53,653
final public function getPathInfo ( $ path , $ use_include_path = false ) { if ( $ use_include_path ) { $ path = stream_resolve_include_path ( $ path ) ; } else { $ path = realpath ( $ path ) ; } if ( is_string ( $ path ) ) { list ( $ this -> dirname , $ this -> basename , $ this -> extension , $ this -> filename ) = a...
Retrieves information about path components
53,654
public function onEvent ( Event $ event ) : void { if ( ! $ event instanceof GetResponseEvent || ! $ this -> injected ) { if ( null !== ( $ filter = $ this -> getFilter ( ) ) ) { $ this -> injectParameters ( $ filter ) ; } } }
Action on the event .
53,655
protected function getFilter ( ) { $ supports = $ this -> supports ( ) ; $ filters = $ this -> entityManager -> getFilters ( ) -> getEnabledFilters ( ) ; $ fFilter = null ; foreach ( $ filters as $ name => $ filter ) { if ( $ filter instanceof $ supports ) { $ fFilter = $ filter ; break ; } } return $ fFilter ; }
Get the supported filter .
53,656
public function isMatch ( $ method , $ url ) { $ match = false ; if ( \ in_array ( $ method , $ this -> responds_to ) ) { \ preg_match ( $ this -> compile ( ) , $ url , $ matches ) ; if ( ! empty ( $ matches ) ) { $ this -> matched_params = \ array_merge ( $ this -> defaults , $ this -> method_defaults [ $ method ] , $...
Check to see if this route is a match .
53,657
public function url ( $ params = array ( ) ) { if ( $ this -> isStatic ( ) ) { return $ this -> pattern ; } $ url = $ this -> pattern ; foreach ( $ this -> getSegments ( $ url ) as $ segment ) { $ func = $ segment [ 'optional' ] === true ? 'replaceOptional' : 'replaceRequired' ; $ url = $ this -> { $ func } ( $ url , $...
A reverse routing helper .
53,658
protected function compile ( ) { if ( $ this -> compiled !== false ) { return $ this -> compiled ; } if ( $ this -> isStatic ( ) ) { $ this -> compiled = '~^' . $ this -> pattern . '$~' ; return $ this -> compiled ; } $ compiled = $ this -> pattern ; foreach ( $ this -> getSegments ( $ compiled ) as $ segment ) { $ com...
Compiles the pattern into one suitable for regex .
53,659
protected function getSegments ( $ pattern ) { $ segments = array ( ) ; $ parts = \ explode ( "/" , ltrim ( $ pattern , "/" ) ) ; foreach ( $ parts as $ segment ) { if ( \ strpos ( $ segment , ":" ) !== false ) { $ segments [ ] = $ this -> parseSegment ( $ segment ) ; } } return $ segments ; }
Gets an array of url segments
53,660
protected function parseSegment ( $ segment ) { $ optional = false ; list ( $ regex , $ name ) = \ explode ( ":" , $ segment ) ; if ( \ substr ( $ name , - 1 ) === "?" ) { $ name = \ substr ( $ name , 0 , - 1 ) ; $ optional = true ; } if ( $ regex === "" ) { $ regex = "[^\/]+" ; } $ regex = "/(?P<{$name}>{$regex})" ; i...
Pulls out relevent information on a given segment .
53,661
public function nodeRouteAction ( NodeRoute $ nodeRoute ) { if ( $ node = $ this -> get ( 'mm_cmf_routing.node_resolver' ) -> resolve ( $ nodeRoute ) ) { if ( $ nodeRoute instanceof RedirectNodeRoute ) { return $ this -> redirectAction ( $ nodeRoute ) ; } else { if ( $ nodeRoute -> getNode ( ) instanceof TemplatableNod...
process the the node route call
53,662
public static function genRandomStr ( $ l ) { $ p = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ s = '' ; for ( $ i = 0 ; $ i < $ l ; $ i ++ ) { $ s .= $ p [ mt_rand ( 0 , ( mb_strlen ( $ p ) - 1 ) ) ] ; } return $ s ; }
Generate a random string of letters and numbers of a specific length .
53,663
public static function uniqid ( $ length = false ) { if ( $ length <= 13 ) { return uniqid ( ) ; } $ uniq = strrev ( str_replace ( '.' , '' , uniqid ( '' , true ) ) ) ; $ uniqlen = mb_strlen ( $ uniq ) ; if ( $ length === false || $ length === $ uniqlen ) { return $ uniq ; } elseif ( $ length < $ uniqlen ) { return mb_...
Generate a guaranteed unique value of a specified length .
53,664
public function addPrefix ( $ prefix , $ baseDirs , $ prepend = FALSE ) { $ baseDirs = ( array ) $ baseDirs ; $ prefix = trim ( $ prefix , '\\' ) . '\\' ; if ( ! isset ( $ this -> prefixes [ $ prefix ] ) ) { $ this -> prefixes [ $ prefix ] = [ ] ; } foreach ( $ baseDirs as $ ndx => $ dir ) { $ baseDirs [ $ ndx ] = rtri...
add a base directory for a namespace prefix
53,665
public function setPrefixes ( array $ prefixes ) { $ this -> prefixes = [ ] ; foreach ( $ prefixes as $ prefix => $ baseDir ) { $ this -> addPrefix ( $ prefix , $ baseDir ) ; } }
set all namespace prefixes and their base directories ; overwrites existing prefixes
53,666
protected function loadFile ( $ prefix , $ relativeClass ) { if ( ! isset ( $ this -> prefixes [ $ prefix ] ) ) { $ this -> debug [ ] = $ prefix . ': no base dirs' ; return FALSE ; } foreach ( $ this -> prefixes [ $ prefix ] as $ baseDir ) { $ file = $ baseDir . str_replace ( '\\' , DIRECTORY_SEPARATOR , $ relativeClas...
loads mapped file for a namespace prefix and relative class
53,667
public function nodesFormAction ( Request $ request ) { $ node = new Node ( ) ; $ this -> currentNode = $ request -> get ( 'node' ) ; if ( $ this -> currentNode ) { $ node = $ this -> get ( "ydle.node.manager" ) -> find ( $ request -> get ( 'node' ) ) ; } $ action = $ this -> get ( 'router' ) -> generate ( 'submitNodeF...
Display a form to create or edit a node .
53,668
public function setObject ( $ object , $ throwExceptionOnFailure = true ) { if ( ! is_object ( $ object ) ) { throw new BadTaskException ( "A task must be object" ) ; return false ; } $ error = null ; if ( $ isCompatible = static :: isCompatible ( $ object , $ error ) ) { $ this -> object = $ object ; return true ; } i...
Set a task s object property
53,669
protected function getConfigInject ( $ type ) { switch ( strtolower ( $ type ) ) { case 'all' : case 'a' : return engineGet ( 'inject' , 'all' ) ; case 'controllers' : case 'controller' : case 'c' : return array_merge ( engineGet ( 'inject' , 'all' ) , engineGet ( 'inject' , 'controllers' ) ) ; case 'services' : case '...
Fetches classes to inject from the config file . If given type is not all the required is merged with the all
53,670
final public function checkInjections ( $ className ) { if ( is_array ( $ this -> inject ( ) ) ) { foreach ( $ this -> inject ( ) as $ classArray ) { if ( ! is_array ( $ classArray ) || ( is_array ( $ classArray ) && ! isset ( $ classArray [ 'class' ] ) ) || ( is_array ( $ classArray ) && ! class_exists ( $ classArray ...
Checks the injection for cyclic dependencies
53,671
private function canInject ( array $ classArray , $ className = null ) { $ className = ( $ className === null ) ? $ this -> getClass ( ) : $ className ; if ( ! self :: addInjecting ( $ className ) ) { return false ; } $ refClass = new \ ReflectionClass ( $ classArray [ 'class' ] ) ; if ( $ refClass -> isSubclassOf ( 'D...
Checks if the class can be injected
53,672
private function doInject ( ) { foreach ( $ this -> prepareInject ( ) as $ alias => $ classArray ) { if ( ! is_array ( $ classArray ) ) { throw new \ Exception ( 'Injection failed. Values of injection array in class "' . $ this -> getClass ( ) . '" must be an array' ) ; } if ( ! isset ( $ classArray [ 'class' ] ) ) { t...
Performs the actual injection
53,673
private function addPropertiesAndConstantsForContainer ( ) { $ this -> addPropertiesAndConstantsFromReflection ( $ this -> containerClassReflection ) ; foreach ( $ this -> compositeClassReflectionArray as $ compositeClassReflection ) { $ paramName = $ this -> getComponentName ( $ compositeClassReflection ) ; $ newPrope...
Adds the properties and constants from the decorating class to the class being weaved .
53,674
public static function title ( $ link ) { if ( isset ( $ link [ 'title' ] ) || isset ( $ link [ 'label' ] ) ) { return ' title="' . trim ( isset ( $ link [ 'title' ] ) && ! empty ( trim ( $ link [ 'title' ] ) ) ? $ link [ 'title' ] : $ link [ 'label' ] ) . '"' ; } return false ; }
Returns the HTML title element
53,675
public static function label ( $ link ) { if ( isset ( $ link [ 'label' ] ) && ! empty ( trim ( $ link [ 'label' ] ) ) ) { return trim ( $ link [ 'label' ] ) ; } elseif ( isset ( $ link [ 'title' ] ) && ! empty ( trim ( $ link [ 'title' ] ) ) ) { return trim ( $ link [ 'title' ] ) ; } return false ; }
Returns the link label element
53,676
public static function href ( $ link ) { if ( isset ( $ link [ 'uri' ] ) || isset ( $ link [ 'fragment' ] ) ) { return ' href="' . URI :: getHref ( $ link ) . '"' ; } return false ; }
Returns the link href element
53,677
public static function htmlClass ( $ class , $ activeClass ) { if ( ( isset ( $ class ) && is_string ( $ class ) && ! empty ( trim ( $ class ) ) ) || ( is_string ( $ activeClass ) && ! empty ( trim ( $ activeClass ) ) ) ) { return ' class="' . trim ( trim ( $ class ) . ' ' . $ activeClass ) . '"' ; } return false ; }
Returns the HTML class element
53,678
public static function htmlID ( $ link ) { if ( isset ( $ link [ 'id' ] ) && is_string ( $ link [ 'id' ] ) && ! empty ( trim ( $ link [ 'id' ] ) ) ) { return ' id="' . trim ( $ link [ 'id' ] ) . '"' ; } return false ; }
Returns the HTML id element
53,679
public static function fontIcon ( $ link ) { if ( isset ( $ link [ 'font-icon' ] ) && is_string ( $ link [ 'font-icon' ] ) && ! empty ( trim ( $ link [ 'font-icon' ] ) ) ) { return '<span class="' . trim ( $ link [ 'font-icon' ] ) . '"></span> ' ; } return false ; }
Inserts a given font ion in a span class
53,680
public static function formatLink ( $ link , $ activeClass , $ hasChild = false , $ breadcrumbLink = false ) { return "<a" . self :: href ( $ link ) . self :: title ( $ link ) . self :: htmlClass ( ( $ breadcrumbLink ? '' : self :: $ linkDefaults [ 'a_default' ] . ' ' ) . ( isset ( $ link [ 'class' ] ) ? $ link [ 'clas...
Returns a formatted link with all of the attributes
53,681
private function hueToPoint ( float $ p , float $ q , float $ t ) : float { if ( $ t < 0 ) { $ t += 1 ; } if ( $ t > 1 ) { $ t -= 1 ; } switch ( true ) { case $ t < 1 / 6 : return $ p + ( $ q - $ p ) * 6 * $ t ; case $ t < 1 / 2 : return $ q ; case $ t < 2 / 3 : return $ p + ( $ q - $ p ) * ( 2 / 3 - $ t ) * 6 ; } retu...
Formula taken from the internet don t know what it means
53,682
public function addFilterConstraint ( ClassMetadata $ targetEntity , $ targetTableAlias ) { if ( ! $ targetEntity -> reflClass -> implementsInterface ( \ WellCommerce \ Bundle \ LocaleBundle \ Entity \ LocaleAwareInterface :: class ) ) { return "" ; } return $ targetTableAlias . '.locale = ' . $ this -> getParameter ( ...
Adds locale filter to query
53,683
protected function fromFollowingNodeIteratorParts ( ) { if ( is_null ( $ this -> typeTest ) ) { if ( is_null ( $ this -> nameTest ) ) $ this -> kind = XPathNodeType :: All ; else $ this -> kind = XPathNodeType :: Element ; } else $ this -> kind = $ this -> typeTest -> GetNodeKind ( ) ; }
Supports constructing an instance
53,684
public static function createFlexModel ( $ identifier , $ resource , $ cachePath ) { $ domDocument = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ domDocument -> load ( $ resource ) ; $ domDocument -> xinclude ( ) ; $ flexModel = new FlexModel ( $ identifier ) ; $ flexModel -> load ( $ domDocument , $ cachePath ) ; return $ ...
Creates a new FlexModel instance .
53,685
public function call ( ) { if ( 'application/json' !== $ this -> app -> request ( ) -> headers ( 'Accept' ) ) { $ this -> next -> call ( ) ; return ; } $ callback = $ this -> app -> request ( ) -> get ( 'callback' ) ; $ this -> next -> call ( ) ; if ( empty ( $ callback ) ) { return ; } $ this -> app -> contentType ( '...
Adjust the content type accordingly and add the given callback name to the response for JSONP requests
53,686
public function defaultAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMeta ( ) -> clear ( ) ; HelperFactory :: getJS ( ) -> clear ( ) ; HelperFactory :: getStyle ( ) -> clear ( ) ; HelperFactory :: getTitle ( ) -> setTitle ( 'Redirect' ) ; if ( $ path = urldecode ( Application :...
This method display redirect page
53,687
public static function fromArray ( string $ id , string $ dsn , array $ properties ) : DatabaseConfiguration { $ self = new self ( $ id , $ dsn ) ; if ( isset ( $ properties [ 'username' ] ) ) { $ self -> userName = $ properties [ 'username' ] ; unset ( $ properties [ 'username' ] ) ; } if ( isset ( $ properties [ 'pas...
create connection data instance from an array
53,688
public function lateBind ( $ key , & $ item ) { if ( is_array ( $ item ) ) { return $ this -> classes [ $ key ] = $ item ; } return $ this -> registry -> rset ( $ key , $ item ) ; }
Binds by reference an existing object or an object definition to a key in the container .
53,689
public function current ( ) { $ keys = array_keys ( $ this -> tags ) ; return $ this -> tags [ $ keys [ $ this -> position ] ] ; }
Iterator current item
53,690
public function valid ( ) { $ keys = array_keys ( $ this -> tags ) ; return isset ( $ keys [ $ this -> position ] ) && isset ( $ this -> tags [ $ keys [ $ this -> position ] ] ) ; }
Iterator item exists
53,691
public function slice ( $ offset , $ length = null ) { $ this -> tags = array_slice ( $ this -> tags , $ offset , $ length , true ) ; return $ this ; }
Slice the tag cloud
53,692
public static function getByClass ( $ class ) { $ results = [ ] ; foreach ( static :: $ globals as $ k => $ v ) if ( $ v instanceof $ class ) $ results [ $ k ] = $ v ; return $ results ; }
Gets globals by their final class
53,693
public function start ( $ name , $ preset = null , $ isGlobalStart = false ) { if ( ! $ this -> isEnabled ( ) ) return ; $ t = $ this -> getTime ( ) ; $ this -> timers [ $ name ] = array ( 'name' => $ name , 'time' => $ preset == null ? $ t : $ preset , 'aggregate' => null , ) ; if ( ! $ this -> globalMode && $ isGloba...
Starts a timer with the given name
53,694
public function end ( $ name ) { if ( ! $ this -> isEnabled ( ) ) return ; $ aggregate = 0 ; $ oldTime = $ this -> firstTime ; if ( array_key_exists ( $ name , $ this -> timers ) ) $ oldTime = $ this -> timers [ $ name ] [ 'time' ] ; $ n = $ this -> getTime ( ) ; $ time = ( $ n - $ oldTime ) * 1000 ; if ( $ this -> glo...
Ends and stores the elapsed time for the timer with the given name
53,695
public function fromArray ( array $ opts ) { $ this -> _opts = \ Coast \ array_merge_smart ( $ this -> _opts , $ opts ) ; return $ this ; }
Import from an array .
53,696
protected static function errorToException ( $ level , $ message , $ file , $ line ) { try { throw new \ ErrorException ( $ message , 0 , $ level , $ file , $ line ) ; } catch ( \ ErrorException $ e ) { return $ e ; } }
Throws catches and returns an \ ErrorException created from error args
53,697
public function add ( $ type , $ message , $ data = FALSE , $ title = FALSE ) { $ messages = $ this -> _session_get ( ) ; if ( ! is_array ( $ messages ) ) { $ messages = array ( ) ; } if ( is_a ( $ message , 'Exception' ) ) { $ title = 'Exception Thrown!' ; $ message = $ message -> getMessage ( ) ; $ type = 'error' ; }...
Adds a message to the a list .
53,698
public function clear ( $ type = FALSE ) { if ( $ type === FALSE ) { $ this -> _session_unset ( ) ; } else { $ messages = $ this -> _session_get ( ) ; if ( is_array ( $ messages ) ) { foreach ( $ messages as $ i => $ message ) { if ( $ message -> type == $ type ) { unset ( $ messages [ $ i ] ) ; } } if ( ! $ this -> co...
Removes messages from the list .
53,699
public function peek ( $ type = FALSE ) { $ messages = $ this -> _session_get ( ) ; if ( ! is_array ( $ messages ) ) { return array ( ) ; } if ( $ type === FALSE ) { return $ messages ; } else { $ tmessages = array ( ) ; foreach ( $ messages as $ message ) { if ( $ message -> type == $ type ) { $ tmessages [ ] = $ mess...
Returns an array of messages to be displayed without removing them from the session