idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
5,700 | public function save ( $ fields = null ) { $ settings = static :: _model ( ) ; if ( is_null ( $ fields ) ) { $ fields = array_keys ( $ settings [ 'defaults' ] ) ; } elseif ( ! is_array ( $ fields ) ) { $ fields = array ( $ fields ) ; } $ pkey = $ this -> _data_store [ $ settings [ 'primary_key' ] ] ; $ data = array ( )... | save an model |
5,701 | public function delete ( ) { $ settings = static :: _model ( ) ; $ result = DB :: delete ( $ settings [ 'table' ] ) -> where ( $ settings [ 'primary_key' ] , $ this -> _data_store [ $ settings [ 'primary_key' ] ] ) -> limit ( 1 ) -> run ( $ settings [ 'handler' ] ) ; $ this -> _data_store [ $ cache [ 'primary_key' ] ] ... | Delete the current model from the database |
5,702 | public function navigation ( ) { if ( $ this -> validCache ( $ this -> nav ) ) { $ value = $ this -> nav ; } else { $ value = $ this -> getCache ( ) ; if ( ! $ this -> validCache ( $ value ) ) { $ value = $ this -> sendGet ( ) ; $ this -> setCache ( $ value ) ; } } $ this -> nav = $ value ; return $ value ; } | Get the page navigation . |
5,703 | protected function validCache ( $ value ) { if ( is_null ( $ value ) || ! is_array ( $ value ) || empty ( $ value ) ) { return false ; } return true ; } | Check of the nav var is not corrupt . |
5,704 | public function renderCommand ( $ reference = null ) { $ references = $ reference !== null ? [ $ reference ] : array_keys ( $ this -> settings [ 'commandReferences' ] ) ; $ this -> renderReferences ( $ references ) ; } | Renders command reference documentation from source code . |
5,705 | protected function renderReferences ( $ references ) { foreach ( $ references as $ reference ) { $ this -> outputLine ( 'Rendering Reference "%s"' , [ $ reference ] ) ; $ this -> renderReference ( $ reference ) ; } } | Render a set of CLI command references to reStructuredText . |
5,706 | private function createCreateForm ( Scope $ scope ) { $ form = $ this -> createForm ( new ScopeType ( ) , $ scope , array ( 'action' => $ this -> generateUrl ( 'admin_scope_create' ) , 'method' => 'POST' , ) ) ; $ form -> add ( 'submit' , 'submit' , array ( 'label' => 'Create' ) ) ; return $ form ; } | Creates a form to create a Scope entity . |
5,707 | public function newAction ( ) { $ scope = new Scope ( ) ; $ form = $ this -> createCreateForm ( $ scope ) ; return $ this -> render ( 'ChillMainBundle:Scope:new.html.twig' , array ( 'entity' => $ scope , 'form' => $ form -> createView ( ) , ) ) ; } | Displays a form to create a new Scope entity . |
5,708 | private function createEditForm ( Scope $ scope ) { $ form = $ this -> createForm ( new ScopeType ( ) , $ scope , array ( 'action' => $ this -> generateUrl ( 'admin_scope_update' , array ( 'id' => $ scope -> getId ( ) ) ) , 'method' => 'PUT' , ) ) ; $ form -> add ( 'submit' , 'submit' , array ( 'label' => 'Update' ) ) ... | Creates a form to edit a Scope entity . |
5,709 | protected function fileMatchesMoreSpecificExtension ( string $ filename , string $ extension ) : bool { return array_reduce ( $ this -> extensions , function ( $ match , $ compare ) use ( $ filename , $ extension ) { if ( $ match || $ compare === $ extension || strlen ( $ compare ) < strlen ( $ extension ) ) { return $... | Determines if a file matches another more specific extension |
5,710 | protected function mergeConfigs ( array $ old , array $ new ) : array { foreach ( $ new as $ key => $ val ) { if ( ! array_key_exists ( $ key , $ old ) || ! is_array ( $ old [ $ key ] ) || ! is_array ( $ val ) ) { $ old [ $ key ] = $ val ; continue ; } if ( is_int ( $ key ) ) { $ old [ ] = $ val ; continue ; } $ old [ ... | Recusively merges configs together |
5,711 | public static function getMappings ( ) { $ basePath = self :: getBasePath ( ) ; return array ( realpath ( $ basePath . 'Address/Resources/config/doctrine/model' ) => 'LMammino\EFoundation\Address\Model' , realpath ( $ basePath . 'Attribute/Resources/config/doctrine/model' ) => 'LMammino\EFoundation\Attribute\Model' , r... | Get the mapping |
5,712 | public function PrimaryImage ( ) { $ image = $ this -> owner -> Image ( ) ; if ( $ image -> exists ( ) ) { return $ image ; } $ product = $ this -> owner -> AllProducts ( ) -> first ( ) ; if ( ! empty ( $ product ) ) { return $ product -> PrimaryImage ( ) ; } return Helper :: generate_no_image ( ) ; } | Gets the main image to use for this category this can either be the selected image an image from the first product or the default no - product image . |
5,713 | public static function decode ( ResponseInterface $ response ) : array { $ contents = $ response -> getBody ( ) -> getContents ( ) ; $ decoded = json_decode ( $ contents , true ) ; $ response -> getBody ( ) -> rewind ( ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE || ! is_array ( $ decoded ) ) { throw new JsonExcept... | Json decode an http response . |
5,714 | public function addQuery ( DBUtilQuery $ query ) { if ( $ query -> getName ( ) !== null ) { $ this -> _queryQueue [ $ query -> getName ( ) ] = $ query ; } else { $ this -> _queryQueue [ ] = $ query ; } new Logger ( 'Query added to the queue.' , Logger :: DEBUG , __CLASS__ , __LINE__ ) ; return $ this ; } | Adds a query with it s parameters to the query queue . |
5,715 | public function addQueries ( $ queries ) { if ( is_array ( $ queries ) ) { foreach ( $ queries as $ query ) { $ this -> addQuery ( $ query ) ; } new Logger ( 'Queries added to the queue.' , Logger :: DEBUG , __CLASS__ , __LINE__ ) ; return $ this ; } new Logger ( 'Failed to add to the queue.' , Logger :: ERROR , __CLAS... | Add an array of DBUtilQuery s to the query_queue . |
5,716 | public function add_error ( $ key , $ message ) { $ this -> success = false ; $ this -> errors [ $ key ] [ ] = $ message ; } | Add an error to validator |
5,717 | public function label ( $ data , $ value = null ) { if ( ! is_null ( $ value ) && ! is_array ( $ data ) ) { $ data = array ( $ data => $ value ) ; } if ( ! is_array ( $ data ) ) { throw new \ InvalidArgumentException ( 'CCValidator::label - invalid label data given' ) ; } $ this -> labels = array_merge ( $ this -> labe... | Set a data value |
5,718 | public function rules ( ) { $ args = func_get_args ( ) ; $ key = array_shift ( $ args ) ; if ( ! is_array ( reset ( $ args ) ) ) { $ rules = $ args ; } else { $ rules = array_shift ( $ args ) ; } $ success = true ; foreach ( $ rules as $ rule ) { $ rule = explode ( ':' , $ rule ) ; $ params = array ( ) ; if ( array_key... | Apply multiple rules to one attribute |
5,719 | public function message ( ) { $ params = func_get_args ( ) ; $ message = array_shift ( $ params ) ; $ method = array_shift ( $ params ) ; if ( ! $ result = $ this -> validate ( $ method , $ params ) ) { $ key = array_shift ( $ params ) ; $ params = $ this -> get_error_message_params ( $ key , $ params ) ; foreach ( $ p... | Run the validation with a custom message |
5,720 | protected function validate ( $ method , $ params ) { $ reverse = false ; if ( substr ( $ method , 0 , 4 ) === 'not_' ) { $ reverse = true ; $ method = substr ( $ method , 4 ) ; } if ( array_key_exists ( $ method , static :: $ rules ) ) { return $ this -> apply_rule ( $ method , static :: $ rules [ $ method ] , $ param... | Run an validation call |
5,721 | protected function proof_result ( $ rule , $ key , $ result ) { if ( $ result === false ) { $ this -> failed [ $ key ] [ ] = $ rule ; } if ( $ this -> success === true ) { return $ this -> success = $ result ; } return $ result ; } | Proof a single result and update the success property |
5,722 | protected function apply_rule ( $ rule , $ callback , $ params , $ reverse ) { $ data_key = array_shift ( $ params ) ; if ( ! array_key_exists ( $ data_key , $ this -> data ) ) { return $ this -> proof_result ( $ rule , $ data_key , ( $ reverse ? true : false ) ) ; } $ call_arguments = array ( $ data_key , $ this -> da... | Apply an rule executes the rule and runs the result proof |
5,723 | protected function get_error_message_params ( $ key , $ params ) { if ( isset ( $ this -> labels [ $ key ] ) ) { $ field = $ this -> labels [ $ key ] ; } else { $ field = ucfirst ( str_replace ( array ( '_' , '-' ) , ' ' , $ key ) ) ; } return array_merge ( array ( 'field' => $ field ) , $ params ) ; } | Get the parameter array for the error messages |
5,724 | protected function generate_error_message ( $ rule , $ key , $ params ) { $ params = $ this -> get_error_message_params ( $ key , $ params ) ; return __ ( ClanCats :: $ config -> get ( 'validation.language_prefix' ) . '.' . $ rule , $ params ) ; } | Generate the error message for an rule |
5,725 | public function rule_required ( $ key , $ value ) { if ( is_null ( $ value ) ) { return false ; } elseif ( is_string ( $ value ) && trim ( $ value ) == '' ) { return false ; } return true ; } | Check if the field is set an not empty |
5,726 | public function rule_between_num ( $ key , $ value , $ min , $ max ) { if ( ! $ this -> rule_min_num ( $ key , $ value , $ min ) ) { return false ; } if ( ! $ this -> rule_max_num ( $ key , $ value , $ max ) ) { return false ; } return true ; } | Is the given number between min and max |
5,727 | public function rule_min ( $ key , $ value , $ min ) { return $ this -> rule_min_num ( $ key , strlen ( $ value ) , $ min ) ; } | Is the given string at least some size |
5,728 | public function rule_max ( $ key , $ value , $ max ) { return $ this -> rule_max_num ( $ key , strlen ( $ value ) , $ max ) ; } | Is the given string max some size |
5,729 | public function rule_between ( $ key , $ value , $ min , $ max ) { return $ this -> rule_between_num ( $ key , strlen ( $ value ) , $ min , $ max ) ; } | Is the given string between min and max |
5,730 | public function rule_date_format ( $ key , $ value , $ format = 'd/m/Y' ) { return date ( $ format , strtotime ( trim ( $ value ) ) ) == trim ( $ value ) ; } | Check if valid date format |
5,731 | protected function get ( $ data , string $ key ) { $ dot = $ data instanceof Dot ? $ data : new Dot ( $ data ) ; if ( isset ( $ dot [ $ key ] ) ) { return $ dot [ $ key ] ; } throw new UnexpectedResponseException ( sprintf ( 'Missing key \'%s\' in data' ) ) ; } | Extract data from an array using dot notation . Throws an exception when the provided key does not exist . |
5,732 | public function notify ( $ eventName , array $ params = array ( ) ) { $ this -> dispatcher -> notify ( $ e = $ this -> createEvent ( $ eventName , $ params ) ) ; return $ e ; } | Creates and dispatches an event |
5,733 | public function notifyUntil ( $ eventName , array $ params = array ( ) , $ callback = null ) { $ this -> dispatcher -> notifyUntil ( $ e = $ this -> createEvent ( $ eventName , $ params ) , $ callback ) ; return $ e ; } | Creates and dispatches an event until it has been processed . |
5,734 | public static function make ( Client $ httpClient , array $ params = [ ] ) { $ instance = new static ( $ httpClient ) ; $ instance -> configure ( $ params ) ; return $ instance ; } | Create a new resource instance . |
5,735 | public function send ( ) { $ request = $ this -> createRequest ( ) ; $ response = $ this -> httpClient -> sendRequest ( $ request ) ; return $ this -> mapResponse ( ( array ) $ this -> parseResponse ( $ response ) ) ; } | Send a new request . |
5,736 | public function getPreparedData ( ) { $ params = $ this -> getData ( ) ; if ( $ this -> authorize ) { $ params = array_merge ( $ params , $ this -> authenticationData ( $ params ) ) ; } return $ params ; } | Get the request data for authorized or not . |
5,737 | public function __isset ( $ name ) { if ( $ this -> thawedObject === null ) { if ( $ name === $ this -> storage -> getFreezer ( ) -> getIdProperty ( ) ) { return true ; } } return isset ( $ this -> replaceProxy ( 2 ) -> { $ name } ) ; } | Delegates the property isset check to the real object and tries to replace the lazy proxy object with it . |
5,738 | protected function replaceProxy ( $ offset ) { $ object = $ this -> getObject ( ) ; $ trace = debug_backtrace ( ) ; if ( isset ( $ trace [ $ offset ] [ 'object' ] ) ) { $ reflector = new \ ReflectionObject ( $ trace [ $ offset ] [ 'object' ] ) ; foreach ( $ reflector -> getProperties ( ) as $ property ) { $ property ->... | Tries to replace the lazy proxy object with the real object . |
5,739 | public function newVar ( $ str ) { $ str = trim ( $ str ) ; if ( preg_match ( '/^[a-zA-Z0-9\'_][a-zA-Z0-9\'_-]*$/' , $ str ) ) return new Atom ( EXPR_VAR , $ str ) ; else { return false ; } } | Creates a new variable atom subsequent to validating that the string is correct for a variable |
5,740 | protected static function buildExecutionContext ( Schema $ schema , $ root , Document $ ast , $ operationName = NULL , array $ args = NULL , & $ errors ) { $ operations = [ ] ; $ fragments = [ ] ; foreach ( $ ast -> get ( 'definitions' ) as $ statement ) { switch ( $ statement :: KIND ) { case Node :: KIND_OPERATION_DE... | Constructs a ExecutionContext object from the arguments passed to execute which we will pass throughout the other execution methods . |
5,741 | protected static function executeOperation ( ExecutionContext $ context , $ root , OperationDefinition $ operation ) { $ type = self :: getOperationRootType ( $ context -> schema , $ operation ) ; $ fields = self :: collectFields ( $ context , $ type , $ operation -> get ( 'selectionSet' ) , new \ ArrayObject ( ) , new... | Implements the Evaluating operations section of the spec . |
5,742 | protected static function getOperationRootType ( Schema $ schema , OperationDefinition $ operation ) { switch ( $ operation -> get ( 'operation' ) ) { case 'query' : return $ schema -> getQueryType ( ) ; case 'mutation' : $ mutationType = $ schema -> getMutationType ( ) ; if ( ! $ mutationType ) { throw new \ Exception... | Extracts the root type of the operation from the schema . |
5,743 | protected static function executeFieldsSerially ( ExecutionContext $ context , ObjectType $ parent , $ source , $ fields ) { $ results = [ ] ; foreach ( $ fields as $ response => $ asts ) { $ result = self :: resolveField ( $ context , $ parent , $ source , $ asts ) ; if ( $ result !== self :: $ UNDEFINED ) { $ results... | Implements the Evaluating selection sets section of the spec for write mode . |
5,744 | protected static function executeFields ( ExecutionContext $ context , ObjectType $ parent , $ source , $ fields ) { return self :: executeFieldsSerially ( $ context , $ parent , $ source , $ fields ) ; } | Implements the Evaluating selection sets section of the spec for read mode . |
5,745 | protected static function collectFields ( ExecutionContext $ context , ObjectType $ type , SelectionSet $ set , $ fields , $ visited ) { $ count = count ( $ set -> get ( 'selections' ) ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ selection = $ set -> get ( 'selections' ) [ $ i ] ; switch ( $ selection :: KIND ) { c... | Given a selectionSet adds all of the fields in that selection to the passed in map of fields and returns it at the end . |
5,746 | protected static function shouldIncludeNode ( ExecutionContext $ exeContext , $ directives ) { $ skip = Directive :: skipDirective ( ) ; $ include = Directive :: includeDirective ( ) ; foreach ( $ directives as $ directive ) { if ( $ directive -> get ( 'name' ) -> get ( 'value' ) === $ skip -> getName ( ) ) { $ values ... | Determines if a field should be included based on |
5,747 | protected static function doesFragmentConditionMatch ( ExecutionContext $ context , $ fragment , ObjectType $ type ) { $ typeCondition = $ fragment -> get ( 'typeCondition' ) ; if ( ! $ typeCondition ) { return TRUE ; } $ conditionalType = TypeInfo :: typeFromAST ( $ context -> schema , $ typeCondition ) ; if ( $ condi... | Determines if a fragment is applicable to the given type . |
5,748 | protected static function getFieldEntryKey ( Field $ node ) { return $ node -> get ( 'alias' ) ? $ node -> get ( 'alias' ) -> get ( 'value' ) : $ node -> get ( 'name' ) -> get ( 'value' ) ; } | Implements the logic to compute the key of a given field s entry |
5,749 | protected static function resolveField ( ExecutionContext $ context , ObjectType $ parent , $ source , $ asts ) { $ definition = self :: getFieldDefinition ( $ context -> schema , $ parent , $ asts [ 0 ] ) ; if ( ! $ definition ) { return self :: $ UNDEFINED ; } if ( $ definition -> getType ( ) instanceof NonNullModifi... | A wrapper function for resolving the field that catches the error and adds it to the context s global if the error is not rethrowable . |
5,750 | protected static function resolveFieldOrError ( ExecutionContext $ context , ObjectType $ parent , $ source , $ asts , FieldDefinition $ definition ) { $ ast = $ asts [ 0 ] ; $ type = $ definition -> getType ( ) ; $ resolver = $ definition -> getResolveCallback ( ) ? : [ __CLASS__ , 'defaultResolveFn' ] ; $ data = $ de... | Resolves the field on the given source object . |
5,751 | public static function defaultResolveFn ( $ source , $ args , $ root , $ ast ) { $ property = NULL ; $ key = $ ast -> get ( 'name' ) -> get ( 'value' ) ; if ( ( is_array ( $ source ) || $ source instanceof \ ArrayAccess ) && isset ( $ source [ $ key ] ) ) { $ property = $ source [ $ key ] ; } else if ( is_object ( $ so... | If a resolve function is not given then a default resolve behavior is used which takes the property of the source object of the same name as the field and returns it as the result or if it s a function returns the result of calling that function . |
5,752 | public function htmlEncode ( $ data ) { switch ( gettype ( $ data ) ) { case 'array' : foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> htmlEncode ( $ value ) ; } break ; case 'object' : $ data = clone $ data ; foreach ( $ data as $ key => $ value ) { $ data -> $ key = $ this -> htmlEncode ( $ valu... | Recursively make a value safe for HTML |
5,753 | public function htmlDecode ( $ data ) { switch ( gettype ( $ data ) ) { case 'array' : foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> htmlDecode ( $ value ) ; } break ; case 'object' : $ data = clone $ data ; foreach ( $ data as $ key => $ value ) { $ data -> $ key = $ this -> htmlDecode ( $ valu... | Recursively decode an HTML encoded value |
5,754 | public function get ( $ variable , $ htmlEncode = true ) { $ value = null ; if ( isset ( $ this -> variables [ $ variable ] ) ) { $ value = $ this -> variables [ $ variable ] [ $ htmlEncode ? 'safe' : 'unsafe' ] ; } return $ value ; } | Get a view variable |
5,755 | public function set ( $ variable , $ value = null ) { $ this -> variables [ $ variable ] = array ( 'safe' => $ this -> htmlEncode ( $ value ) , 'unsafe' => $ value ) ; return $ this ; } | Set a view variable |
5,756 | public function setVariables ( $ variables = [ ] ) { foreach ( $ variables as $ variable => $ value ) { $ this -> set ( $ variable , $ value ) ; } } | Set all variables |
5,757 | public function render ( $ file = '' ) { $ viewManager = $ this -> config -> get ( 'view_manager' ) ; if ( $ viewManager [ 'template_path_stack' ] ) { $ file = $ viewManager [ 'template_path_stack' ] . '/' . $ file ; } $ fileInfo = pathinfo ( $ file ) ; if ( ! isset ( $ fileInfo [ 'extension' ] ) || $ fileInfo [ 'exten... | Render a file |
5,758 | public function path ( ) { $ clean = function ( $ v ) { return str_replace ( '/' , '' , $ v ) ; } ; return join ( '/' , array_map ( $ clean , $ this -> groups ) ) ; } | Returns a complete path |
5,759 | public function unregister ( $ alias ) { unset ( $ this -> files [ $ alias ] ) ; $ key = array_search ( $ alias , $ this -> enqueued ) ; if ( $ key !== FALSE ) { unset ( $ this -> enqueued [ $ key ] ) ; } return $ this ; } | Entfernt eine registrierte Datei |
5,760 | public static function start ( $ key , $ attr = array ( ) ) { $ attributes = array ( ) ; $ attributes [ 'role' ] = 'form' ; if ( ! is_null ( $ key ) ) { static :: $ id_prefix = $ attributes [ 'id' ] = static :: form_id ( 'form' , $ key ) ; } $ attributes = array_merge ( $ attributes , $ attr ) ; return '<form' . HTML :... | Open a new form This will set the current form to this one |
5,761 | public static function capture ( $ callback = null , $ key = null , $ attr = null ) { if ( is_callable ( $ attr ) && ! is_callable ( $ callback ) ) { $ new_attr = $ key ; $ key = $ callback ; $ callback = $ attr ; $ attr = $ new_attr ; } $ form = new static ; if ( is_null ( $ callback ) ) { throw new Exception ( 'Canno... | Create a new from instance |
5,762 | public static function build_id ( $ type , $ name ) { if ( ! is_null ( static :: $ id_prefix ) ) { return static :: $ id_prefix . '-' . static :: form_id ( $ type , $ name ) ; } return static :: form_id ( $ type , $ name ) ; } | Format an id by configartion with the current form prefix |
5,763 | public static function make_input ( $ id , $ key , $ value = null , $ type = 'text' , $ attr = array ( ) ) { $ element = HTML :: tag ( 'input' , array_merge ( array ( 'id' => $ id , 'name' => $ key , 'type' => $ type ) , $ attr ) ) ; if ( ! is_null ( $ value ) ) { $ element -> value ( _e ( $ value ) ) ; } if ( ! static... | make an input |
5,764 | public static function make_label ( $ id , $ key , $ text = null , $ attr = array ( ) ) { if ( is_null ( $ text ) ) { $ text = $ key ; } $ element = HTML :: tag ( 'label' , $ text , array_merge ( array ( 'id' => $ id , 'for' => static :: build_id ( 'input' , $ key ) ) , $ attr ) ) ; if ( ! static :: $ builder_enabled )... | make a label |
5,765 | public static function make_checkbox ( $ id , $ key , $ text = '' , $ active = false , $ attr = array ( ) ) { $ element = HTML :: tag ( 'input' , array_merge ( array ( 'id' => $ id , 'name' => $ key , 'type' => 'checkbox' ) , $ attr ) ) ; $ element -> checked ( ( bool ) $ active ) ; $ element = HTML :: tag ( 'label' , ... | make a checkbox |
5,766 | public static function make_select ( $ id , $ name , array $ options , $ selected = array ( ) , $ size = 1 ) { if ( ! is_array ( $ selected ) ) { $ selected = array ( $ selected ) ; } $ buffer = "" ; foreach ( $ options as $ key => $ option ) { if ( ! ( $ option instanceof HTML ) ) { $ option = HTML :: tag ( 'option' ,... | generate an select |
5,767 | public function renderCollectionCommand ( $ collection ) { if ( ! isset ( $ this -> settings [ 'collections' ] [ $ collection ] ) ) { $ this -> outputLine ( 'Collection "%s" is not configured' , [ $ collection ] ) ; $ this -> quit ( 1 ) ; } if ( ! isset ( $ this -> settings [ 'collections' ] [ $ collection ] [ 'referen... | Renders a configured collection of reference documentation from source code . |
5,768 | protected function renderReference ( $ reference ) { if ( ! isset ( $ this -> settings [ 'references' ] [ $ reference ] ) ) { $ this -> outputLine ( 'Reference "%s" is not configured' , [ $ reference ] ) ; $ this -> quit ( 1 ) ; } $ referenceConfiguration = $ this -> settings [ 'references' ] [ $ reference ] ; $ affect... | Render a reference to reStructuredText . |
5,769 | public function flashMessage ( $ message ) { $ sessions = $ this -> getSessions ( ) -> getSessionSection ( 'flash.message' ) ; $ sessions -> message = $ message ; $ sessions -> setExpiration ( '5 second' ) ; return $ sessions -> message ; } | Create flash message . |
5,770 | public function buildLogger ( $ class , Configurator $ configurator ) { if ( ! class_exists ( $ class ) || ! is_subclass_of ( $ class , Logger :: class ) ) { $ class = "\\Phassets\\Loggers\\$class" ; } if ( class_exists ( $ class ) && is_subclass_of ( $ class , Logger :: class ) ) { return new $ class ( $ configurator ... | Creates a Logger instance . |
5,771 | public function buildCacheAdapter ( $ class , Configurator $ configurator ) { if ( ! class_exists ( $ class ) || ! is_subclass_of ( $ class , CacheAdapter :: class ) ) { $ class = "\\Phassets\\CacheAdapters\\$class" ; } if ( class_exists ( $ class ) && is_subclass_of ( $ class , CacheAdapter :: class ) ) { return new $... | Creates a CacheAdapter instance . |
5,772 | public function buildDeployer ( $ class , Configurator $ configurator , CacheAdapter $ cacheAdapter ) { if ( ! class_exists ( $ class ) || ! is_subclass_of ( $ class , Deployer :: class ) ) { $ class = "\\Phassets\\Deployers\\$class" ; } if ( class_exists ( $ class ) && is_subclass_of ( $ class , Deployer :: class ) ) ... | Creates a Deployer instance . |
5,773 | public function buildFilter ( $ class , Configurator $ configurator ) { if ( ! class_exists ( $ class ) || ! is_subclass_of ( $ class , Filter :: class ) ) { $ class = "\\Phassets\\Filters\\$class" ; } if ( class_exists ( $ class ) && is_subclass_of ( $ class , Filter :: class ) ) { return new $ class ( $ configurator ... | Creates a Filter instance . |
5,774 | public function buildAssetsMerger ( $ class , Configurator $ configurator ) { if ( ! class_exists ( $ class ) || ! is_subclass_of ( $ class , AssetsMerger :: class ) ) { $ class = "\\Phassets\\AssetsMergers\\$class" ; } if ( class_exists ( $ class ) && is_subclass_of ( $ class , AssetsMerger :: class ) ) { return new $... | Creates an AssetsMerger instance . |
5,775 | public function show ( OutputInterface $ output , array $ response ) { $ this -> printList ( $ output , [ 'Name' , 'Description' , 'Source' , 'Archive' , 'Key' , 'Type' , 'License' , 'Version' , 'Group' , 'Updated At' ] , [ 'name' , 'description' , 'links' , 'archives' , 'prod_key' , 'prod_type' , 'license_info' , 'ver... | output for the show API . |
5,776 | public function versions ( OutputInterface $ output , array $ response ) { $ this -> printList ( $ output , [ 'Name' , 'Language' , 'Key' , 'Type' , 'Version' ] , [ 'name' , 'language' , 'prod_key' , 'prod_type' , 'version' ] , $ response ) ; $ this -> printTable ( $ output , [ 'Version' , 'Released At' ] , [ 'version'... | output for the versions API . |
5,777 | public function process ( $ source , $ force = true ) { list ( $ webRoot , $ source ) = $ this -> _findWebRoot ( $ source ) ; $ lessFile = FS :: clean ( $ webRoot . Configure :: read ( 'App.lessBaseUrl' ) . $ source , '/' ) ; $ this -> _setForce ( $ force ) ; $ less = new Less ( $ this -> _config ) ; if ( ! FS :: isFil... | Process less file . |
5,778 | protected function _compress ( $ code , $ cacheId ) { $ code = ( string ) $ code ; $ code = preg_replace ( '#/\*[^*]*\*+([^/][^*]*\*+)*/#ius' , '' , $ code ) ; $ code = str_replace ( [ "\r\n" , "\r" , "\n" , "\t" , ' ' , ' ' , ' {' , '{ ' , ' }' , '; ' , ';;' , ';;;' , ';;;;' , ';}' ] , [ '' , '' , '' , '' , '' , '... | CSS compressing . |
5,779 | protected function _findWebRoot ( $ source ) { $ webRootDir = Configure :: read ( 'App.webroot' ) ; $ webRoot = APP_ROOT . DS . $ webRootDir . DS ; list ( $ plugin , $ source ) = $ this -> _View -> pluginSplit ( $ source ) ; if ( $ plugin !== null && Plugin :: loaded ( $ plugin ) ) { $ webRoot = Plugin :: path ( $ plug... | Find source webroot dir . |
5,780 | protected function _getPlgAssetUrl ( $ path ) { $ isPlugin = false ; $ plgPaths = Configure :: read ( 'App.paths.plugins' ) ; foreach ( $ plgPaths as $ plgPath ) { $ plgPath = ltrim ( FS :: clean ( $ plgPath , '/' ) , '/' ) ; if ( preg_match ( '(' . quotemeta ( $ plgPath ) . ')' , $ path ) ) { $ path = str_replace ( $ ... | Get plugin asset url . |
5,781 | protected function _normalizeContent ( $ path , $ fileHead ) { $ css = file_get_contents ( $ path ) ; if ( ! $ this -> _configRead ( 'debug' ) ) { $ css = $ this -> _compress ( $ css , $ fileHead ) ; } else { list ( $ first , $ second ) = explode ( PHP_EOL , $ css , 2 ) ; if ( preg_match ( '(\/* cacheid:)' , $ first ) ... | Normalize style file . |
5,782 | protected function _normalizePlgAssetUrl ( $ path ) { $ details = explode ( '/' , $ path , 3 ) ; $ pluginName = Inflector :: camelize ( trim ( $ details [ 0 ] , '/' ) ) ; if ( Plugin :: loaded ( $ pluginName ) ) { unset ( $ details [ 0 ] ) ; $ source = $ pluginName . '.' . ltrim ( implode ( '/' , $ details ) , '/' ) ; ... | Normalize plugin asset url . |
5,783 | protected function _replaceUrlCallback ( array $ match ) { $ assetPath = str_replace ( Router :: fullBaseUrl ( ) , '' , $ match [ 2 ] ) ; $ assetPath = trim ( FS :: clean ( $ assetPath , '/' ) , '/' ) ; $ appDir = trim ( FS :: clean ( APP_ROOT , '/' ) , '/' ) ; list ( $ isPlugin , $ assetPath ) = $ this -> _getPlgAsset... | Replace url callback . |
5,784 | protected function _write ( $ path , $ content ) { $ File = new File ( $ path ) ; $ File -> write ( $ content ) ; $ File -> exists ( ) ; } | Write content in to the file . |
5,785 | protected function _get_requester ( ) { $ this_class = get_class ( $ this ) ; $ this_class = explode ( '\\' , $ this_class ) ; $ this_class = array_pop ( $ this_class ) ; $ requester_class = '\Inc2734\WP_Share_Buttons\App\Model\Requester\\' . $ this_class ; if ( ! class_exists ( $ requester_class ) ) { return ; } retur... | Return Requester class name |
5,786 | protected function saveContent ( string $ hash , string $ content ) : void { $ this -> adapter -> save ( $ this -> namespace , $ hash , $ content ) ; $ this -> cache [ $ hash ] = $ content ; } | Saves the specified content into the registry . |
5,787 | protected function loadContent ( string $ hash ) : ? string { if ( ! array_key_exists ( $ hash , $ this -> cache ) ) { $ content = $ this -> adapter -> load ( $ this -> namespace , $ hash ) ; $ this -> cache [ $ hash ] = is_string ( $ content ) ? $ content : null ; } return $ this -> cache [ $ hash ] ; } | Loads the content with the specified hash from the registry . |
5,788 | protected function deleteContent ( string $ hash ) : void { $ this -> adapter -> delete ( $ this -> namespace , $ hash ) ; unset ( $ this -> cache [ $ hash ] ) ; } | Deletes the content with the specified hash from the registry . |
5,789 | protected function decodeContent ( string $ content ) : array { $ result = json_decode ( $ content , true ) ; return is_array ( $ result ) ? $ result : [ ] ; } | Decodes the specified JSON content . |
5,790 | public function addClassToProcess ( $ className ) { if ( ! class_exists ( $ className ) ) { return false ; } $ this -> classesToProcess [ ( string ) $ className ] = true ; return true ; } | Adds a class to the list of classes to be processed |
5,791 | public static function instance ( ) { if ( ! isset ( self :: $ logger ) ) { self :: $ logger = new Logger ( self :: $ path ) ; } return self :: $ logger ; } | Returns Logger instance . |
5,792 | public function getCriteria ( ) { $ gets = $ this -> request -> get ( ) ; if ( empty ( $ this -> routeData ) ) { $ criteria = array ( ) ; } else { $ criteria = $ this -> routeData ; } foreach ( $ gets as $ key => $ value ) { if ( $ key [ 0 ] !== '!' ) { $ criteria [ $ key ] = $ value ; } } $ criteria = array_merge ( $ ... | Get criteria of current request |
5,793 | public function create ( ) { $ entry = $ this -> collection -> newInstance ( ) -> set ( $ this -> getCriteria ( ) ) ; $ this -> data [ 'entry' ] = $ entry ; if ( $ this -> request -> isPost ( ) ) { try { $ result = $ entry -> set ( $ this -> request -> getBody ( ) ) -> save ( ) ; h ( 'notification.info' , $ this -> cla... | Handle creation of new document . |
5,794 | public function schema ( $ schema = null ) { if ( func_num_args ( ) === 0 ) { return $ this -> collection -> schema ( ) ; } return $ this -> collection -> schema ( $ schema ) ; } | Get schema of collection |
5,795 | public function routeModel ( $ key ) { if ( ! isset ( $ this -> routeModels [ $ key ] ) ) { $ Clazz = Inflector :: classify ( $ key ) ; $ collection = Norm :: factory ( $ this -> schema ( $ key ) -> get ( 'foreign' ) ) ; $ this -> routeModels [ $ key ] = $ collection -> findOne ( $ this -> routeData ( $ key ) ) ; } ret... | Register a route model . |
5,796 | public function dispatch ( Command $ command ) { if ( $ this -> _eventsManager -> fire ( 'command:beforeCommand' , $ command ) === false ) { return false ; } if ( $ command -> run ( $ command -> getParameters ( ) ) === false ) { return false ; } $ this -> _eventsManager -> fire ( 'command:afterCommand' , $ command ) ; ... | Dispatch the Command |
5,797 | public function run ( ) { if ( ! isset ( $ _SERVER [ 'argv' ] [ 1 ] ) ) { $ _SERVER [ 'argv' ] [ 1 ] = 'commands' ; } $ input = $ _SERVER [ 'argv' ] [ 1 ] ; if ( in_array ( strtolower ( trim ( $ input ) ) , [ '-h' , '--help' , 'help' ] , true ) ) { $ input = $ _SERVER [ 'argv' ] [ 1 ] = 'commands' ; } if ( in_array ( s... | Run the scripts |
5,798 | public static function fetch ( $ query , $ params = array ( ) , $ handler = null , $ arguments = array ( 'obj' ) ) { return Handler :: create ( $ handler ) -> fetch ( $ query , $ params , $ arguments ) ; } | Fetch data from an sql query Returns always an array of results |
5,799 | public static function run ( $ query , $ params = array ( ) , $ handler = null ) { return Handler :: create ( $ handler ) -> run ( $ query , $ params ) ; } | Run an sql statement will return the number of affected rows |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.