idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
54,600
protected function NextArea ( ) { $ area = $ this -> area ; $ this -> area = $ this -> listProvider -> NextOf ( $ this -> area ) ; return $ area ; }
Gets the next area
54,601
protected function CanEdit ( Area $ area ) { return self :: Guard ( ) -> Allow ( BackendAction :: Edit ( ) , $ area ) && self :: Guard ( ) -> Allow ( BackendAction :: UseIt ( ) , new AreaForm ( ) ) ; }
True if area can be edited
54,602
public function addBlogContent ( \ Haven \ CmsBundle \ Entity \ PageContent $ pageContents ) { $ this -> addPageContent ( $ pageContents ) ; return $ this ; }
Add page_contents for blogcontent type
54,603
public function addBusCardContent ( \ Haven \ CmsBundle \ Entity \ PageContent $ pageContents ) { $ this -> addPageContent ( $ pageContents ) ; return $ this ; }
Add page_contents for buscardcontent type
54,604
public function addEnterpriseContent ( \ Haven \ CmsBundle \ Entity \ PageContent $ pageContents ) { $ this -> addPageContent ( $ pageContents ) ; return $ this ; }
Add page_contents for enterprisecontent type
54,605
public function setSchema ( Schema $ schema ) { $ this -> schema = $ schema ; if ( ! $ this -> getSchema ( ) -> hasTable ( $ this -> getName ( ) ) ) { $ this -> getSchema ( ) -> addTable ( $ this ) ; } }
Sets the table schema .
54,606
public function createColumn ( $ name , $ type , array $ properties = array ( ) ) { if ( is_string ( $ type ) ) { $ type = Type :: getType ( $ type ) ; } $ column = new Column ( $ name , $ type , $ properties ) ; $ this -> addColumn ( $ column ) ; return $ column ; }
Creates and adds a new column .
54,607
public function getColumn ( $ name ) { if ( ! $ this -> hasColumn ( $ name ) ) { throw SchemaException :: tableColumnDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> columns [ $ name ] ; }
Gets a table column .
54,608
public function dropColumn ( $ name ) { if ( ! $ this -> hasColumn ( $ name ) ) { throw SchemaException :: tableColumnDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> columns [ $ name ] ) ; }
Drops a column .
54,609
public function createPrimaryKey ( array $ columnNames , $ name = null ) { if ( $ this -> hasPrimaryKey ( ) ) { throw SchemaException :: tablePrimaryKeyAlreadyExists ( $ this -> getName ( ) ) ; } $ primaryKey = new PrimaryKey ( $ name , $ columnNames ) ; $ this -> setPrimaryKey ( $ primaryKey ) ; $ this -> createIndex ...
Creates and adds a new primary key .
54,610
public function setPrimaryKey ( PrimaryKey $ primaryKey ) { foreach ( $ primaryKey -> getColumnNames ( ) as $ columnName ) { $ this -> getColumn ( $ columnName ) -> setNotNull ( true ) ; } $ this -> primaryKey = $ primaryKey ; }
Sets the table primery key .
54,611
public function dropPrimaryKey ( ) { if ( ! $ this -> hasPrimaryKey ( ) ) { throw SchemaException :: tablePrimaryKeyDoesNotExist ( $ this -> getName ( ) ) ; } foreach ( $ this -> getIndexes ( ) as $ index ) { if ( $ index -> hasSameColumnNames ( $ this -> getPrimaryKey ( ) -> getColumnNames ( ) ) ) { $ this -> dropInde...
Drops the table primary key .
54,612
public function createForeignKey ( array $ localColumnNames , $ foreignTable , array $ foreignColumnNames , $ onDelete = ForeignKey :: RESTRICT , $ onUpdate = ForeignKey :: RESTRICT , $ name = null ) { if ( $ foreignTable instanceof Table ) { $ foreignTable = $ foreignTable -> getName ( ) ; } $ foreignKey = new Foreign...
Creates and adds a new foreign key .
54,613
public function setForeignKeys ( array $ foreignKeys ) { $ this -> foreignKeys = array ( ) ; foreach ( $ foreignKeys as $ foreignKey ) { $ this -> addForeignKey ( $ foreignKey ) ; } }
Sets the table foreign keys .
54,614
public function getForeignKey ( $ name ) { if ( ! $ this -> hasForeignKey ( $ name ) ) { throw SchemaException :: tableForeignKeyDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> foreignKeys [ $ name ] ; }
Gets a foreign key
54,615
public function addForeignKey ( ForeignKey $ foreignKey ) { if ( $ this -> hasForeignKey ( $ foreignKey -> getName ( ) ) ) { throw SchemaException :: tableForeignKeyAlreadyExists ( $ this -> getName ( ) , $ foreignKey -> getName ( ) ) ; } foreach ( $ foreignKey -> getLocalColumnNames ( ) as $ columnName ) { if ( ! $ th...
Adds a foreign key to the table .
54,616
public function renameForeignKey ( $ oldName , $ newName ) { if ( ! $ this -> hasForeignKey ( $ oldName ) ) { throw SchemaException :: tableForeignKeyDoesNotExist ( $ this -> getName ( ) , $ oldName ) ; } if ( $ this -> hasForeignKey ( $ newName ) ) { throw SchemaException :: tableForeignKeyAlreadyExists ( $ this -> ge...
Renames a foreign key .
54,617
public function dropForeignKey ( $ name ) { if ( ! $ this -> hasForeignKey ( $ name ) ) { throw SchemaException :: tableForeignKeyDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> foreignKeys [ $ name ] ) ; }
Drops a foreign key .
54,618
public function createIndex ( array $ columnNames , $ unique = false , $ name = null ) { $ index = new Index ( $ name , $ columnNames , $ unique ) ; $ this -> addIndex ( $ index ) ; return $ index ; }
Creates and adds a new index .
54,619
public function setIndexes ( array $ indexes ) { $ this -> indexes = array ( ) ; foreach ( $ indexes as $ index ) { $ this -> addIndex ( $ index ) ; } }
Sets the table indexes .
54,620
public function getIndex ( $ name ) { if ( ! $ this -> hasIndex ( $ name ) ) { throw SchemaException :: tableIndexDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> indexes [ $ name ] ; }
Gets a table index .
54,621
public function dropIndex ( $ name ) { if ( ! $ this -> hasIndex ( $ name ) ) { throw SchemaException :: tableIndexDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> indexes [ $ name ] ) ; }
Drops an index .
54,622
public function createCheck ( $ constraint , $ name = null ) { $ check = new Check ( $ name , $ constraint ) ; $ this -> addCheck ( $ check ) ; return $ check ; }
Creates and adds a new check .
54,623
public function setChecks ( array $ checks ) { $ this -> checks = array ( ) ; foreach ( $ checks as $ check ) { $ this -> addCheck ( $ check ) ; } }
Sets the table chekcs .
54,624
public function getCheck ( $ name ) { if ( ! $ this -> hasCheck ( $ name ) ) { throw SchemaException :: tableCheckDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> checks [ $ name ] ; }
Gets a table check .
54,625
public function addCheck ( Check $ check ) { if ( $ this -> hasCheck ( $ check -> getName ( ) ) ) { throw SchemaException :: tableCheckAlreadyExists ( $ this -> getName ( ) , $ check -> getName ( ) ) ; } $ this -> checks [ $ check -> getName ( ) ] = $ check ; }
Adds a check to the table .
54,626
public function renameCheck ( $ oldName , $ newName ) { if ( ! $ this -> hasCheck ( $ oldName ) ) { throw SchemaException :: tableCheckDoesNotExist ( $ this -> getName ( ) , $ oldName ) ; } if ( $ this -> hasCheck ( $ newName ) ) { throw SchemaException :: tableCheckAlreadyExists ( $ this -> getName ( ) , $ newName ) ;...
Renames a check .
54,627
public function dropCheck ( $ name ) { if ( ! $ this -> hasCheck ( $ name ) ) { throw SchemaException :: tableCheckDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> checks [ $ name ] ) ; }
Drops a check .
54,628
public function getHeaders ( ) { $ digest = Klarna :: digest ( Klarna :: colon ( $ this -> config [ 'eid' ] , $ this -> params [ 'currency' ] , $ this -> config [ 'secret' ] ) ) ; return array ( "Accept: {$this->accept}" , "Authorization: xmlrpc-4.2 {$digest}" ) ; }
Get the headers associated to this request
54,629
private function toArray ( ) { $ data = [ ] ; $ reflection = new ReflectionClass ( $ this ) ; foreach ( $ reflection -> getProperties ( ) as $ property ) { $ property -> setAccessible ( true ) ; $ data [ $ property -> getName ( ) ] = $ property -> getValue ( $ this ) ; } return $ data ; }
Convert the ViewModel object to an array
54,630
protected function makeModel ( TreeScope $ scope ) { $ model = clone $ this -> treeModelPrototype ; $ model -> setRootId ( $ scope -> getModelRootId ( ) ) ; $ model -> setPathPrefix ( $ scope -> getPathPrefix ( ) ) ; return $ model ; }
Make a sitetree model
54,631
public function dump ( $ file , $ content ) { $ fileWrited = file_put_contents ( $ file , '<?php return ' . var_export ( $ content , true ) . ';' ) ; if ( $ fileWrited === false ) { throw new \ Exception ( 'Unable to dump data into php file !' ) ; } }
Dump data into php file .
54,632
public function toArray ( $ deep = true ) { $ array = array ( ) ; foreach ( $ this -> __getSerialisablePropertyMap ( ) as $ key => $ value ) { if ( $ value instanceof AssociativeArray ) { $ array [ $ key ] = $ deep ? $ value -> toArray ( ) : $ value ; } else { $ array [ $ key ] = $ value ; } } return $ array ; }
Convert this into a regular php array .
54,633
public static function toAssociative ( $ array , $ recursive = false ) { $ associative = new AssociativeArray ( ) ; foreach ( $ array as $ key => $ value ) { if ( $ recursive && is_array ( $ value ) ) { $ associative [ $ key ] = self :: toAssociative ( $ value , true ) ; } else { $ associative [ $ key ] = $ value ; } }...
Convert a regular array to an associative array . optionally recursive is required .
54,634
protected function writeFile ( $ payload ) { $ file = $ this -> config [ 'file' ] [ 'path' ] . $ this -> config [ 'file' ] [ 'cookie_name' ] . '_' . $ this -> sessionId ; if ( ! $ handle = fopen ( $ file , 'c' ) ) { throw new \ Exception ( 'Could not open the session file in "' . $ this -> config [ 'file' ] [ 'path' ] ...
Writes the session file
54,635
protected function readFile ( ) { $ file = $ this -> config [ 'file' ] [ 'path' ] . $ this -> config [ 'file' ] [ 'cookie_name' ] . '_' . $ this -> sessionId ; if ( is_file ( $ file ) and $ handle = fopen ( $ file , 'r' ) ) { while ( ! flock ( $ handle , LOCK_SH ) ) ; if ( $ size = filesize ( $ file ) ) { $ payload = f...
Reads the session file
54,636
public function attribute ( $ name ) { $ v = $ this -> attributes ( ) -> $ name ; if ( ! empty ( $ v ) ) return ( string ) $ v ; }
Retrieves and attribute by name
54,637
public function xpathNSOne ( $ path , $ namespaces ) { $ result = $ this -> xpathNS ( $ path , $ namespaces ) ; if ( is_array ( $ result ) ) return current ( $ result ) ; return $ result ; }
Queries for a single result of an xpath query respecting the namespaces given
54,638
public function xpathOne ( $ path ) { $ result = $ this -> xpath ( $ path ) ; if ( is_array ( $ result ) ) return current ( $ result ) ; return $ result ; }
Query an xpath and return the first result
54,639
public function addChild ( $ name , $ value = null , $ namespace = null ) { $ esc_val = utf8_encode ( htmlentities ( $ value , ENT_QUOTES , 'UTF-8' , false ) ) ; if ( $ value == $ esc_val ) return parent :: addChild ( $ name , $ esc_val , $ namespace ) ; else { $ xml_field = parent :: addChild ( $ name , '' , $ namespa...
Adds a child to the current element but with automatic CDATA support .
54,640
public function replace ( SimpleXMLExtended $ child ) { $ node1 = dom_import_simplexml ( $ this ) ; $ dom_sxe = dom_import_simplexml ( $ child ) ; $ node2 = $ node1 -> ownerDocument -> importNode ( $ dom_sxe , true ) ; $ node1 -> parentNode -> replaceChild ( $ node2 , $ node1 ) ; return $ this ; }
Replaces the current element with the element specified
54,641
public function asPrettyXML ( $ level = 4 ) { $ xml = preg_replace ( '/\<\?xml([^\>\/]*)\>/' , '' , $ this -> asXML ( ) ) ; $ dom = new DOMDocument ( ) ; $ dom -> preserveWhiteSpace = false ; $ dom -> formatOutput = true ; $ dom -> loadXML ( $ xml ) ; $ formatted = $ dom -> saveXml ( ) ; return $ formatted ; }
Returns a properly indented form of the current XML tree
54,642
public static function valueOf ( $ str ) { $ key = get_called_class ( ) ; if ( ! array_key_exists ( $ key , self :: $ types ) ) return null ; $ str = str_replace ( array ( ' ' , '-' ) , '_' , trim ( $ str ) ) ; if ( array_key_exists ( $ str , self :: $ types [ $ key ] ) ) return self :: $ types [ $ key ] [ $ str ] ; re...
Attempts to match a string name to an enum element .
54,643
public function getParameter ( $ key ) { if ( $ this -> hasParameter ( $ key ) ) { return $ this -> parameters [ $ key ] ; } throw new \ InvalidArgumentException ( sprintf ( 'Wrong parameter key "%s" , invalid returned the key' , $ key ) ) ; }
Get the parameter of object event
54,644
public function read ( ) { $ this -> position ++ ; if ( $ this -> position >= count ( $ this -> buffer ) ) return false ; return $ this -> buffer [ $ this -> position ] ; }
Read the buffer and the current position
54,645
public function peek ( ) { $ peekPosition = $ this -> position + 1 ; if ( $ peekPosition >= count ( $ this -> buffer ) ) return - 1 ; return $ this -> buffer [ $ peekPosition ] ; }
Look one char ahead in the buffer
54,646
public function mergeAnd ( self $ filter ) { $ clause = "({$this->clause}) AND ({$filter->clause})" ; $ parameters = array_merge ( $ this -> parameters , $ filter -> parameters ) ; return new self ( $ clause , $ parameters ) ; }
Combines two filters together with a AND operator . Current and provided instances will not be altered ; the returned new instance will hold the result of the computation .
54,647
public function mergeOr ( self $ filter ) { $ clause = "({$this->clause}) OR ({$filter->clause})" ; $ parameters = array_merge ( $ this -> parameters , $ filter -> parameters ) ; return new self ( $ clause , $ parameters ) ; }
Combines two filters together with a OR operator . Current and provided instances will not be altered ; the returned new instance will hold the result of the computation .
54,648
private function resolve ( Definition $ definition ) { if ( ! $ this -> container -> isFrozen ( ) ) { throw new \ LogicException ( "cannot use create method on factory without freezing/compiling container" ) ; } $ subContainer = new ContainerBuilder ( ) ; $ subContainer -> merge ( $ this -> container ) ; $ subContainer...
todo heavy optimization likely to be needed for this method
54,649
public static function normalize ( string $ path ) : string { if ( strpos ( $ path , 'data://' ) === 0 ) { return $ path ; } $ path = self :: stringReplaceIgnoringStreamWrapper ( [ '\\' , '/' ] , DIRECTORY_SEPARATOR , $ path ) ; $ startOfPath = strpos ( $ path , '://' ) === false ? 0 : strpos ( $ path , '://' ) + strle...
Normalizes the supplied path
54,650
public static function combine ( string ... $ paths ) : string { $ paths = array_map ( [ __CLASS__ , 'normalize' ] , $ paths ) ; $ paths = array_filter ( $ paths , function ( $ path ) { return trim ( $ path , DIRECTORY_SEPARATOR ) !== '.' ; } ) ; $ combinedPath = implode ( DIRECTORY_SEPARATOR , $ paths ) ; return self ...
Combines the supplied paths
54,651
public static function routes ( ) { Route :: group ( [ 'namespace' => 'Auth' ] , function ( ) { Route :: group ( [ 'middleware' => [ 'guest' ] ] , function ( ) { Route :: get ( 'login' , 'LoginController@showLoginPage' ) -> name ( 'showLogin' ) ; Route :: post ( 'login' , 'LoginController@login' ) -> name ( 'login' ) ;...
Register auth routes
54,652
public function fillFromSearchResult ( ItemSearch $ item ) { $ query = parse_url ( $ item -> getLink ( ) , PHP_URL_QUERY ) ; parse_str ( $ query , $ query ) ; if ( empty ( $ query [ $ this -> getForm ( ) -> getName ( ) ] ) ) { return ; } return $ this -> fill ( $ query [ $ this -> getForm ( ) -> getName ( ) ] ) ; }
Fill from search result .
54,653
public function asString ( ) : string { return ( string ) $ this -> year . '-' . ( ( 10 > $ this -> month && strlen ( ( string ) $ this -> month ) === 1 ) ? ( '0' . $ this -> month ) : ( $ this -> month ) ) ; }
returns a string representation of the date object
54,654
protected function setViewData ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ name => $ data ) { view ( ) -> share ( $ name , $ data ) ; } } else { view ( ) -> share ( $ key , $ value ) ; } }
Pass data to the view .
54,655
function addPropertiesAndConstantsFromReflection ( ClassReflection $ classReflection ) { $ constants = $ classReflection -> getConstants ( ) ; foreach ( $ constants as $ name => $ value ) { $ this -> generator -> addProperty ( $ name , $ value , PropertyGenerator :: FLAG_CONSTANT ) ; } $ properties = $ classReflection ...
addPropertiesAndConstantsFromReflection - does what it s name says .
54,656
public function matchSchema ( $ json , $ schema ) { $ validator = new Validator ( ) ; if ( is_string ( $ json ) ) { $ json = $ this -> decode ( $ json , TRUE ) ; } elseif ( is_array ( $ json ) ) { $ json = ( object ) $ json ; } if ( is_string ( $ schema ) ) { $ schema = $ this -> decode ( $ schema , TRUE ) ; } elseif (...
Matches a JSON string or structure to a schema .
54,657
public function getSchemaErrorMessage ( ) { $ message = NULL ; foreach ( $ this -> lastSchemaErrors as $ error ) { $ message .= sprintf ( "[%s] %s\n" , $ error [ 'property' ] , $ error [ 'message' ] ) ; } if ( ! empty ( $ message ) ) { $ message = self :: FAIL_JSON_SCHEMA_MESSAGE . $ message ; } return $ message ; }
Returns the latest schema matching errors as a text message .
54,658
public static function fromNative ( ) { $ array = \ func_get_arg ( 0 ) ; $ keyValuePairs = array ( ) ; foreach ( $ array as $ arrayKey => $ arrayValue ) { $ key = new StringLiteral ( \ strval ( $ arrayKey ) ) ; if ( $ arrayValue instanceof \ Traversable || \ is_array ( $ arrayValue ) ) { $ value = Collection :: fromNat...
Returns a new Dictionary object
54,659
public function keys ( ) { $ count = $ this -> count ( ) -> toNative ( ) ; $ keysArray = new \ SplFixedArray ( $ count ) ; foreach ( $ this -> items as $ key => $ item ) { $ keysArray -> offsetSet ( $ key , $ item -> getKey ( ) ) ; } return new Collection ( $ keysArray ) ; }
Returns a Collection of the keys
54,660
public function values ( ) { $ count = $ this -> count ( ) -> toNative ( ) ; $ valuesArray = new \ SplFixedArray ( $ count ) ; foreach ( $ this -> items as $ key => $ item ) { $ valuesArray -> offsetSet ( $ key , $ item -> getValue ( ) ) ; } return new Collection ( $ valuesArray ) ; }
Returns a Collection of the values
54,661
public static function prepare ( string $ string , $ quotes = '/' ) : string { $ string = $ quotes ? preg_quote ( $ string , $ quotes ) : $ string ; return str_replace ( array_keys ( self :: REGEX_CHARS_REPLACEMENT ) , array_values ( self :: REGEX_CHARS_REPLACEMENT ) , $ string ) ; }
Prepare string to be safety used in regex
54,662
public function renderRequireJs ( $ compressed = true ) { if ( $ compressed && ! $ this -> buildFileExists ( ) ) { $ compressed = false ; } return $ this -> template -> render ( [ 'compressed' => $ compressed , 'build_path' => $ this -> config [ 'build_path' ] , 'config' => $ this -> provider -> getMainConfig ( ) , ] )...
Renders the RequireJs initialisation script .
54,663
protected function setDeviation ( $ mergedArray ) { if ( is_array ( $ this -> getDeviationArray1 ( ) ) && count ( $ this -> getDeviationArray1 ( ) ) > 0 ) { $ this -> setDeviationArray2 ( $ this -> deviationArray ( $ this -> getDeviationArray1 ( ) , $ mergedArray ) ) ; } else { $ this -> setDeviationArray1 ( $ this -> ...
set deviation arrays
54,664
public function getDB ( $ db = null ) { if ( null !== $ db && ! ( $ db instanceof DB ) ) throw new InvalidTypeException ( "Invalid database" ) ; return $ db ? : $ this -> _source_db ? : DI :: getInjector ( ) -> getInstance ( DB :: class ) ; }
Get a suitable database . Either the provided database argument or when null the source database . If source database is also null the default database is returned .
54,665
public function insert ( $ db = null ) { $ this -> getDAO ( $ this -> getDB ( $ db ) ) -> save ( $ this ) ; return $ this ; }
Insert the record to the database
54,666
public function delete ( $ db = null ) { $ this -> getDAO ( $ this -> getDB ( $ db ) ) -> delete ( $ this ) ; return $ this ; }
Remove the current record from the database it was retrieved from .
54,667
public function setSourceDB ( DB $ db ) { if ( $ db === null ) throw new \ InvalidArgumentException ( "Source database must not be null" ) ; $ this -> _source_db = $ db ; return $ this ; }
Set the database this object came from
54,668
public function assignRecord ( array $ record , DB $ database ) { $ dao = $ this -> getDAO ( ) ; $ table = $ dao -> getTable ( $ database ) ; $ pkey = $ table -> getPrimaryColumns ( ) ; if ( $ pkey !== null ) { $ this -> _id = array ( ) ; foreach ( $ pkey as $ col ) $ this -> _id [ $ col -> getName ( ) ] = $ record [ $...
Assign the provided record to this object .
54,669
public function setID ( $ id ) { $ dao = $ this -> getDAO ( ) ; $ pkey = $ dao -> getPrimaryKey ( ) ; if ( count ( $ pkey ) === 1 && is_scalar ( $ id ) ) { $ pcol = reset ( $ pkey ) ; $ this -> setField ( $ pcol -> getName ( ) , $ id ) ; } elseif ( is_array ( $ id ) && array_keys ( $ id ) === array_keys ( $ pkey ) ) { ...
Set the primary key of the model instance
54,670
public function destruct ( ) { $ this -> _id = [ ] ; $ this -> _source_db = null ; $ this -> _record = [ ] ; $ this -> _changed = [ ] ; return $ this ; }
Remove the data from this object after removal
54,671
public function getField ( string $ field ) { if ( isset ( $ this -> _record [ $ field ] ) ) return $ this -> _record [ $ field ] ; return null ; }
Get the value for a field of this record .
54,672
public function setField ( string $ field , $ value ) { if ( isset ( $ this -> _record [ $ field ] ) && $ this -> _record [ $ field ] === $ value ) return ; $ db = $ this -> getDB ( ) ; $ dao = $ db -> getDAO ( static :: class ) ; $ columns = $ dao -> getColumns ( ) ; if ( ! isset ( $ columns [ $ field ] ) ) throw new ...
Set a field to a new value . The value will be validated first by calling validate .
54,673
public static function validate ( Column $ coldef , $ value ) { $ field = $ coldef -> getName ( ) ; try { $ valid = $ coldef -> validate ( $ value ) ; } catch ( InvalidValueException $ e ) { $ rep = WF :: str ( $ value ) ; throw new InvalidValueException ( "Field $field cannot be set to $rep: {$e->getMessage()}" ) ; } ...
Validate a value for the field before setting it . This method is called from the setField method before updating the value . You can override this to add validators . Be sure to call the super validator to validate the base field to match the column definition .
54,674
protected function storageFormat ( $ key , $ data , $ ttl ) { $ start = time ( ) ; $ expire = $ start + $ ttl ; return array ( 'key' => $ key , 'value' => $ data , 'duration' => $ ttl , 'created' => $ start , 'expires' => $ expire ) ; }
Defines the array that will be used to store data . Changing this will require updating all functions that also fetch data .
54,675
public function detailsAction ( Request $ request , $ module , $ template , $ skins ) { $ fullModule = null ; try { $ moduleManager = $ this -> get ( 'terrific.composer.module.manager' ) ; $ fullModule = $ moduleManager -> getModuleByName ( $ module ) ; $ template = $ fullModule -> getTemplateByName ( $ template ) -> g...
Display the details of a terrific module .
54,676
public function createAction ( Request $ request ) { if ( $ this -> get ( 'session' ) -> has ( 'module' ) ) { $ tmpModule = $ this -> get ( 'session' ) -> get ( 'module' ) ; $ module = new Module ( ) ; $ module -> setStyle ( $ tmpModule -> getStyle ( ) ) ; } else { $ module = new Module ( ) ; $ module -> setStyle ( 'le...
Creates a terrific module .
54,677
public function addskinAction ( Request $ request ) { $ skin = new Skin ( ) ; $ module = new Module ( ) ; if ( $ this -> get ( 'session' ) -> has ( 'module' ) ) { $ tmpModule = $ this -> get ( 'session' ) -> get ( 'module' ) ; $ skin -> setModule ( $ tmpModule -> getName ( ) ) ; $ skin -> setStyle ( $ tmpModule -> getS...
Adds a skin to the module .
54,678
private function runRouteBinding ( ) : void { $ pathway = $ this -> getPathInfo ( ) ; $ routing = App :: $ Properties -> getAll ( 'Routing' ) ; if ( Any :: isArray ( $ routing ) && isset ( $ routing [ 'Alias' ] , $ routing [ 'Alias' ] [ env_name ] ) ) { $ pathway = $ this -> findStaticAliases ( $ routing [ 'Alias' ] [ ...
Build static and dynamic path aliases for working set
54,679
private function findStaticAliases ( ? array $ map = null , ? string $ pathway = null ) : ? string { if ( ! $ map ) { return $ pathway ; } if ( Arr :: in ( $ pathway , $ map ) ) { $ binding = array_search ( $ pathway , $ map , true ) ; $ url = $ this -> getSchemeAndHttpHost ( ) . $ this -> getBasePath ( ) . '/' ; if ( ...
Prepare static pathway aliasing for routing
54,680
private function findDynamicCallbacks ( array $ map = null , ? string $ controller = null ) : void { if ( ! $ map ) { return ; } if ( array_key_exists ( $ controller , $ map ) ) { $ class = ( string ) $ map [ $ controller ] ; if ( ! Str :: likeEmpty ( $ class ) ) { $ this -> callbackClass = $ class ; } } }
Prepare dynamic callback data for routing
54,681
public function serialize ( SearchCondition $ searchCondition ) : array { $ setName = $ searchCondition -> getFieldSet ( ) -> getSetName ( ) ; return [ $ setName , serialize ( $ searchCondition -> getValuesGroup ( ) ) ] ; }
Serialize a SearchCondition .
54,682
public function unserialize ( array $ searchCondition ) : SearchCondition { if ( 2 !== \ count ( $ searchCondition ) || ! isset ( $ searchCondition [ 0 ] , $ searchCondition [ 1 ] ) ) { throw new InvalidArgumentException ( 'Serialized search condition must be exactly two values [FieldSet-name, serialized ValuesGroup].'...
Unserialize a serialized SearchCondition .
54,683
public static function getCurrentFullHostString ( ) { $ hostString = $ _SERVER [ "HTTPS" ] ? "https" : "http" ; $ hostString .= "://" ; $ hostString .= $ _SERVER [ "HTTP_HOST" ] ; $ hostString .= $ _SERVER [ "SERVER_PORT" ] != 80 ? ":" . $ _SERVER [ "SERVER_PORT" ] : "" ; return $ hostString ; }
Return the current full host string for the current request including protocol and ports etc .
54,684
public function getPartialURLFromSegment ( $ segmentIdx ) { $ partialURL = "" ; for ( $ i = $ segmentIdx ; $ i < sizeof ( $ this -> segments ) ; $ i ++ ) { $ partialURL .= ( ( $ i > $ segmentIdx ) ? "/" : "" ) . $ this -> segments [ $ i ] ; } return $ partialURL ; }
Get a partial string version of this url object starting from a particular segment
54,685
public function getQueryParametersArray ( ) { $ queryString = $ this -> getQueryString ( ) ; if ( strlen ( $ queryString ) == 0 ) return array ( ) ; $ splitQuery = explode ( "&" , substr ( $ queryString , 1 ) ) ; $ returnedParams = array ( ) ; foreach ( $ splitQuery as $ param ) { $ splitParam = explode ( "=" , $ param...
Get all query parameters contained within this URL as an associative array .
54,686
private function processURL ( $ url ) { $ url = str_replace ( "%20" , " " , $ url ) ; $ this -> url = URLHelper :: $ testURL == null ? $ url : URLHelper :: $ testURL ; if ( substr ( $ url , 0 , 4 ) == "http" ) { $ splitProtocol = explode ( "://" , $ url ) ; $ requestSection = sizeof ( $ splitProtocol ) > 1 ? $ splitPro...
off query parameters too .
54,687
private function addInheritedAttributes ( ClassMetadata $ subClass , ClassMetadata $ parentClass ) { $ propertyFactory = new PropertyMetadataFactory ( $ subClass ) ; foreach ( $ parentClass -> propertyMetadata as $ attributeName => $ parentMapping ) { if ( $ subClass -> isEmbeddedDocument && $ parentMapping -> strategy...
Adds inherited attributes to the subclass mapping .
54,688
public function renderAncestorsAndSelf ( $ items , $ glue = '/' , $ keys = [ 'name' ] ) { $ items = $ items -> map ( function ( $ item , $ key ) use ( $ keys , $ glue ) { $ ancSelf = $ item -> ancestorsAndSelf ( ) -> get ( ) ; $ result = [ 'id' => $ item -> id ] ; foreach ( $ keys as $ k ) { $ plucks = $ ancSelf -> plu...
ancestors and self render and get
54,689
public function setConfigs ( array $ args ) { if ( ! is_array ( current ( $ args ) ) ) { $ args = [ $ this -> currentName => $ args ] ; } foreach ( $ args as $ key => $ item ) { if ( array_key_exists ( $ key , $ this -> configs ) ) { $ this -> configs [ $ key ] = array_merge ( $ this -> configs [ $ key ] , $ item ) ; }...
ADD 2D ARRAY
54,690
public function getEngine ( $ name = null ) { if ( is_null ( $ name ) ) { $ name = $ this -> getCurrentName ( ) ; } if ( array_key_exists ( $ name , $ this -> engines ) ) { return $ this -> engines [ $ name ] ; } if ( ! $ this -> hasConfig ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( __ ( '%s DOES NO...
GET DATABASE ENGINE
54,691
public function make ( $ abstract ) { $ service = isset ( $ this -> services [ $ abstract ] ) ? $ this -> services [ $ abstract ] : $ this -> addNamespace ( $ abstract ) ; if ( is_callable ( $ service ) ) { return call_user_func_array ( $ service , [ $ this ] ) ; } if ( is_object ( $ service ) ) { return $ service ; } ...
Resolve the given type from the container . Allow unbound aliases that omit the root namespace i . e . Controller translates to GeminiLabs \ Castor \ Controller
54,692
protected function additionalSavingTasks ( Pg $ pg , $ simulate = false , array & $ ignoreList = array ( ) , $ action = self :: ACTION_OBJECT ) { $ repository = $ this -> recordManager -> entityManager -> getRepository ( $ this -> object -> class ) ; $ normality = $ repository -> normality ; if ( isset ( $ normality [ ...
Execute additional saving tasks .
54,693
static function camelize ( $ str ) { $ str = str_replace ( '_' , ' ' , $ str ) ; $ str = ucwords ( $ str ) ; $ str = str_replace ( ' ' , '' , $ str ) ; return lcfirst ( $ str ) ; }
Changes word format to camelize
54,694
static function studly ( $ str ) { $ str = str_replace ( '_' , ' ' , $ str ) ; $ str = ucwords ( $ str ) ; $ str = str_replace ( ' ' , '' , $ str ) ; return $ str ; }
Changes word format to studly
54,695
private function get ( ) { if ( $ this -> inPos < $ this -> inLength ) { $ c = $ this -> in [ $ this -> inPos ] ; ++ $ this -> inPos ; } else { return self :: EOF ; } if ( $ c === "\n" || $ c === self :: EOF || ord ( $ c ) >= self :: ORD_space ) { return $ c ; } if ( $ c === "\r" ) { return "\n" ; } return ' ' ; }
Get the next character from the input stream .
54,696
private function peek ( ) { return ( $ this -> inPos < $ this -> inLength ) ? $ this -> in [ $ this -> inPos ] : self :: EOF ; }
Get the next character from the input stream without gettng it .
54,697
function next ( ) { $ c = $ this -> get ( ) ; if ( $ c == '/' ) { switch ( $ this -> peek ( ) ) { case '/' : $ this -> inPos = strpos ( $ this -> in , "\n" , $ this -> inPos ) ; return $ this -> in [ $ this -> inPos ] ; case '*' : $ this -> inPos = strpos ( $ this -> in , "*/" , $ this -> inPos ) ; if ( $ this -> inPos...
Get the next character from the input stream excluding comments .
54,698
function action ( $ action ) { switch ( $ action ) { case self :: JSMIN_ACT_FULL : $ this -> put ( $ this -> theA ) ; case self :: JSMIN_ACT_BUF : $ tmpA = $ this -> theA = $ this -> theB ; if ( $ tmpA == '\'' || $ tmpA == '"' ) { $ pos = $ this -> inPos ; while ( true ) { $ pos = $ this -> getCloser ( $ this -> in , a...
Do something !
54,699
public function getControllerInstance ( $ class , $ namespace = '' ) { if ( isset ( $ this -> complement [ 'namespaces' ] ) ) { if ( isset ( $ this -> complement [ 'namespaces' ] [ $ namespace ] ) ) { $ namespace = $ this -> complement [ 'namespaces' ] [ $ namespace ] ; $ _class = $ namespace . $ class ; if ( class_exi...
Get complement controller instance .