idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
18,100
public static function unregisterStreamWrapperClass ( ) { $ unregisterFunction = self :: getStreamWrapperUnregisterFunction ( ) ; if ( ! isset ( self :: $ protocolName ) ) { throw new \ RuntimeException ( sprintf ( 'Scheme name not found for %s' , __CLASS__ ) ) ; } @ $ unregisterFunction ( self :: $ protocolName ) ; }
Registers the stream wrapper to handle the specified protocolName
18,101
public function stream_flush ( ) { if ( ! $ this -> getResource ( ) ) { return false ; } $ buffer = $ this -> getDataBuffer ( ) ; $ bufferWritten = $ buffer ; $ retVal = true ; if ( ! empty ( $ buffer ) ) { $ object = $ this -> getResource ( ) -> getObject ( ) ; $ mimetype = $ this -> getService ( ) -> guessFileType ( ...
Flush the data buffer to the CDN .
18,102
public function reset ( ) { $ this -> setPosition ( 0 ) ; $ this -> setOnWriteDataMode ( false ) ; $ this -> setDataBuffer ( null ) ; $ this -> setResource ( null ) ; }
reset the variable
18,103
public function initFromPath ( $ path ) { $ this -> setPosition ( 0 ) ; $ this -> setDataBuffer ( null ) ; $ resource = $ this -> getService ( ) -> createResourceFromPath ( $ path ) ; if ( ! $ resource ) { return false ; } $ this -> setResource ( $ resource ) ; return $ this ; }
creates the resource the container and the object by the path given
18,104
public function appendDataBuffer ( $ data ) { if ( is_null ( $ this -> dataBuffer ) ) { $ this -> dataBuffer = $ data ; } else { $ this -> dataBuffer .= $ data ; } return $ this ; }
Append some data to the current property data
18,105
public function appendPosition ( $ length ) { $ this -> dataPosition = ( int ) $ this -> dataPosition ; $ this -> dataPosition += ( int ) $ length ; return $ this ; }
sum the int of the position to the var given
18,106
public function field_get ( $ type , $ com = '' ) { if ( empty ( $ com ) ) { $ fn = BLIBRARIESFRAMEWORKPATH . 'mvc' . DIRECTORY_SEPARATOR . 'field' . DIRECTORY_SEPARATOR . $ type . '.php' ; $ class = 'BControllerField_' . $ type ; } else { $ fn = BCOMPONENTSAPPLICATIONPATH . $ com . DIRECTORY_SEPARATOR . 'fields' . DIR...
Load fields objects by component & field type
18,107
public function softmodule_fields_list ( $ fview , $ fcontroller = NULL ) { $ mylist = $ this -> softmodules_list ( ) ; $ myitm = NULL ; foreach ( $ mylist as $ itm ) { if ( $ itm -> view == $ fview ) { $ myitm = $ itm ; } } if ( empty ( $ myitm ) ) { return false ; } $ params = array ( ) ; foreach ( $ myitm -> params ...
Load fields objects list ...
18,108
public function LoadModel ( $ mdlname = '' ) { if ( empty ( $ mdlname ) ) { bimport ( 'mvc.model' ) ; return new BModel ( ) ; } $ fn = BCOMPONENTSAPPLICATIONPATH . $ this -> componentname . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . $ mdlname . '.php' ; if ( ! file_exists ( $ fn ) ) { $ fn = BCOMPONENTSFRAM...
Load the model of current component by alias
18,109
public function LoadView ( $ viewname ) { $ fn = BCOMPONENTSAPPLICATIONPATH . $ this -> componentname . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $ viewname . '.php' ; if ( ! file_exists ( $ fn ) ) { $ fn = BCOMPONENTSFRAMEWORKPATH . $ this -> componentname . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARA...
Load the view of current component by alias
18,110
public function idIsDuplicate ( string $ id ) : bool { $ id = strtolower ( $ id ) ; return isset ( $ this -> byId [ $ id ] ) && count ( $ this -> byId [ $ id ] ) > 1 ; }
Tells whether there is more than one requirement identified by the id . If there are none this returns false .
18,111
public function setJSFromFile ( string $ filename , Scopable $ scope = null , bool $ relativeToRootPath = true ) : void { $ this -> jsElement = new HtmlFromFile ( $ filename , $ scope , $ relativeToRootPath ) ; }
Sets the script outputed in the JS section
18,112
public function setCSSFromFile ( string $ filename , Scopable $ scope = null , bool $ relativeToRootPath = true ) : void { $ this -> cssElement = new HtmlFromFile ( $ filename , $ scope , $ relativeToRootPath ) ; }
Sets the script outputed in the CSS section
18,113
public function setAdditionalElementFromFile ( string $ filename , Scopable $ scope = null , bool $ relativeToRootPath = true ) : void { $ this -> additionalElement = new HtmlFromFile ( $ filename , $ scope , $ relativeToRootPath ) ; }
Sets the additional items outputed below the JS and CSS sections
18,114
public function load ( FilesystemResource $ resource ) { if ( ! $ this -> validateExtension ( $ resource ) ) { return false ; } return $ this -> transform ( $ resource ) ; }
Load config as Array from resource
18,115
protected function setAssigns ( array & $ options ) { $ assigns = $ this -> controller -> assigns ( ) ; if ( isset ( $ options [ 'assigns' ] ) && is_array ( $ options [ 'assigns' ] ) ) { foreach ( $ options [ 'assigns' ] as $ name => $ value ) { $ assigns -> set ( $ name , $ value ) ; } } $ options [ 'assigns' ] = $ as...
Set assigns for template Checks if the assigns value was passed as option and sets all the assigns set there to the Assigns object . If the value for assigns isn t an array it is ignored . Then the assigns value is set to the Assigns object which will be used when rendering the template .
18,116
protected function generateRenderOptions ( array & $ options ) { $ i18n = $ this -> controller -> getService ( 'i18n' ) ; $ defaultLocales = $ i18n -> fallbacks ( ) ; array_unshift ( $ defaultLocales , $ i18n -> defaultLocale ( ) ) ; $ format = $ this -> controller -> request ( ) ? $ this -> controller -> request ( ) -...
Generate render options Sets the default details for template rendering .
18,117
public function leaveNode ( Node $ node ) { if ( $ this -> phpClass instanceof PhpClass ) { if ( $ node instanceof Class_ ) { if ( ! empty ( $ node -> extends ) && count ( $ node -> extends -> parts ) > 0 ) { $ this -> phpClass -> setExtends ( implode ( '\\' , $ node -> extends -> parts ) ) ; } if ( ! empty ( $ node ->...
This code can evaluate the data from the parser . It sorts out which object type we are dealing with and passes this to the PhpClass
18,118
public function GetValue ( $ key ) { $ resources = $ this -> GetList ( ) ; $ actionLower = strtolower ( $ this -> ActionValue ) ; $ keyLower = strtolower ( $ key ) ; $ actionExists = array_key_exists ( $ actionLower , $ resources ) ; $ keyExist = $ actionExists ? array_key_exists ( $ keyLower , $ resources [ $ actionLo...
Get the resource by module action and key .
18,119
public function GetComment ( $ key ) { $ resources = $ this -> GetList ( ) ; $ actionExists = array_key_exists ( $ this -> ActionValue , $ resources ) ; $ keyExist = $ actionExists ? array_key_exists ( $ key , $ resources [ $ this -> ActionValue ] ) : false ; if ( $ keyExist ) { return $ resources [ $ this -> ActionVal...
Get the resource comment by module action and key .
18,120
public function removeDir ( $ dir , ? callable $ onRemoveCallback = null ) : void { if ( is_dir ( $ dir ) ) { $ objects = scandir ( $ dir ) ; foreach ( $ objects as $ object ) { if ( '.' != $ object && '..' != $ object ) { if ( 'dir' == filetype ( $ dir . DIRECTORY_SEPARATOR . $ object ) ) { $ this -> removeDir ( $ dir...
Remove directory recursively .
18,121
public function generate ( ) { switch ( $ this -> properties [ 'node' ] ) { case 'post' : return new GeneratePost ( $ this -> prepareConfig ( $ this -> config ) , $ this -> properties ) ; break ; case 'page' : return new GeneratePage ( $ this -> prepareConfig ( $ this -> config ) , $ this -> properties ) ; break ; defa...
Create class instance of GenerateNode
18,122
public function get_cached_file ( $ label ) { $ filename = $ this -> cache_path . $ this -> safe_filename ( $ label ) . $ this -> cache_extension ; if ( file_exists ( $ filename ) ) return file_get_contents ( $ filename ) ; return false ; }
Non - existing method in SimpleCache Fetch the cache without regarding its expiry
18,123
public function details ( ) { return array_intersect_key ( count ( $ this -> _details ) ? $ this -> _details : array ( ) , array_flip ( $ this -> _public_details ) ) ; }
Return public user details
18,124
public static function base ( ) { $ base = $ _SERVER [ 'SERVER_NAME' ] ; $ url = Registry :: getUrl ( ) ; if ( ! empty ( $ url ) ) { $ base .= substr ( $ _SERVER [ 'REQUEST_URI' ] , 0 , strpos ( $ _SERVER [ 'REQUEST_URI' ] , Registry :: getUrl ( ) ) ) ; } else { $ base .= substr ( $ _SERVER [ 'REQUEST_URI' ] , 0 ) ; } ...
This method returns the base url
18,125
public static function assets ( $ assetName = null ) { $ base = $ _SERVER [ 'SERVER_NAME' ] ; $ url = Registry :: getUrl ( ) ; if ( ! empty ( $ url ) ) { $ base .= substr ( $ _SERVER [ 'REQUEST_URI' ] , 0 , strpos ( $ _SERVER [ 'REQUEST_URI' ] , Registry :: getUrl ( ) ) ) ; } else { $ base .= substr ( $ _SERVER [ 'REQU...
This method returns the assets url
18,126
public static function link ( $ linkParams = null ) { if ( $ linkParams === null ) { $ link_params = null ; } elseif ( is_array ( $ linkParams ) ) { $ link_params = join ( Registry :: getConfig ( ) [ 'url_component_separator' ] , $ linkParams ) ; } else { $ params = func_get_args ( ) ; $ link_params = join ( Registry :...
This method returns the url string .
18,127
public function addHandler ( $ name , $ handler , $ priority = self :: PRIORITY_DEFAULT ) { $ priority = ( int ) $ priority ; if ( $ priority >= self :: PRIORITY_MIN || $ priority < self :: PRIORITY_MAX ) { throw new InvalidArgumentException ( "Invalid event priority" ) ; } $ isObject = false ; if ( is_array ( $ handle...
Adds event handler .
18,128
public function dropHandlers ( $ name = '' , $ handler = null ) { if ( in_array ( $ name , self :: $ debugEvents ) ) { throw new InvalidArgumentException ( "Cannot drop debug event" ) ; } if ( $ this -> debug ) { $ debugArgs = new Args ( [ 'name' => $ name , 'handler' => $ handler , 'source' => 'core:event:debug' , 'le...
Drops event handlers .
18,129
public function disableHandler ( $ name ) { if ( in_array ( $ name , self :: $ debugEvents ) ) { throw new InvalidArgumentException ( "Cannot disable debug event" ) ; } if ( $ this -> debug ) { $ debugArgs = new Args ( [ 'name' => $ name , 'source' => 'core:event:debug' , 'level' => E_NOTICE , ] ) ; $ this -> fire ( ':...
Disables handler .
18,130
public function enableHandler ( $ name ) { if ( $ this -> debug ) { $ debugArgs = new Args ( [ 'name' => $ name , 'source' => 'core:event:debug' , 'level' => E_NOTICE , ] ) ; $ this -> fire ( ':onEnableHandler:' , $ debugArgs ) ; } unset ( $ this -> disabledEvents [ $ name ] ) ; }
Enables handler .
18,131
public function hasHandlers ( $ name , $ handler = null ) { $ args = new Args ; $ this -> runByHandler ( $ name , $ handler , [ $ this , 'hasHandler' ] , $ args ) ; $ result = $ args -> get ( 'hasHandler' ) ; return $ result ; }
Returns true if there are any handlers for specified event .
18,132
public function getHandlers ( $ name = null ) { $ result = is_null ( $ name ) ? $ this -> handlers : $ this -> handlers [ $ name ] ; return $ result ; }
Returns handlers for passed event or all .
18,133
protected function deleteHandler ( I_Registry $ args , $ name , $ index = null ) { $ cleanupAllHandlers = is_null ( $ index ) ; if ( ! $ cleanupAllHandlers ) { unset ( $ this -> handlers [ $ name ] [ $ index ] ) ; if ( sizeof ( $ this -> handlers [ $ name ] ) ) { ksort ( $ this -> handlers [ $ name ] ) ; unset ( $ this...
Deletes handler .
18,134
protected function hasHandler ( I_Registry $ args , $ name , $ index = null ) { $ result = is_null ( $ index ) ? ! empty ( $ this -> handlers [ $ name ] ) : true ; $ args -> set ( 'hasHandler' , $ result ) ; return $ result ; }
Sets up hasHandler flag .
18,135
protected function sortEvents ( $ name ) { $ priorities = [ ] ; foreach ( $ this -> orderedHandlers [ $ name ] as $ key => $ row ) { if ( is_array ( $ row ) ) { $ priorities [ $ key ] = $ row [ 0 ] ; } } Arrays :: adaptOrderCol ( $ priorities ) ; foreach ( $ priorities as $ key => $ priority ) { $ this -> orderedHandle...
Modifies priorities and sorts events .
18,136
public function show ( $ template = '.app/system/helper/pagination/default' ) { $ rand = rand ( 0 , 2 ) ; $ tpl = new Template ( $ template , 'pagination_' . $ rand , 0 ) ; $ tpl -> assign ( [ 'paginationFirst' => $ this -> _buttonFirst , 'paginationLast' => $ this -> _buttonLast , 'paginationBefore' => $ this -> _butt...
display the pagination
18,137
public function getData ( $ data = [ ] ) { for ( $ i = ( ( ( $ this -> _byPage * $ this -> _currentPage ) - $ this -> _byPage ) ) ; $ i <= ( ( $ this -> _byPage * $ this -> _currentPage ) - 1 ) ; $ i ++ ) { if ( isset ( $ data [ $ i ] ) ) { array_push ( $ this -> _data , $ data [ $ i ] ) ; } } return $ this -> _data ; ...
get the data to be displayed from all data
18,138
protected function getStaticElementHelper ( ) { if ( $ this -> staticElementHelper ) { return $ this -> staticElementHelper ; } $ renderer = $ this -> getView ( ) ; if ( method_exists ( $ this -> view , 'plugin' ) ) { $ this -> staticElementHelper = $ renderer -> plugin ( $ this -> defaultStaticElementHelper ) ; } if (...
Retrieve the FormStatic helper
18,139
protected function renderAttribute ( $ name , $ value = null ) { if ( $ value === null ) { return $ name ; } if ( is_array ( $ value ) ) { $ value = implode ( ' ' , $ value ) ; } return vsprintf ( '%s="%s"' , [ $ name , Html :: escape ( ( string ) $ value ) , ] ) ; }
Render a single attribute in a node .
18,140
protected function renderAttributes ( ) { return ArrayMap :: of ( $ this -> attributes ) -> map ( function ( $ value , $ name ) { return $ this -> renderAttribute ( $ name , $ value ) ; } ) -> join ( ' ' ) ; }
Render the attributes part of the opening tag .
18,141
protected function renderContent ( ) { if ( is_string ( $ this -> content ) || $ this -> content instanceof SafeHtmlWrapper || $ this -> content instanceof SafeHtmlProducerInterface ) { return Html :: escape ( $ this -> content ) ; } elseif ( $ this -> content instanceof RenderableInterface ) { return Html :: escape ( ...
Render the content of the tag .
18,142
public function render ( ) { $ result = $ this -> spec -> check ( $ this -> attributes ) ; if ( $ result -> failed ( ) ) { throw new InvalidAttributesException ( $ result ) ; } $ attributes = $ this -> renderAttributes ( ) ; if ( strlen ( $ attributes ) ) { $ attributes = ' ' . $ attributes ; } if ( $ this -> selfClosi...
Render the Node .
18,143
public function dispatch ( $ url , Request $ request , Response $ response ) { $ output = $ this -> resolveOutput ( $ url , $ request -> isAjax ( ) ) ; if ( is_object ( $ output ) ) { if ( $ output instanceof ElementInterface ) { $ response -> addHeader ( "X-Loops-ID" , $ output -> getLoopsId ( ) ) ; } $ output = $ thi...
Dispatches a web request to an url and returns the contents to display
18,144
public static function getParameterCount ( $ pageclass ) { if ( is_object ( $ pageclass ) ) { $ pageclass = get_class ( $ pageclass ) ; } $ count = array_count_values ( explode ( "\\" , $ pageclass ) ) ; return array_key_exists ( "_" , $ count ) ? $ count [ "_" ] : 0 ; }
Counts the number of the needed page parameter given the classname or an object
18,145
private function display ( $ element , Request $ request , Response $ response ) { $ loops = $ this -> getLoops ( ) ; $ renderer = $ loops -> getService ( "renderer" ) ; $ appearance = [ ] ; if ( $ request -> isAjax ( ) ) { $ renderer -> addExtraAppearance ( "ajax" ) ; } $ renderer -> addExtraAppearance ( ( string ) $ ...
Renders an object with the renderer
18,146
public static function getPagePathFromClassname ( $ classname , $ page_parameter = [ ] , Loops $ loops = NULL ) { $ count = count ( $ page_parameter ) ; if ( ! $ routes = self :: getRoutes ( $ loops ? : Loops :: getCurrentLoops ( ) ) ) { return FALSE ; } $ routes = array_filter ( $ routes , function ( $ value , $ key )...
Generates the page path for a page element
18,147
private static function getRoutes ( $ loops ) { $ cache = $ loops -> getService ( "cache" ) ; $ key = "Loops-WebCore-getRoutes" ; if ( $ cache -> contains ( $ key ) ) { return $ cache -> fetch ( $ key ) ; } if ( ! $ loops -> hasService ( "application" ) ) { return FALSE ; } $ classnames = $ loops -> getService ( "appli...
Generates an array with all available routes
18,148
private function resolvePage ( $ url , $ processing = [ ] ) { $ path = ltrim ( $ url , "/" ) ; $ routes = self :: getRoutes ( $ this -> getLoops ( ) ) ; foreach ( $ routes as $ route => $ pageclass ) { $ regexp = "/^" . str_replace ( "\*" , "([^\/]+)" , preg_quote ( $ route , "/" ) ) . "/" ; if ( ! preg_match ( $ regex...
Find the page object that should be displayed based on the accessed url
18,149
public static function dashToCamelCase ( $ string ) { $ result = '' ; $ urlPart = explode ( '-' , $ string ) ; foreach ( $ urlPart as $ word ) { $ result .= ucfirst ( strtolower ( $ word ) ) ; } return $ result ; }
Replace dashes to CamelCase string format
18,150
public static function routeParse ( $ from , $ to , $ url ) { $ result = preg_match ( '/^(\(([^\)]+)\)|[^\/]*)(.*)/' , $ from , $ data ) ; if ( $ result !== 1 ) { return false ; } $ pattern = '/^' . str_replace ( '/' , '\/' , $ data [ 3 ] ) . '$/' ; $ result = preg_match ( $ pattern , $ url ) ; if ( $ result !== 1 ) { ...
Parse route and return object RouteInfo with information about accepted route or return false if route pattern does not math
18,151
public function processBundles ( ) { $ loader = $ this -> getLoader ( ) ; $ view = $ this -> ensureView ( $ this -> owner ) ; foreach ( array_keys ( $ view -> assetBundles ) as $ name ) { $ loader -> registerAssetBundle ( $ name ) ; } }
Registers asset bundles in the JS loader
18,152
public function read ( \ PDOStatement $ stmt ) { $ this -> unfoundPrecedence = array ( ) ; $ preparedReader = new PreparedOperations ( $ this -> FQuery ) ; while ( $ row = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { foreach ( $ preparedReader -> getPreparedFaces ( ) as $ basePath => $ preparedFace ) { $ identity = $ p...
parse the pdo statement of the fquery
18,153
protected function createInstance ( \ Face \ Core \ EntityFace $ face ) { $ className = $ face -> getClass ( ) ; $ instance = new $ className ( ) ; return $ instance ; }
Create an instance from an assoc array returned by sql
18,154
public static function fromString ( string $ string , array $ properties = null ) : ? Style { if ( ! preg_match_all ( '/([^:]+):([^;]+)(;|$)/' , strtolower ( $ string ) , $ matches , PREG_SET_ORDER ) ) { return null ; } $ style = new Style ( null ) ; foreach ( $ matches as $ match ) { $ property = trim ( $ match [ 1 ] ...
Factory which attempts to create a new Style based on an inline styling syntax .
18,155
protected function setColor ( string $ type , ? string $ color ) : interfaces \ Style { if ( isset ( $ color ) && ! isset ( static :: $ { $ type . 's' } [ $ color ] ) ) { throw new \ InvalidArgumentException ( "The $type color [$color] is not recognized." ) ; } $ this -> $ type = $ color ; return $ this ; }
Sets a specific type of color on this Style .
18,156
public function preRun ( ) : void { if ( $ output = $ this -> getOutput ( ) ) { $ max = 0 ; $ iterator = $ this -> getIterator ( ) ; if ( $ iterator instanceof \ SplFileObject ) { $ max = $ iterator -> getSize ( ) ; } elseif ( $ iterator instanceof \ Countable ) { $ max = count ( $ iterator ) ; } $ this -> progress = n...
Starts a new progress bar output in the pre - run phase .
18,157
public function postSearch ( ) : void { if ( $ this -> progress ) { $ iterator = $ this -> getIterator ( ) ; if ( $ iterator instanceof \ SplFileObject ) { $ this -> progress -> setProgress ( $ iterator -> ftell ( ) ) ; } elseif ( is_int ( $ key = $ iterator -> key ( ) ) ) { $ this -> progress -> setProgress ( $ key + ...
Updates the current progress in the post - search phase .
18,158
public function postRun ( ) : void { if ( $ this -> progress ) { $ this -> progress -> finish ( ) ; $ this -> getOutput ( ) -> writeln ( '' ) ; } }
Finishes the progress output in the post - run phase .
18,159
protected function outputInProgress ( string $ line ) : void { if ( $ this -> progress ) { $ this -> progress -> clear ( ) ; $ this -> getOutput ( ) -> writeln ( $ line ) ; $ this -> progress -> display ( ) ; } }
Outputs a line of text while a progress bar is running .
18,160
public function getMetaData ( $ key ) { if ( ! isset ( $ this -> metaData [ $ key ] ) ) { return false ; } return $ this -> metaData [ $ key ] ; }
Returns the meta data value for the given key
18,161
public function hasAccess ( $ accessLevel ) { foreach ( $ this -> permissions as $ permission ) { if ( $ permission == '\\Global\\*' ) { return true ; } if ( $ permission == $ accessLevel ) { return true ; } $ posStar = strpos ( $ permission , '*' ) ; if ( $ posStar !== false ) { $ startPermission = substr ( $ permissi...
Returns true if the access entity has access to the given permission access level
18,162
public function setGroup ( ChildGroup $ v = null ) { if ( null !== $ this -> aGroup && $ v !== $ this -> aGroup ) { $ this -> oldGroupSkillCount = $ this -> aGroup ; } if ( $ v === null ) { $ this -> setGroupId ( NULL ) ; } else { $ this -> setGroupId ( $ v -> getId ( ) ) ; } $ this -> aGroup = $ v ; if ( $ v !== null ...
Declares an association between this object and a ChildGroup object .
18,163
public function getGroup ( ConnectionInterface $ con = null ) { if ( $ this -> aGroup === null && ( $ this -> group_id !== null ) ) { $ this -> aGroup = ChildGroupQuery :: create ( ) -> findPk ( $ this -> group_id , $ con ) ; } return $ this -> aGroup ; }
Get the associated ChildGroup object
18,164
protected function updateRelatedGroupSkillCount ( ConnectionInterface $ con ) { if ( $ group = $ this -> getGroup ( ) ) { $ group -> updateSkillCount ( $ con ) ; } if ( $ this -> oldGroupSkillCount ) { $ this -> oldGroupSkillCount -> updateSkillCount ( $ con ) ; $ this -> oldGroupSkillCount = null ; } }
Update the aggregate column in the related Group object
18,165
public function withLabels ( array $ labels ) : Validator { $ translator = $ this -> translator -> withLabels ( $ labels ) ; return new Validator ( $ this -> rules , $ this -> parser , $ translator ) ; }
Return a new validator with the given list of labels added to the translator .
18,166
public function withTemplates ( array $ templates ) : Validator { $ translator = $ this -> translator -> withTemplates ( $ templates ) ; return new Validator ( $ this -> rules , $ this -> parser , $ translator ) ; }
Return a new validator with the given list of templates added to the translator .
18,167
public function validate ( array $ input = [ ] ) : ValidationResult { $ results = [ ] ; foreach ( $ this -> rules as $ key => $ definition ) { $ rules = $ this -> parser -> parseRulesDefinition ( $ definition ) ; $ results [ $ key ] = $ rules -> validate ( $ key , $ input ) ; } return new ValidationResult ( $ results ,...
Validate the given input against the rules .
18,168
public function isRequired ( ) : Testable { $ this -> attributes [ 'required' ] = true ; return $ this -> addTest ( 'required' , function ( $ value ) { if ( is_array ( $ value ) ) { return $ value ; } return strlen ( trim ( $ value ) ) ; } ) ; }
This is a required field .
18,169
protected function serializeModel ( Model $ model , AdapterInterface $ adapter ) { $ metadata = $ model -> getMetadata ( ) ; $ serialized = [ 'type' => $ model -> getType ( ) , 'id' => $ model -> getId ( ) , ] ; if ( $ this -> depth > 0 ) { return $ serialized ; } foreach ( $ metadata -> getAttributes ( ) as $ key => $...
Serializes the interior of a model . This is the serialization that takes place outside of a data container . Can be used for root model and relationship model serialization .
18,170
protected function serializeAttribute ( $ value , AttributeMetadata $ attrMeta ) { if ( 'date' === $ attrMeta -> dataType && $ value instanceof \ DateTime ) { $ milliseconds = sprintf ( '%03d' , round ( $ value -> format ( 'u' ) / 1000 , 0 ) ) ; return gmdate ( sprintf ( 'Y-m-d\TH:i:s.%s\Z' , $ milliseconds ) , $ value...
Serializes an attribute value .
18,171
protected function serializeEmbed ( $ value , EmbeddedPropMetadata $ embeddedPropMeta ) { $ embedMeta = $ embeddedPropMeta -> embedMeta ; if ( true === $ embeddedPropMeta -> isOne ( ) ) { return $ this -> serializeEmbedOne ( $ embedMeta , $ value ) ; } return $ this -> serializeEmbedMany ( $ embedMeta , $ value ) ; }
Serializes an embed value .
18,172
protected function serializeEmbedOne ( EmbedMetadata $ embedMeta , Embed $ embed = null ) { if ( null === $ embed ) { return ; } $ serialized = [ ] ; foreach ( $ embedMeta -> getAttributes ( ) as $ key => $ attrMeta ) { $ serialized [ $ key ] = $ this -> serializeAttribute ( $ embed -> get ( $ key ) , $ attrMeta ) ; } ...
Serializes an embed one value .
18,173
protected function serializeEmbedMany ( EmbedMetadata $ embedMeta , EmbedCollection $ collection ) { $ serialized = [ ] ; foreach ( $ collection as $ embed ) { if ( ! $ embed instanceof Embed ) { continue ; } $ serialized [ ] = $ this -> serializeEmbedOne ( $ embedMeta , $ embed ) ; } return $ serialized ; }
Serializes an embed many value .
18,174
protected function serializeRelationship ( Model $ owner , $ relationship = null , RelationshipMetadata $ relMeta , AdapterInterface $ adapter ) { if ( $ relMeta -> isOne ( ) ) { if ( is_array ( $ relationship ) ) { throw SerializerException :: badRequest ( 'Invalid relationship value.' ) ; } $ serialized = $ this -> s...
Serializes a relationship value
18,175
protected function serializeHasMany ( Model $ owner , array $ models = null , AdapterInterface $ adapter ) { if ( empty ( $ models ) ) { return $ this -> serialize ( null , $ adapter ) ; } return $ this -> serializeArray ( $ models , $ adapter ) ; }
Serializes a has - many relationship value
18,176
protected function serializeHasOne ( Model $ owner , Model $ model = null , AdapterInterface $ adapter ) { return $ this -> serialize ( $ model , $ adapter ) ; }
Serializes a has - one relationship value
18,177
public function buildCommand ( ) { if ( $ this -> withoutOverlapping ) { $ command = '(touch ' . $ this -> mutexPath ( ) . '; ' . $ this -> command . '; rm ' . $ this -> mutexPath ( ) . ') > ' . $ this -> output . ' 2>&1 &' ; } else { $ command = $ this -> command . ' > ' . $ this -> output . ' 2>&1 &' ; } return $ thi...
Build the comand string .
18,178
protected function tokenizePath ( $ path ) { $ parts = explode ( $ this -> pathSeparator , $ path ) ; if ( $ this -> trimTokens ) { for ( $ i = 0 ; $ i < count ( $ parts ) ; $ i ++ ) { $ parts [ $ i ] = trim ( $ parts [ $ i ] ) ; if ( $ parts [ $ i ] === "" ) { unset ( $ parts [ $ i ] ) ; } } } return array_values ( $ ...
Tokenize the given path String into parts based on this matcher s settings .
18,179
protected function matchStrings ( $ pattern , $ str , & $ uriTemplateVariables ) { return $ this -> getStringMatcher ( $ pattern ) -> matchStrings ( $ str , $ uriTemplateVariables ) ; }
Tests whether or not a string matches against a pattern .
18,180
protected function concat ( $ path1 , $ path2 ) { if ( substr ( $ path1 , - 1 ) == $ this -> pathSeparator || substr ( $ path2 , 0 , 1 ) == $ this -> pathSeparator ) { return $ path1 . $ path2 ; } return $ path1 . $ this -> pathSeparator . $ path2 ; }
Concats two paths using the path separator
18,181
public function getAllCurrent ( ) { $ notifications = [ ] ; $ container = $ this -> getContainer ( ) ; foreach ( $ container as $ namespace => $ notification ) { $ notifications [ $ namespace ] = $ this -> getCurrent ( $ namespace ) ; } return $ notifications ; }
Get all current notifications
18,182
protected function getNotificationsFromContainer ( ) { if ( ! empty ( $ this -> notifications ) || $ this -> isAdded ) { return ; } $ container = $ this -> getContainer ( ) ; $ namespaces = [ ] ; foreach ( $ container as $ namespace => $ notification ) { $ this -> notifications [ $ namespace ] = $ notification ; $ name...
Clear notifications from container
18,183
public function clearCurrent ( $ namespace = null ) { $ container = $ this -> getContainer ( ) ; if ( $ namespace ) { if ( ! $ container -> offsetExists ( $ namespace ) ) { return false ; } unset ( $ container -> { $ namespace } ) ; return true ; } foreach ( $ container as $ namespace => $ notifications ) { $ container...
Clear notifications from container if namespace is provided or clear all notifications added during this request if namespace is not provided .
18,184
public function clear ( $ namespace = null ) { $ this -> getNotificationsFromContainer ( ) ; if ( $ namespace ) { if ( isset ( $ this -> notifications [ $ namespace ] ) ) { unset ( $ this -> notifications [ $ namespace ] ) ; return true ; } return false ; } foreach ( $ this -> notifications as $ nm => $ type ) { unset ...
Clear notifications from previous request by provided namespace or clear all notifications if namespace is not provided
18,185
public function updateOne ( string $ referenceName , string $ value ) : array { return $ this -> sendPatch ( sprintf ( '/profiles/%s/references/%s' , $ this -> userName , $ referenceName ) , [ ] , [ 'value' => $ value ] ) ; }
Updates a reference given its slug .
18,186
public function calculateDate ( $ gYear , $ gMonth , $ gDay ) { return $ this -> getPoirotPersian ( ) -> calculateDate ( $ gYear , $ gMonth , $ gDay ) ; }
Calculate date to calendar system
18,187
protected function syncCookies ( ) { foreach ( $ this -> cookies as $ name => $ id ) { if ( null === $ id ) { setcookie ( $ name , '' , time ( ) - 3600 ) ; } else { setcookie ( $ name , $ id , $ this -> ttl ? ( time ( ) + $ this -> ttl ) : 0 , $ this -> path , $ this -> domain , $ this -> secure , $ this -> httponly ) ...
Sync session cookies with the client
18,188
private function getDaysInMonth ( Month $ month , Year $ year ) { return ( int ) date ( 't' , mktime ( 0 , 0 , 0 , ( string ) $ month , 1 , ( string ) $ year ) ) ; }
Get number of days in specified month .
18,189
public function connection ( $ name = null ) { if ( is_null ( $ name ) ) { $ name = $ this -> getDefaultConnection ( ) ; } if ( ! isset ( $ this -> connections [ $ name ] ) ) { throw new InvalidArgumentException ( "Connection [{$name}] is not registered." ) ; } return $ this -> connections [ $ name ] ; }
Get an API connection instance .
18,190
public static function getMembers ( ) { $ className = static :: class ; $ members = & self :: $ members [ $ className ] ; if ( empty ( $ members ) ) { new $ className ( null ) ; } return $ members ; }
Returns members of enum
18,191
public function httpGetRequest ( $ url ) { $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ url ) ; curl_setopt ( $ curl , CURLOPT_RETURNTRANSFER , 1 ) ; $ response = curl_exec ( $ curl ) ; $ resolve = $ this -> curlResponse -> resolve ( $ curl , $ response ) ; curl_close ( $ curl ) ; return $ resolve ; ...
Make a GET HTTP request
18,192
public function httpStatusConnection ( $ url ) { if ( ! filter_var ( $ url , FILTER_VALIDATE_URL ) ) { return false ; } $ handle = curl_init ( $ url ) ; curl_setopt ( $ handle , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ handle , CURLOPT_FOLLOWLOCATION , true ) ; $ response = curl_exec ( $ handle ) ; $ httpCode ...
Check the connection status
18,193
public function httpPosRequest ( $ url , $ data ) { $ enc = EncryptAes :: encrypt ( $ data ) ; $ dataEncrypt = 'data=' . $ enc ; $ dataEncrypt = str_replace ( '+' , '%2B' , $ dataEncrypt ) ; $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_HEADER , 0 ) ; curl_setopt ( $ curl , CURLOPT_POST , count ( $ dataEncryp...
Make a POST HTTP request
18,194
public function redeemAction ( $ accessToken ) { if ( $ this -> request -> getHttpRequest ( ) -> getMethod ( ) !== 'POST' ) { $ this -> response -> setStatus ( 405 ) ; $ this -> response -> setHeader ( 'Allow' , 'POST' ) ; return ; } $ accessTokenObject = $ this -> accessTokenRepository -> findByIdentifier ( $ accessTo...
Redeem an access token and return global account data for the authenticated account and a global session id .
18,195
public function GetListOfTablesInDatabase ( ) { $ dbConfig = new \ Puzzlout \ Framework \ Dal \ DbStatementConfig ( null , \ Puzzlout \ Framework \ Dal \ DbExecutionType :: SHOWTABLES , new \ Puzzlout \ Framework \ Dal \ DbQueryFilters ( ) ) ; $ dbConfig -> setQuery ( "SHOW TABLES;" ) ; $ this -> addDbConfigItem ( $ db...
Gets the list of table names in a database .
18,196
public function GetTableColumnsMeta ( $ tableName , $ columnNames ) { $ tableColumnsMetadata = array ( ) ; foreach ( $ columnNames as $ columnName ) { $ this -> setDbConfigList ( array ( ) ) ; $ dbConfig = new \ Puzzlout \ Framework \ Dal \ DbStatementConfig ( null , \ Puzzlout \ Framework \ Dal \ DbExecutionType :: CO...
Gets the list of column metadata for a table .
18,197
public function GetTableColumnNames ( $ tableName ) { $ this -> setDbConfigList ( array ( ) ) ; $ dbConfig = new \ Puzzlout \ Framework \ Dal \ DbStatementConfig ( null , \ Puzzlout \ Framework \ Dal \ DbExecutionType :: COLUMNNAMES , new \ Puzzlout \ Framework \ Dal \ DbQueryFilters ( ) ) ; $ dbConfig -> setQuery ( "D...
Gets the column names for a table .
18,198
public function prepareSortOrProjection ( array $ fields ) { $ preparedFields = array ( ) ; foreach ( $ fields as $ key => $ value ) { $ preparedFields [ $ this -> prepareFieldName ( $ key ) ] = $ value ; } return $ preparedFields ; }
Prepare a sort or projection array by converting keys which are PHP property names to MongoDB field names .
18,199
public function addFilterToPreparedQuery ( array $ preparedQuery ) { if ( $ filterCriteria = $ this -> dm -> getFilterCollection ( ) -> getFilterCriteria ( $ this -> class ) ) { $ preparedQuery = $ this -> cm -> merge ( $ preparedQuery , $ this -> prepareQueryOrNewObj ( $ filterCriteria ) ) ; } return $ preparedQuery ;...
Adds filter criteria to an already - prepared query .