idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
10,200 | public function add_blade ( ) { $ blade = new Snap_Blade ( Theme_Utils :: get_active_theme_path ( Config :: get ( 'theme.templates_directory' ) ) , Theme_Utils :: get_active_theme_path ( \ trailingslashit ( Config :: get ( 'theme.cache_directory' ) ) . 'templates' ) , Config :: get ( 'blade.development_mode' ) ? BladeO... | Creates the Snap_blade instance and adds to service container . |
10,201 | private function add_directives ( $ blade ) { $ blade -> directive ( 'simplemenu' , function ( $ expression ) { \ preg_match ( '/\( *(.*) * as *([^\)]*)/' , $ expression , $ matches ) ; $ iteratee = \ trim ( $ matches [ 1 ] ) ; $ iteration = \ trim ( $ matches [ 2 ] ) ; $ init_loop = "\$__currentLoopData = \Snap\Utils\... | Add custom directives to blade . |
10,202 | private function add_wp_directives ( $ blade ) { $ blade -> directive ( 'wphead' , function ( ) { return '<?php wp_head(); ?>' ; } ) ; $ blade -> directive ( 'wpfooter' , function ( ) { return '<?php wp_footer(); ?>' ; } ) ; $ blade -> directive ( 'sidebar' , function ( $ input ) { return "<?php dynamic_sidebar({$this-... | Add custom directives for WordPress functions to blade . |
10,203 | public function create ( $ id , array $ attributes ) { $ typeModelName = $ this -> getTypeModelName ( ) ; $ nodeType = $ typeModelName :: findOrFail ( $ id ) ; $ nodeField = $ nodeType -> addField ( $ attributes ) ; $ this -> builderService -> buildField ( $ nodeField -> getName ( ) , $ nodeField -> getType ( ) , $ nod... | Creates a node field |
10,204 | public function destroy ( $ id ) { $ modelName = $ this -> getModelName ( ) ; $ nodeField = $ modelName :: findOrFail ( $ id ) ; $ nodeField -> delete ( ) ; $ this -> builderService -> destroyField ( $ nodeField -> getName ( ) , $ nodeField -> nodeType -> getName ( ) , $ nodeField -> nodeType ) ; return $ nodeField ; } | Destroys a node field |
10,205 | public function splitDefinition ( InputDefinition $ definition ) { $ ret = array ( new InputDefinition ( ) , new InputDefinition ( ) ) ; foreach ( $ definition -> getArguments ( ) as $ arg ) { $ ret [ 0 ] -> addArgument ( $ arg ) ; $ ret [ 1 ] -> addArgument ( $ arg ) ; } foreach ( $ definition -> getOptions ( ) as $ o... | Splits the definition in an internal and public one the latter representing whatever is shown to the user the former representing the options that are hidden . |
10,206 | public function addRenderer ( $ name , $ renderer , $ overwrite = false ) { if ( isset ( $ this -> renderers [ $ name ] ) && ! $ overwrite ) { throw new InvalidArgumentException ( "Renderer with name '$name' is already registered." ) ; } unset ( $ this -> renderers [ $ name ] ) ; if ( is_string ( $ renderer ) && ! clas... | Ads renderer with given name |
10,207 | public function getRenderer ( $ name ) { if ( $ name === null ) { if ( $ this -> defaultRenderer !== null ) { $ name = $ this -> defaultRenderer ; } else if ( count ( $ this -> renderers ) > 0 ) { $ name = key ( $ this -> renderers ) ; } } if ( ! isset ( $ this -> renderers [ $ name ] ) ) { throw new InvalidArgumentExc... | Returns instance of the renderer |
10,208 | protected function getFiles ( ) { $ this -> mirrorDir ( ) ; $ this -> prepareMirrorDir ( ) ; $ this -> printTaskInfo ( 'Retrieving files to package.' ) ; $ mirrorFinder = new Finder ( ) ; $ mirrorFinder -> ignoreDotFiles ( false ) ; $ add = [ ] ; $ mirrorFinder -> in ( $ this -> tmpDir ) -> depth ( 0 ) ; foreach ( $ mi... | Get the files and directories to package . |
10,209 | protected function mirrorDir ( ) { if ( ! $ this -> useTmpDir ) { $ this -> tmpDir = $ this -> dir ; return ; } $ this -> tmpDir = md5 ( time ( ) ) ; if ( file_exists ( $ this -> tmpDir ) ) { $ this -> fs -> remove ( $ this -> tmpDir ) ; } $ this -> printTaskInfo ( sprintf ( 'Creating temporary directory %s.' , $ this ... | Mirror the directory to a temp directory . |
10,210 | protected function prepareMirrorDir ( ) { $ this -> printTaskInfo ( sprintf ( 'Preparing directory %s.' , $ this -> tmpDir ) ) ; if ( empty ( $ this -> ignoreFileNames ) ) { return ; } $ files = new Finder ( ) ; $ files -> in ( $ this -> tmpDir ) ; $ files -> ignoreDotFiles ( false ) ; $ files -> files ( ) ; foreach ( ... | Removes files that should not be packaged from the mirrored directory . |
10,211 | public static function fd ( $ object , $ type = 'log' ) { $ types = array ( 'log' , 'debug' , 'info' , 'warn' , 'error' , 'assert' ) ; if ( ! \ in_array ( $ type , $ types , true ) ) { $ type = 'log' ; } $ data = json_encode ( $ object ) ; echo '<script type="text/javascript">console.' . $ type . '(' . $ data . ');</sc... | Display a var dump in firebug console |
10,212 | public function parse ( ) { $ p = 0 ; do { $ p = $ this -> scanner -> position ( ) ; $ this -> consumeData ( ) ; } while ( $ this -> carryOn ) ; } | Begin parsing . |
10,213 | public function setTextMode ( $ textmode , $ untilTag = null ) { $ this -> textMode = $ textmode & ( HTML5_Elements :: TEXT_RAW | HTML5_Elements :: TEXT_RCDATA ) ; $ this -> untilTag = $ untilTag ; } | Set the text mode for the character data reader . |
10,214 | protected function consumeData ( ) { $ this -> characterReference ( ) ; $ this -> tagOpen ( ) ; $ this -> eof ( ) ; $ this -> characterData ( ) ; return $ this -> carryOn ; } | Consume a character and make a move . HTML5 8 . 2 . 4 . 1 |
10,215 | protected function characterData ( ) { if ( $ this -> scanner -> current ( ) === false ) { return false ; } switch ( $ this -> textMode ) { case HTML5_Elements :: TEXT_RAW : return $ this -> rawText ( ) ; case HTML5_Elements :: TEXT_RCDATA : return $ this -> rcdata ( ) ; default : $ tok = $ this -> scanner -> current (... | Parse anything that looks like character data . |
10,216 | protected function text ( ) { $ tok = $ this -> scanner -> current ( ) ; if ( $ tok === false ) { return false ; } if ( $ tok === "\00" ) { $ this -> parseError ( "Received null character." ) ; } $ this -> buffer ( $ tok ) ; $ this -> scanner -> next ( ) ; return true ; } | This buffers the current token as character data . |
10,217 | protected function rawText ( ) { if ( is_null ( $ this -> untilTag ) ) { return $ this -> text ( ) ; } $ sequence = '</' . $ this -> untilTag . '>' ; $ txt = $ this -> readUntilSequence ( $ sequence ) ; $ this -> events -> text ( $ txt ) ; $ this -> setTextMode ( 0 ) ; return $ this -> endTag ( ) ; } | Read text in RAW mode . |
10,218 | protected function rcdata ( ) { if ( is_null ( $ this -> untilTag ) ) { return $ this -> text ( ) ; } $ sequence = '</' . $ this -> untilTag . '>' ; $ txt = '' ; $ tok = $ this -> scanner -> current ( ) ; while ( $ tok !== false && ! ( $ tok == '<' && ( $ this -> sequenceMatches ( $ sequence ) || $ this -> sequenceMatc... | Read text in RCDATA mode . |
10,219 | protected function eof ( ) { if ( $ this -> scanner -> current ( ) === false ) { $ this -> flushBuffer ( ) ; $ this -> events -> eof ( ) ; $ this -> carryOn = false ; return true ; } return false ; } | If the document is read emit an EOF event . |
10,220 | protected function tagOpen ( ) { if ( $ this -> scanner -> current ( ) != '<' ) { return false ; } $ this -> flushBuffer ( ) ; $ this -> scanner -> next ( ) ; return $ this -> markupDeclaration ( ) || $ this -> endTag ( ) || $ this -> processingInstruction ( ) || $ this -> tagName ( ) || $ this -> parseError ( "Illegal... | Emit a tagStart event on encountering a tag . |
10,221 | protected function markupDeclaration ( ) { if ( $ this -> scanner -> current ( ) != '!' ) { return false ; } $ tok = $ this -> scanner -> next ( ) ; if ( $ tok == '-' && $ this -> scanner -> peek ( ) == '-' ) { $ this -> scanner -> next ( ) ; $ this -> scanner -> next ( ) ; return $ this -> comment ( ) ; } elseif ( $ t... | Look for markup . |
10,222 | protected function endTag ( ) { if ( $ this -> scanner -> current ( ) != '/' ) { return false ; } $ tok = $ this -> scanner -> next ( ) ; if ( ! ctype_alpha ( $ tok ) ) { $ this -> parseError ( "Expected tag name, got '%s'" , $ tok ) ; if ( $ tok == "\0" || $ tok === false ) { return false ; } return $ this -> bogusCom... | Consume an end tag . 8 . 2 . 4 . 9 |
10,223 | protected function tagName ( ) { $ tok = $ this -> scanner -> current ( ) ; if ( ! ctype_alpha ( $ tok ) ) { return false ; } $ name = strtolower ( $ this -> scanner -> charsWhile ( ":_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ) ) ; $ attributes = array ( ) ; $ selfClose = false ; try { do { $ th... | Consume a tag name and body . 8 . 2 . 4 . 10 |
10,224 | protected function isTagEnd ( & $ selfClose ) { $ tok = $ this -> scanner -> current ( ) ; if ( $ tok == '/' ) { $ this -> scanner -> next ( ) ; $ this -> scanner -> whitespace ( ) ; if ( $ this -> scanner -> current ( ) == '>' ) { $ selfClose = true ; return true ; } if ( $ this -> scanner -> current ( ) === false ) {... | Check if the scanner has reached the end of a tag . |
10,225 | protected function attribute ( & $ attributes ) { $ tok = $ this -> scanner -> current ( ) ; if ( $ tok == '/' || $ tok == '>' || $ tok === false ) { return false ; } if ( $ tok == '<' ) { $ this -> parseError ( "Unexepcted '<' inside of attributes list." ) ; $ this -> scanner -> unconsume ( ) ; throw new HTML5_Parser_... | Parse attributes from inside of a tag . |
10,226 | protected function attributeValue ( ) { if ( $ this -> scanner -> current ( ) != '=' ) { return null ; } $ this -> scanner -> next ( ) ; $ this -> scanner -> whitespace ( ) ; $ tok = $ this -> scanner -> current ( ) ; switch ( $ tok ) { case "\n" : case "\f" : case " " : case "\t" : return null ; case '"' : case "'" : ... | Consume an attribute value . 8 . 2 . 4 . 37 and after . |
10,227 | protected function quotedAttributeValue ( $ quote ) { $ stoplist = "\f" . $ quote ; $ val = '' ; $ tok = $ this -> scanner -> current ( ) ; while ( strspn ( $ tok , $ stoplist ) == 0 && $ tok !== false ) { if ( $ tok == '&' ) { $ val .= $ this -> decodeCharacterReference ( true ) ; $ tok = $ this -> scanner -> current ... | Get an attribute value string . |
10,228 | protected function bogusComment ( $ leading = '' ) { $ comment = $ leading ; $ tok = $ this -> scanner -> current ( ) ; do { $ comment .= $ tok ; $ tok = $ this -> scanner -> next ( ) ; } while ( $ tok !== false && $ tok != '>' ) ; $ this -> flushBuffer ( ) ; $ this -> events -> comment ( $ comment . $ tok ) ; $ this -... | Consume malformed markup as if it were a comment . 8 . 2 . 4 . 44 |
10,229 | protected function comment ( ) { $ tok = $ this -> scanner -> current ( ) ; $ comment = '' ; if ( $ tok == '>' ) { $ this -> parseError ( "Expected comment data, got '>'" ) ; $ this -> events -> comment ( '' ) ; $ this -> scanner -> next ( ) ; return true ; } if ( $ tok == "\0" ) { $ tok = HTML5_Parser_UTF8Utils :: FFF... | Read a comment . |
10,230 | protected function isCommentEnd ( ) { if ( $ this -> scanner -> current ( ) === false ) { $ this -> parseError ( "Unexpected EOF in a comment." ) ; return true ; } if ( $ this -> scanner -> current ( ) != '-' ) { return false ; } if ( $ this -> scanner -> next ( ) == '-' && $ this -> scanner -> peek ( ) == '>' ) { $ th... | Check if the scanner has reached the end of a comment . |
10,231 | protected function quotedString ( $ stopchars ) { $ tok = $ this -> scanner -> current ( ) ; if ( $ tok == '"' || $ tok == "'" ) { $ this -> scanner -> next ( ) ; $ ret = $ this -> scanner -> charsUntil ( $ tok . $ stopchars ) ; if ( $ this -> scanner -> current ( ) == $ tok ) { $ this -> scanner -> next ( ) ; } else {... | Utility for reading a quoted string . |
10,232 | protected function cdataSection ( ) { if ( $ this -> scanner -> current ( ) != '[' ) { return false ; } $ cdata = '' ; $ this -> scanner -> next ( ) ; $ chars = $ this -> scanner -> charsWhile ( 'CDAT' ) ; if ( $ chars != 'CDATA' || $ this -> scanner -> current ( ) != '[' ) { $ this -> parseError ( 'Expected [CDATA[, g... | Handle a CDATA section . |
10,233 | protected function processingInstruction ( ) { if ( $ this -> scanner -> current ( ) != '?' ) { return false ; } $ tok = $ this -> scanner -> next ( ) ; $ procName = $ this -> scanner -> getAsciiAlpha ( ) ; $ white = strlen ( $ this -> scanner -> whitespace ( ) ) ; if ( strlen ( $ procName ) == 0 || $ white == 0 || $ t... | Handle a processing instruction . |
10,234 | protected function readUntilSequence ( $ sequence ) { $ buffer = '' ; $ first = substr ( $ sequence , 0 , 1 ) ; while ( $ this -> scanner -> current ( ) !== false ) { $ buffer .= $ this -> scanner -> charsUntil ( $ first ) ; if ( $ this -> sequenceMatches ( $ sequence ) || $ this -> sequenceMatches ( strtoupper ( $ seq... | Read from the input stream until we get to the desired sequene or hit the end of the input stream . |
10,235 | protected function sequenceMatches ( $ sequence ) { $ len = strlen ( $ sequence ) ; $ buffer = '' ; for ( $ i = 0 ; $ i < $ len ; ++ $ i ) { $ buffer .= $ this -> scanner -> current ( ) ; if ( $ this -> scanner -> current ( ) === false ) { $ this -> scanner -> unconsume ( $ i ) ; return false ; } $ this -> scanner -> n... | Check if upcomming chars match the given sequence . |
10,236 | protected function flushBuffer ( ) { if ( $ this -> text === '' ) { return ; } $ this -> events -> text ( $ this -> text ) ; $ this -> text = '' ; } | Send a TEXT event with the contents of the text buffer . |
10,237 | protected function parseError ( $ msg ) { $ args = func_get_args ( ) ; if ( count ( $ args ) > 1 ) { array_shift ( $ args ) ; $ msg = vsprintf ( $ msg , $ args ) ; } $ line = $ this -> scanner -> currentLine ( ) ; $ col = $ this -> scanner -> columnOffset ( ) ; $ this -> events -> parseError ( $ msg , $ line , $ col ) ... | Emit a parse error . |
10,238 | protected function decodeCharacterReference ( $ inAttribute = false ) { if ( $ this -> scanner -> current ( ) != '&' ) { return false ; } $ tok = $ this -> scanner -> next ( ) ; $ entity = '' ; $ start = $ this -> scanner -> position ( ) ; if ( $ tok == false ) { return '&' ; } if ( strspn ( $ tok , static :: WHITE . "... | Decode a character reference and return the string . |
10,239 | public static function splitName ( $ class ) { $ pos = strrpos ( $ class , '\\' ) ; if ( $ pos === false ) { return [ null , $ class ] ; } else { return [ substr ( $ class , 0 , $ pos ) , substr ( $ class , $ pos + 1 ) ] ; } } | Splits class name to namespace and class name |
10,240 | public function getParameter ( $ key , $ default = null ) { $ value = $ this -> getUrl ( ) -> getQuery ( ) -> get ( $ key ) ; if ( $ value === null ) { $ value = $ this -> getData ( ) -> get ( $ key , $ default ) ; } return $ value ; } | Retrieve a value from url query or message body . |
10,241 | protected function setDefaults ( ) { if ( $ this -> getAccept ( ) === null ) { $ this -> setDefaultAccept ( ) ; } if ( $ this -> getContentType ( ) === null ) { $ this -> setDefaultContentType ( ) ; } } | Use this as hook to extend your custom request . |
10,242 | public function getImports ( ) { $ imports = [ ] ; $ tokens = token_get_all ( file_get_contents ( $ this -> file ) ) ; reset ( $ tokens ) ; $ token = '' ; while ( $ token !== false ) { $ token = next ( $ tokens ) ; if ( ! is_array ( $ token ) ) { continue ; } if ( $ token [ 0 ] === T_USE ) { $ stmt = $ this -> parseUse... | Gets all imported classes |
10,243 | public function compile ( Buffer $ buffer ) { parent :: compile ( $ buffer ) ; if ( substr ( $ this -> getName ( ) , 0 , 1 ) !== '_' ) { $ buffer -> writeln ( 'try {' ) -> indent ( 1 ) -> writeln ( '$z->addCommand(' ) -> indent ( 1 ) -> write ( 'new \Zicht\Tool\Command\TaskCommand(' ) -> asPhp ( $ this -> getName ( ) )... | Compiles the task initialization code into the buffer . |
10,244 | public function execute ( ProjectDescriptor $ project ) { $ rootPackageDescriptor = new PackageDescriptor ( ) ; $ rootPackageDescriptor -> setName ( '\\' ) ; $ project -> getIndexes ( ) -> set ( 'packages' , new Collection ( ) ) ; $ project -> getIndexes ( ) -> packages [ '\\' ] = $ rootPackageDescriptor ; foreach ( $ ... | Compiles a packages index on the project and create all Package Descriptors necessary . |
10,245 | protected function addElementsOfTypeToPackage ( ProjectDescriptor $ project , array $ elements , $ type ) { foreach ( $ elements as $ element ) { $ packageName = '' ; $ packageTags = $ element -> getTags ( ) -> get ( 'package' ) ; if ( $ packageTags instanceof Collection ) { $ packageTag = $ packageTags -> getIterator ... | Adds the given elements of a specific type to their respective Package Descriptors . |
10,246 | private function requiresTfa ( ResponseInterface $ response ) { return substr ( $ response -> getStatusCode ( ) , 0 , 1 ) === '4' && $ response -> hasHeader ( self :: TFA_HEADER ) ; } | Check whether the response requires two - factor authentication . |
10,247 | public function unsetCookie ( $ name , $ path = '/' ) { setcookie ( $ name , '' , time ( ) - 86400 , '/' , '' , 0 ) ; if ( isset ( $ _COOKIE ) && isset ( $ _COOKIE [ $ name ] ) ) { unset ( $ _COOKIE [ $ name ] ) ; } if ( isset ( $ this -> request -> cookie [ $ name ] ) ) { unset ( $ this -> request -> cookie [ $ name ]... | Unsets a cookie value by setting it to expire |
10,248 | public function sendError ( $ error_num , $ err_str = '' ) { if ( empty ( $ err_str ) ) { switch ( $ error_num ) { case 400 : $ err_str = 'Bad Request' ; break ; case 401 : $ err_str = 'Unauthorized' ; break ; case 403 : $ err_str = 'Forbidden' ; break ; case 404 : $ err_str = 'Not Found' ; break ; case 405 : $ err_str... | Send an http error header |
10,249 | public function requireBasicAuth ( $ check_auth = '' , $ realm = 'Please enter your username and password' ) { $ authorized = false ; if ( ! isset ( $ _SERVER [ 'PHP_AUTH_USER' ] ) ) { header ( 'WWW-Authenticate: Basic realm="' . $ realm . '"' ) ; header ( 'HTTP/1.0 401 Unauthorized' ) ; echo 'You must authenticate to ... | Added option for requesting basic auth . ONLY USE OVER SSL |
10,250 | public function autoload ( array $ autoloads , $ provider , $ options = [ ] ) { foreach ( $ autoloads as $ name => $ alias ) { if ( is_int ( $ name ) ) { $ name = $ alias ; } if ( empty ( $ name ) ) { throw new \ InvalidArgumentException ( "Cannot not autoload empty service" ) ; } if ( ! empty ( $ options [ 'prefix' ] ... | mark autoload service definition from service provider |
10,251 | public function load ( $ provider , $ options = null ) { if ( ! is_object ( $ provider ) ) { $ provider = $ this -> getShared ( $ provider ) ; } $ names = $ provider -> getNames ( ) ; if ( isset ( $ options [ 'aliases' ] ) ) { $ services = $ this -> createServiceAliases ( $ names , $ options [ 'aliases' ] ) ; unset ( $... | load all service definition from service provider |
10,252 | private static function get_file ( ) : string { if ( null === self :: $ path ) { if ( \ defined ( 'BBN_DATA_PATH' ) ) { self :: $ path = BBN_DATA_PATH ; } else { self :: $ path = __DIR__ . '/' ; } } return self :: $ path . 'plugins/appui-cron/appui-observer.txt' ; } | Returns the observer txt file s full path . |
10,253 | private function _get_id ( string $ request , $ params ) : ? string { if ( $ this -> check ( ) ) { if ( $ params ) { return $ this -> db -> select_one ( 'bbn_observers' , 'id' , [ 'id_string' => $ this -> _get_id_string ( $ request , $ params ) ] ) ; } return $ this -> db -> get_one ( " SELECT id FROM bbn... | Returns the ID of an observer with public = 1 and with similar request and params . |
10,254 | private function _get_id_from_user ( string $ request , $ params ) : ? string { if ( $ this -> id_user && $ this -> check ( ) ) { $ sql = ' SELECT `o`.`id` FROM bbn_observers AS `o` LEFT JOIN bbn_observers AS `ro` ON `o`.`id_alias` = `ro`.`id` WHERE `o`.`id_user` = ? AND ... | Returns the ID of an observer for the current user and with similar request and params . |
10,255 | private function _update_next ( $ id ) : bool { $ id_alias = $ this -> db -> select_one ( 'bbn_observers' , 'id_alias' , [ 'id' => $ id ] ) ; return $ this -> db -> query ( <<<MYSQL UPDATE bbn_observers SET next = NOW() + INTERVAL frequency SECOND WHERE id = ?MYSQL , hex2bin ( $ id_alias ? : $ id ) ) ? t... | Sets the time of next execution in the observer s main row . |
10,256 | public function check_result ( $ id ) { if ( $ d = $ this -> get ( $ id ) ) { $ t = new bbn \ util \ timer ( ) ; $ t -> start ( ) ; $ res = $ this -> _exec ( $ d [ 'request' ] , $ d [ 'params' ] ) ; $ duration = ( int ) ceil ( $ t -> stop ( ) * 1000 ) ; if ( $ res !== $ d [ 'result' ] ) { $ this -> db -> update ( 'bbn_... | Confronts the current result with the one kept in database . |
10,257 | public function add ( array $ cfg ) : ? string { if ( $ this -> id_user && ( null !== $ cfg [ 'request' ] ) && $ this -> check ( ) ) { $ t = new bbn \ util \ timer ( ) ; $ t -> start ( ) ; if ( is_string ( $ cfg [ 'request' ] ) ) { $ params = self :: sanitize_params ( $ cfg [ 'params' ] ?? [ ] ) ; $ request = trim ( $ ... | Adds a new observer and returns its id or the id of an existing one . |
10,258 | public function user_delete ( $ id ) : int { if ( property_exists ( $ this , 'user' ) && $ this -> check ( ) ) { return $ this -> db -> delete ( 'bbn_observers' , [ 'id' => $ id , 'id_user' => $ this -> user ] ) ; } return 0 ; } | Deletes the given observer for the current user |
10,259 | protected function applyFormats ( $ data ) { if ( $ this -> getOptions ( ) -> getOutputFormatters ( ) ) { foreach ( $ this -> getOptions ( ) -> getOutputFormatters ( ) as $ formatter ) { if ( $ formatter instanceof FormatterInterface ) { $ data = $ formatter -> format ( $ data ) ; } elseif ( is_callable ( $ formatter )... | Apply formatter using the formatters in the order they were defined |
10,260 | public function redirectToRoute ( $ route , array $ parameters = [ ] , $ status = 302 ) { return new RedirectResponse ( $ this [ 'url_generator' ] -> generate ( $ route , $ parameters ) , $ status ) ; } | Redirects the user to route with the given parameters . |
10,261 | public function forward ( $ uri , $ method , array $ parameters = [ ] ) { $ request = Request :: create ( $ uri , $ method , $ parameters ) ; return $ this -> handle ( $ request , HttpKernelInterface :: SUB_REQUEST ) ; } | Forward the request to another controller by the URI . |
10,262 | public function forwardToRoute ( $ route , $ method , array $ parameters = [ ] ) { return $ this -> forward ( $ this [ 'url_generator' ] -> generate ( $ route , $ parameters ) , $ method ) ; } | Forward the request to another controller by the route name . |
10,263 | private function fixControlStructure ( Tokens $ tokens , $ index ) { if ( ! $ tokens [ $ index - 1 ] -> isWhitespace ( ) || $ tokens [ $ index - 1 ] -> isWhitespace ( $ this -> singleLineWhitespaceOptions ) ) { $ tokens -> ensureWhitespaceAtIndex ( $ index - 1 , 1 , ' ' ) ; } } | Fixes whitespaces around braces of a control structure . |
10,264 | private function getControlStructureTokens ( ) { static $ tokens = null ; if ( null === $ tokens ) { $ tokens = [ T_IF , T_ELSEIF , T_FOR , T_FOREACH , T_WHILE , T_DO , T_CATCH , T_SWITCH , T_DECLARE , ] ; } return $ tokens ; } | Gets the name of control structure tokens . |
10,265 | public function addTab ( $ tabId , $ tab ) { parent :: addTab ( $ tabId , $ tab ) ; if ( $ this -> _tabs [ $ tabId ] instanceof Mage_Core_Block_Abstract && $ this -> _tabs [ $ tabId ] -> getParentBlock ( ) === null ) { $ this -> append ( $ this -> _tabs [ $ tabId ] ) ; } return $ this ; } | Add new tab |
10,266 | public function buildSourceTableMigration ( $ name ) { $ path = $ this -> getMigrationPath ( $ name ) ; $ migration = $ this -> getTableMigrationName ( $ name ) ; $ contents = view ( '_hierarchy::migrations.table' , [ 'table' => source_table_name ( $ name ) , 'migration' => $ migration ] ) -> render ( ) ; $ this -> wri... | Builds a source table migration |
10,267 | public function destroySourceTableMigration ( $ name , array $ fields ) { $ path = $ this -> getMigrationPath ( $ name ) ; $ this -> delete ( $ path ) ; foreach ( $ fields as $ field ) { $ this -> destroyFieldMigrationForTable ( $ field , $ name ) ; } } | Destroy a source table migration |
10,268 | public function buildFieldMigrationForTable ( $ name , $ type , $ indexed , $ tableName ) { $ path = $ this -> getMigrationPath ( $ tableName , $ name ) ; $ migration = $ this -> getTableFieldMigrationName ( $ name , $ tableName ) ; $ contents = view ( '_hierarchy::migrations.field' , [ 'field' => $ name , 'table' => s... | Builds a field migration for a table |
10,269 | public function destroyFieldMigrationForTable ( $ name , $ tableName ) { $ path = $ this -> getMigrationPath ( $ tableName , $ name ) ; $ this -> delete ( $ path ) ; } | Destroys a field migration for a table |
10,270 | public function getTableFieldMigrationName ( $ name , $ tableName ) { return sprintf ( MigrationBuilder :: PATTERN_FIELD , ucfirst ( $ name ) , ucfirst ( $ tableName ) ) ; } | Returns the migration name for a field in table |
10,271 | public function getMigrationPath ( $ table , $ field = null ) { $ name = is_null ( $ field ) ? $ this -> getTableMigrationName ( $ table ) : $ this -> getTableFieldMigrationName ( $ field , $ table ) ; return sprintf ( $ this -> getBasePath ( ) . '/%s.php' , $ name ) ; } | Returns the path for the migration |
10,272 | public function getMigrationClassPathByKey ( $ table , $ field = null ) { $ name = is_null ( $ field ) ? $ this -> getTableMigrationName ( $ table ) : $ this -> getTableFieldMigrationName ( $ field , $ table ) ; return $ this -> getMigrationClassPath ( $ name ) ; } | Returns the migration class path by key |
10,273 | public function getColumnType ( $ type ) { if ( array_key_exists ( $ type , $ this -> typeMap ) ) { return $ this -> typeMap [ $ type ] ; } return $ this -> defaultType ; } | Returns the column type for key |
10,274 | public function addPrefix ( $ prefix , $ paths ) { if ( ! $ prefix ) { foreach ( ( array ) $ paths as $ path ) { $ this -> fallbackDirs [ ] = $ path ; } return ; } if ( isset ( $ this -> prefixes [ $ prefix ] ) ) { $ this -> prefixes [ $ prefix ] = array_merge ( $ this -> prefixes [ $ prefix ] , ( array ) $ paths ) ; }... | Registers a set of classes |
10,275 | public function findPackages ( $ name , $ version ) { $ packages = array ( ) ; foreach ( $ this -> repositories as $ repository ) { $ packages = array_merge ( $ packages , $ repository -> findPackages ( $ name , $ version ) ) ; } return $ packages ; } | Searches for all packages matching a name and optionally a version in managed repositories . |
10,276 | public function createRepository ( $ type , $ config ) { if ( ! isset ( $ this -> repositoryClasses [ $ type ] ) ) { throw new \ InvalidArgumentException ( 'Repository type is not registered: ' . $ type ) ; } $ class = $ this -> repositoryClasses [ $ type ] ; return new $ class ( $ config , $ this -> io , $ this -> con... | Returns a new repository for a specific installation type . |
10,277 | public function actionIndex ( ) { $ searchModel = Yii :: createObject ( AuthenticationSearch :: className ( ) ) ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> get ( ) ) ; return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ] ) ; } | Lists all Authentication models . |
10,278 | public function resolve ( $ toResolve ) { if ( \ is_callable ( $ toResolve ) ) { return $ toResolve ; } if ( ! \ is_string ( $ toResolve ) ) { $ this -> assertCallable ( $ toResolve ) ; } if ( preg_match ( self :: CALLABLE_PATTERN , $ toResolve , $ matches ) ) { $ resolved = $ this -> resolveCallable ( $ matches [ 1 ] ... | Resolve toResolve into a closure that that the router can dispatch . |
10,279 | protected function respondTransformer ( $ data , $ code , TransformerAbstract $ transformer , array $ headers = [ ] ) { if ( $ data === null ) { return $ this -> respond ( [ 'data' => [ ] ] , $ code , $ headers ) ; } if ( $ data instanceof LengthAwarePaginator ) { $ resource = new Collection ( $ data -> items ( ) , $ t... | Return transformed response in json format |
10,280 | protected function respondWithSuccess ( $ data , TransformerAbstract $ transformer = null , array $ headers = [ ] ) { if ( $ transformer ) { return $ this -> respondTransformer ( $ data , SymfonyResponse :: HTTP_OK , $ transformer , $ headers ) ; } return $ this -> respondWithSimpleSuccess ( $ data ) ; } | Return success response in json format |
10,281 | protected function respondWithError ( $ message = 'Bad Request' , $ code = SymfonyResponse :: HTTP_BAD_REQUEST , array $ headers = [ ] ) { return abort ( $ code , $ message , $ headers ) ; } | Return server error response in json format |
10,282 | final protected function next ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { if ( $ this -> _next ) { return $ this -> _next -> process ( $ request , $ handler ) ; } return $ handler -> handle ( $ request ) ; } | Pass request to the next middleware . If there are no next middleware it will pass the request to the handler |
10,283 | public function parse ( $ currentRoute , $ permit ) { $ route = $ permit [ 'route' ] ; $ count = count ( $ route ) ; if ( $ count == 0 ) { return false ; } foreach ( $ route as $ key => $ value ) { if ( isset ( $ currentRoute [ $ key ] ) ) { $ values = ( is_array ( $ value ) ) ? $ value : array ( $ value ) ; foreach ( ... | Parses the passed route against a rule |
10,284 | public function execute ( $ route , $ title , $ url = null , $ options = array ( ) , $ confirmMessage = false ) { if ( empty ( $ route [ 'rules' ] ) ) { return $ this -> Html -> link ( $ title , $ url , $ options , $ confirmMessage ) ; } if ( isset ( $ route [ 'rules' ] [ 'deny' ] ) ) { return ( $ route [ 'rules' ] [ '... | Executes the route based on it s rules |
10,285 | public function store ( $ id , $ data , $ attributes = array ( ) ) { $ metaStorage = $ this -> getMetaDataStorage ( ) ; $ metaStorage -> lock ( ) ; $ metaData = $ this -> getMetaData ( $ metaStorage ) ; foreach ( $ this -> storageStack as $ storageConf ) { call_user_func ( array ( $ this -> properties [ 'options' ] -> ... | Stores data in the cache stack . |
10,286 | private function getMetaData ( ezcCacheStackMetaDataStorage $ metaStorage ) { $ metaData = $ metaStorage -> restoreMetaData ( ) ; if ( $ metaData === null ) { $ metaData = call_user_func ( array ( $ this -> properties [ 'options' ] -> replacementStrategy , 'createMetaData' ) ) ; } return $ metaData ; } | Returns the meta data to use . |
10,287 | public function restore ( $ id , $ attributes = array ( ) , $ search = false ) { $ metaStorage = $ this -> getMetaDataStorage ( ) ; $ metaStorage -> lock ( ) ; $ metaData = $ this -> getMetaData ( $ metaStorage ) ; $ item = false ; foreach ( $ this -> storageStack as $ storageConf ) { $ item = call_user_func ( array ( ... | Restores an item from the stack . |
10,288 | public function delete ( $ id = null , $ attributes = array ( ) , $ search = false ) { $ metaStorage = $ this -> getMetaDataStorage ( ) ; $ metaStorage -> lock ( ) ; $ metaData = $ metaStorage -> restoreMetaData ( ) ; $ deletedIds = array ( ) ; foreach ( $ this -> storageStack as $ storageConf ) { $ deletedIds = array_... | Deletes an item from the stack . |
10,289 | private function getMetaDataStorage ( ) { $ metaStorage = $ this -> options -> metaStorage ; if ( $ metaStorage === null ) { $ metaStorage = reset ( $ this -> storageStack ) -> storage ; if ( ! ( $ metaStorage instanceof ezcCacheStackMetaDataStorage ) ) { throw new ezcBaseValueException ( 'metaStorage' , $ metaStorage ... | Returns the meta data storage to be used . |
10,290 | public function countDataItems ( $ id = null , $ attributes = array ( ) ) { $ sum = 0 ; foreach ( $ this -> storageStack as $ storageConf ) { $ sum += $ storageConf -> storage -> countDataItems ( $ id , $ attributes ) ; } return $ sum ; } | Counts how many items are stored fulfilling certain criteria . |
10,291 | public function getRemainingLifetime ( $ id , $ attributes = array ( ) ) { foreach ( $ this -> storageStack as $ storageConf ) { $ lifetime = $ storageConf -> storage -> getRemainingLifetime ( $ id , $ attributes ) ; if ( $ lifetime > 0 ) { return $ lifetime ; } } return 0 ; } | Returns the remaining lifetime for the given item ID . |
10,292 | public function pushStorage ( ezcCacheStackStorageConfiguration $ storageConf ) { if ( isset ( $ this -> storageIdMap [ $ storageConf -> id ] ) ) { throw new ezcCacheStackIdAlreadyUsedException ( $ storageConf -> id ) ; } if ( in_array ( $ storageConf -> storage , $ this -> storageIdMap , true ) ) { throw new ezcCacheS... | Add a storage to the top of the stack . |
10,293 | public function popStorage ( ) { if ( count ( $ this -> storageStack ) === 0 ) { throw new ezcCacheStackUnderflowException ( ) ; } $ storageConf = array_shift ( $ this -> storageStack ) ; unset ( $ this -> storageIdMap [ $ storageConf -> id ] ) ; return $ storageConf ; } | Removes a storage from the top of the stack . |
10,294 | public function create_request ( $ par_array ) { $ request = $ this -> addChild ( $ this -> doc -> documentElement , "request" , $ this -> request_url ( ) ) ; foreach ( $ par_array as $ key => $ value ) { $ request -> setAttribute ( $ key , $ value ) ; } } | Create an OAI request node . |
10,295 | public function create_resumpToken ( $ token , $ expirationdatetime , $ num_rows , $ cursor = null ) { $ resump_node = $ this -> addChild ( $ this -> verbNode , "resumptionToken" , $ token ) ; if ( isset ( $ expirationdatetime ) ) { $ resump_node -> setAttribute ( "expirationDate" , $ expirationdatetime ) ; } $ resump_... | If there are too many records request could not finished a resumpToken is generated to let harvester know |
10,296 | public function detectAccessDenied ( MvcEvent $ event ) { $ response = $ event -> getResponse ( ) ; if ( $ response -> getStatusCode ( ) == 403 ) { $ event -> setError ( 'Access Denied' ) ; $ event -> stopPropagation ( true ) ; } } | If response status code is 403 set error state and stop event propagation |
10,297 | public function injectAccessDeniedViewModel ( MvcEvent $ event ) { $ this -> config ( $ event ) ; $ result = $ event -> getResult ( ) ; if ( $ result instanceof ResponseInterface ) { return ; } $ response = $ event -> getResponse ( ) ; if ( $ response -> getStatusCode ( ) != 403 ) { return ; } $ model = new ViewModel (... | Inject access denied View Model is response status is 403 |
10,298 | protected function config ( MvcEvent $ event ) { $ appConfig = $ event -> getApplication ( ) -> getServiceManager ( ) -> get ( 'config' ) ; $ config = array_key_exists ( self :: CONFIG_KEY , $ appConfig ) ? $ appConfig [ self :: CONFIG_KEY ] : array ( ) ; if ( array_key_exists ( 'template' , $ config ) ) { $ this -> se... | Set configuration options from application configuration |
10,299 | public static function keyValue ( $ list , $ keyProperty = null , $ valueProperty = null ) { $ index = array ( ) ; foreach ( $ list as $ i ) { if ( $ keyProperty ) { if ( ! $ valueProperty ) { throw new \ InvalidArgumentException ( "Must set value property if setting key property" ) ; } $ index [ $ i -> $ keyProperty ]... | Create a one - dimensional associative array from a list of objects or a list of 2 - tuples . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.