idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
19,700 | public function addLogger ( $ logger , $ format = 'CLF' ) { if ( defined ( 'GuzzleHttp\Subscriber\Log\Formatter::' . $ format ) ) { $ format = constant ( 'GuzzleHttp\Subscriber\Log\Formatter::' . $ format ) ; } $ subscriber = new LogSubscriber ( $ logger , $ format ) ; $ this -> guzzleClient -> getEmitter ( ) -> attach... | Add a logger to the guzzle client . |
19,701 | public function addFile ( $ filepath , $ key = 'file' ) { $ this -> options = array_merge_recursive ( $ this -> options , [ 'body' => [ $ key => fopen ( $ filepath , 'r' ) , ] , ] ) ; return $ this ; } | Add a file to the request . |
19,702 | public function getUrl ( ) { if ( ! $ this -> url ) { throw new InvalidUrlException ( ) ; } $ url = $ this -> url ; if ( ! parse_url ( $ this -> url , PHP_URL_SCHEME ) ) { $ url = $ this -> getProtocol ( ) . $ url ; } return $ url ; } | Getter for the url will append protocol if one does not exist . |
19,703 | public function getOptions ( $ options ) { $ options = array_merge ( [ 'verify' => $ this -> verify ] , $ options ) ; if ( $ this -> async ) { $ options = array_merge ( [ 'future' => true ] , $ options ) ; } return array_merge_recursive ( $ this -> options , $ options ) ; } | Getter for options . |
19,704 | protected function send ( $ function , array $ options = [ ] ) { $ guzzle = $ this -> getGuzzleClient ( ) ; $ url = $ this -> getUrl ( ) ; $ options = $ this -> getOptions ( $ options ) ; $ this -> initialize ( ) ; return $ guzzle -> $ function ( $ url , $ options ) ; } | Send the request using guzzle . |
19,705 | protected function addRetrySubscriber ( GuzzleClient $ guzzle ) { $ retry = new RetrySubscriber ( [ 'filter' => RetrySubscriber :: createStatusFilter ( $ this -> retryOn ) , 'delay' => function ( $ number , $ event ) { return $ this -> retryDelay ; } , 'max' => $ this -> retry , ] ) ; $ guzzle -> getEmitter ( ) -> atta... | Add the retry subscriber to the guzzle client . |
19,706 | protected function initialize ( ) { $ this -> url = '' ; $ this -> options = [ ] ; $ this -> secure = array_get ( $ this -> config , 'secure' , true ) ; $ this -> retryOn = array_get ( $ this -> config , 'retry.on' , [ 500 , 502 , 503 , 504 ] ) ; $ this -> retryDelay = array_get ( $ this -> config , 'retry.delay' , 10 ... | Resets all variables to default values required if using the same instance for multiple requests . |
19,707 | private function adminModules ( ) { $ return = [ ] ; foreach ( $ this -> app [ 'config' ] -> get ( 'modules.all' ) as $ module ) { $ controller = '\\app\\' . $ module . '\\Controller' ; if ( ! class_exists ( $ controller ) ) { continue ; } if ( property_exists ( $ controller , 'scaffoldAdmin' ) || property_exists ( $ c... | Returns a list of modules with admin sections . |
19,708 | private function fetchModelInfo ( $ module , $ model = false ) { $ controller = '\\app\\' . $ module . '\\Controller' ; $ controllerObj = new $ controller ( $ this -> app ) ; $ properties = $ controller :: $ properties ; $ availableModels = $ this -> models ( $ controllerObj ) ; if ( ! $ model ) { if ( count ( $ availa... | Takes the pluralized model name from the route and gets info about the model . |
19,709 | private function models ( $ controller ) { $ properties = $ controller :: $ properties ; $ module = $ this -> name ( $ controller ) ; $ models = [ ] ; foreach ( ( array ) U :: array_value ( $ properties , 'models' ) as $ model ) { $ modelClassName = '\\app\\' . $ module . '\\models\\' . $ model ; $ info = $ modelClassN... | Fetches the models for a given controller . |
19,710 | protected function applyScopes ( QueryBuilder $ query , Model $ model , $ ignoreScopes = [ ] ) { if ( in_array ( '*' , $ ignoreScopes ) ) { return ; } $ class = get_called_class ( ) ; $ scopes = Arr :: get ( static :: $ scopes , $ class , [ ] ) ; foreach ( $ scopes as $ sid => $ scope ) { if ( ! in_array ( $ sid , $ ig... | Apply scopes in query . |
19,711 | public function setGroupId ( $ groupId ) { $ this -> groupId = ( int ) $ groupId ? : null ; if ( $ this -> group && $ this -> group -> id != $ this -> groupId ) { $ this -> group = null ; } return $ this ; } | Set group - id |
19,712 | public function getUri ( $ locale = null ) { if ( empty ( $ locale ) ) { $ locale = $ this -> getLocale ( ) ; } return '/app/' . $ locale . '/user/view/' . rawurlencode ( $ this -> displayName ) ; } | Get url for view user |
19,713 | public function getContent ( $ index = null , $ raw = false ) { if ( null === $ index ) { return ( bool ) $ raw ? $ this -> cbuff : join ( '' , $ this -> cbuff ) ; } if ( isset ( $ this -> cbuff [ ( int ) $ index ] ) ) { return $ this -> cbuff [ ( int ) $ index ] ; } throw new \ OutOfBoundsException ( sprintf ( 'No con... | Get the contents . |
19,714 | public function build ( ) { $ file = rtrim ( $ this -> cacheDir , '/' ) . '/' . $ this -> getFilename ( ) ; $ mapFile = $ file . '.map' ; $ cache = new PuliResourceCollectionCache ( $ file , $ this -> isDebug ( ) ) ; $ resources = $ this -> resourceFinder -> findByType ( $ this -> getType ( ) ) ; if ( ! $ cache -> isFr... | Get all javascripts for the given section . |
19,715 | public function showPosts ( $ pagenumber = 1 ) { $ posts = $ this -> post -> findAll ( ) ; $ viewParamaters = array ( 'global' => $ this -> global , 'posts' => $ posts , 'pageNumber' => $ pagenumber ) ; return \ View :: make ( $ this -> theme . '.posts' , $ viewParamaters ) ; } | Show all of the posts . |
19,716 | public function showPost ( $ category , $ postName ) { if ( ! $ this -> post -> exists ( $ category , $ postName ) ) { return \ Response :: view ( $ this -> theme . '.404' , array ( 'global' => $ this -> global ) , 404 ) ; } $ post = $ this -> post -> getPost ( $ category , $ postName ) ; $ category = $ this -> categor... | Show a single post . |
19,717 | protected function process_file ( $ file_override = false ) { $ clean_room = function ( $ __file_name , array $ __data ) { extract ( $ __data , EXTR_REFS ) ; ob_start ( ) ; try { include $ __file_name ; } catch ( \ Exception $ e ) { ob_end_clean ( ) ; throw $ e ; } return ob_get_clean ( ) ; } ; return $ clean_room ( $ ... | Captures the output that is generated when a view is included . The view data will be extracted to make local variables . This method is static to prevent object scope resolution . |
19,718 | protected function get_data ( $ scope = 'all' ) { $ clean_it = function ( $ data , $ rules , $ auto_filter ) { foreach ( $ data as $ key => & $ value ) { $ filter = array_key_exists ( $ key , $ rules ) ? $ rules [ $ key ] : null ; $ filter = is_null ( $ filter ) ? $ auto_filter : $ filter ; $ value = $ filter ? \ Secur... | Retrieves all the data both local and global . It filters the data if necessary . |
19,719 | public function auto_filter ( $ filter = true ) { if ( func_num_args ( ) == 0 ) { return $ this -> auto_filter ; } $ this -> auto_filter = $ filter ; return $ this ; } | Sets whether to filter the data or not . |
19,720 | public function set_filename ( $ file ) { \ Finder :: instance ( ) -> flash ( $ this -> request_paths ) ; if ( ( $ path = \ Finder :: search ( 'views' , $ file , '.' . $ this -> extension , false , false ) ) === false ) { throw new \ FuelException ( 'The requested view could not be found: ' . \ Fuel :: clean_path ( $ f... | Sets the view filename . |
19,721 | public function & get ( $ key = null , $ default = null ) { if ( func_num_args ( ) === 0 or $ key === null ) { return $ this -> data ; } elseif ( array_key_exists ( $ key , $ this -> data ) ) { return $ this -> data [ $ key ] ; } elseif ( array_key_exists ( $ key , static :: $ global_data ) ) { return static :: $ globa... | Searches for the given variable and returns its value . Local variables will be returned before global variables . |
19,722 | public function render ( $ file = null ) { if ( class_exists ( 'Request' , false ) ) { $ current_request = \ Request :: active ( ) ; \ Request :: active ( $ this -> active_request ) ; } if ( $ this -> active_language ) { $ current_language = \ Config :: get ( 'language' , 'en' ) ; \ Config :: set ( 'language' , $ this ... | Renders the view object to a string . Global and local data are merged and extracted to create local variables within the view file . |
19,723 | public function addCss ( $ css ) { if ( ! is_array ( $ css ) ) { $ css = preg_replace ( '/[ ]+/' , ' ' , $ css ) ; $ css = explode ( ' ' , $ css ) ; } foreach ( $ css as $ class ) { $ this -> css [ $ class ] = $ class ; } } | Add one or more css classes to the html object . Accepts single value a string of space separated classnames or an array of classnames . |
19,724 | public function isHidden ( int $ state = null ) { $ attrib = 'hidden' ; if ( empty ( $ state ) ) { return $ this -> checkAttribute ( $ attrib ) ; } if ( $ state == 0 ) { $ this -> removeAttribute ( $ attrib ) ; } else { $ this -> addAttribute ( $ attrib ) ; } } | Hidden attribute setter and checker |
19,725 | public function build ( ) : string { $ html_attr = [ ] ; if ( ! $ this -> element ) { $ this -> element = strtolower ( ( new \ ReflectionClass ( $ this ) ) -> getShortName ( ) ) ; } if ( ! empty ( $ this -> id ) ) { $ html_attr [ 'id' ] = $ this -> id ; } if ( ! empty ( $ this -> name ) ) { $ html_attr [ 'name' ] = $ t... | Builds and returns the html code created out of all set attributes and their values |
19,726 | public function filterByYear ( $ year = null , $ comparison = null ) { if ( is_array ( $ year ) ) { $ useMinMax = false ; if ( isset ( $ year [ 'min' ] ) ) { $ this -> addUsingAlias ( ReferenceTableMap :: COL_YEAR , $ year [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ year [ 'max' ] ) ... | Filter the query on the year column |
19,727 | public function filterByPublisher ( $ publisher = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ publisher ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ publisher ) ) { $ publisher = str_replace ( '*' , '%' , $ publisher ) ; $ comparison = Criteria :: LIKE... | Filter the query on the publisher column |
19,728 | public function filterByJournal ( $ journal = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ journal ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ journal ) ) { $ journal = str_replace ( '*' , '%' , $ journal ) ; $ comparison = Criteria :: LIKE ; } } retur... | Filter the query on the journal column |
19,729 | public function filterByNumber ( $ number = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ number ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ number ) ) { $ number = str_replace ( '*' , '%' , $ number ) ; $ comparison = Criteria :: LIKE ; } } return $ th... | Filter the query on the number column |
19,730 | public function filterBySchool ( $ school = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ school ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ school ) ) { $ school = str_replace ( '*' , '%' , $ school ) ; $ comparison = Criteria :: LIKE ; } } return $ th... | Filter the query on the school column |
19,731 | public function filterByEdition ( $ edition = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ edition ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ edition ) ) { $ edition = str_replace ( '*' , '%' , $ edition ) ; $ comparison = Criteria :: LIKE ; } } retur... | Filter the query on the edition column |
19,732 | public function filterByVolume ( $ volume = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ volume ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ volume ) ) { $ volume = str_replace ( '*' , '%' , $ volume ) ; $ comparison = Criteria :: LIKE ; } } return $ th... | Filter the query on the volume column |
19,733 | public function filterByAddress ( $ address = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ address ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ address ) ) { $ address = str_replace ( '*' , '%' , $ address ) ; $ comparison = Criteria :: LIKE ; } } retur... | Filter the query on the address column |
19,734 | public function filterByEditor ( $ editor = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ editor ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ editor ) ) { $ editor = str_replace ( '*' , '%' , $ editor ) ; $ comparison = Criteria :: LIKE ; } } return $ th... | Filter the query on the editor column |
19,735 | public function filterByHowpublished ( $ howpublished = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ howpublished ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ howpublished ) ) { $ howpublished = str_replace ( '*' , '%' , $ howpublished ) ; $ comparison ... | Filter the query on the howpublished column |
19,736 | public function filterByNote ( $ note = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ note ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ note ) ) { $ note = str_replace ( '*' , '%' , $ note ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsi... | Filter the query on the note column |
19,737 | public function filterByBooktitle ( $ booktitle = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ booktitle ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ booktitle ) ) { $ booktitle = str_replace ( '*' , '%' , $ booktitle ) ; $ comparison = Criteria :: LIKE... | Filter the query on the booktitle column |
19,738 | public function filterByLastchecked ( $ lastchecked = null , $ comparison = null ) { if ( is_array ( $ lastchecked ) ) { $ useMinMax = false ; if ( isset ( $ lastchecked [ 'min' ] ) ) { $ this -> addUsingAlias ( ReferenceTableMap :: COL_LASTCHECKED , $ lastchecked [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax =... | Filter the query on the lastchecked column |
19,739 | public function filterByManaged ( $ managed = null , $ comparison = null ) { if ( is_string ( $ managed ) ) { $ managed = in_array ( strtolower ( $ managed ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( ReferenceTableMap :: COL_MANAGED , $ managed , $ c... | Filter the query on the managed column |
19,740 | public function useSkillReferenceQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinSkillReference ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'SkillReference' , '\gossi\trixionary\model\SkillReferenceQuery' ) ; } | Use the SkillReference relation SkillReference object |
19,741 | public function filterBySkill ( $ skill , $ comparison = Criteria :: EQUAL ) { return $ this -> useSkillReferenceQuery ( ) -> filterBySkill ( $ skill , $ comparison ) -> endUse ( ) ; } | Filter the query by a related Skill object using the kk_trixionary_skill_reference table as cross reference |
19,742 | public function createProject ( $ packageName , $ packageVersion , $ outputFolder ) { $ this -> runCommand ( 'create-project --prefer-dist ' . $ packageName . ' ' . $ outputFolder . ' "' . $ packageVersion . '"' ) ; return $ this ; } | Composer create - project . |
19,743 | protected function find ( ) { if ( ! File :: exists ( $ this -> workingPath . '/composer.phar' ) ) { return 'composer' ; } $ binary = ProcessUtils :: escapeArgument ( ( new PhpExecutableFinder ) -> find ( false ) ) ; if ( defined ( 'HHVM_VERSION' ) ) { $ binary .= ' --php' ; } return "{$binary} composer.phar" ; } | Find composer . |
19,744 | protected function runCommand ( $ command ) { $ process = $ this -> getProcess ( ) ; $ process -> setCommandLine ( trim ( $ this -> find ( ) . ' ' . $ command ) ) ; $ process -> run ( ) ; return $ this ; } | Run composer command . |
19,745 | public function getThemeInfo ( $ key ) { if ( null === $ this -> theme ) { $ this -> theme = wp_get_theme ( ) ; } $ headers = [ 'name' => 'Name' , 'description' => 'Description' , 'author' => 'Author' , 'authoruri' => 'AuthorURI' , 'themeuri' => 'ThemeURI' , 'version' => 'Version' , 'status' => 'Status' , 'tags' => 'Ta... | Retrieves theme information |
19,746 | public function getThemeOption ( $ key , $ default = null ) { $ options = get_option ( 'novusopress_theme_options' ) ? : [ ] ; if ( array_key_exists ( $ key , $ options ) ) { return apply_filters ( sprintf ( 'novusopress_theme_options_%s' , $ key ) , $ options [ $ key ] ) ; } $ defaults = $ this -> getThemeDefaultOptio... | Retrieves theme option |
19,747 | public function addThemeSupports ( ) { load_theme_textdomain ( 'novusopress' , $ this -> paths -> getBaseLanguageDir ( ) ) ; add_theme_support ( 'title-tag' ) ; add_theme_support ( 'automatic-feed-links' ) ; add_theme_support ( 'post-thumbnails' ) ; add_theme_support ( 'html5' , [ 'search-form' , 'comment-form' , 'comm... | Enables theme supports |
19,748 | public function registerWidgets ( ) { $ this -> registerWidget ( __ ( 'Header Widget Area' , 'novusopress' ) , 'header' , 'widgets' ) ; $ this -> registerWidget ( __ ( 'Blog Index Sidebar' , 'novusopress' ) , 'sidebar' , 'index' ) ; $ this -> registerWidget ( __ ( 'Blog Post Sidebar' , 'novusopress' ) , 'sidebar' , 'si... | Enables default widget support |
19,749 | public function cleanDocumentHead ( ) { remove_action ( 'wp_head' , 'feed_links_extra' ) ; remove_action ( 'wp_head' , 'feed_links' ) ; remove_action ( 'wp_head' , 'rsd_link' ) ; remove_action ( 'wp_head' , 'wlwmanifest_link' ) ; remove_action ( 'wp_head' , 'index_rel_link' ) ; remove_action ( 'wp_head' , 'parent_post_... | Removes extra markup from the document head |
19,750 | public function setViewLevel ( $ view_level_name , $ view_level_file_name ) { if ( isset ( $ this -> _view_levels [ $ view_level_name ] ) ) { $ this -> _view_levels [ $ view_level_name ] [ "file_name" ] = $ view_level_file_name ; $ this -> _view_levels [ $ view_level_name ] [ "is_disabled" ] = false ; } } | Attach a file name to a view level enables the view level |
19,751 | public function disableViewLevel ( $ view_level_name ) { if ( isset ( $ this -> _view_levels [ $ view_level_name ] ) ) { $ this -> _view_levels [ $ level_name ] [ "is_disabled" ] = true ; } } | Disables a view level |
19,752 | public function enableCache ( $ options = null ) { $ key = isset ( $ options [ "key" ] ) ? $ options [ "key" ] : "" ; $ lifetime = isset ( $ options [ "lifetime" ] ) ? $ options [ "lifetime" ] : 3600 ; $ level = isset ( $ options [ "level" ] ) ? $ options [ "level" ] : 1 ; $ this -> _cache_service_name = isset ( $ opti... | Enables caching . |
19,753 | private function _checkViewsExist ( ) { foreach ( $ this -> _view_levels as $ view_level ) { if ( ! $ view_level [ "is_disabled" ] ) { if ( ! file_exists ( $ this -> _views_dir . $ view_level [ "file_name" ] . ".phtml" ) ) { throw new \ Exception ( "View '" . $ view_level [ "file_name" ] . ".phtml' does not exist." ) ;... | Private function . Checks the enabled view levels and makes sure the attached view exists . |
19,754 | public function getContent ( ) { if ( $ this -> _render_completed ) { return $ this -> _content ; } foreach ( $ this -> _view_levels as $ view_level ) { if ( $ view_level [ "is_disabled" ] ) { continue ; } $ this -> _view_levels [ $ view_level [ "name" ] ] [ "is_disabled" ] = true ; if ( $ view_level [ "cache_enabled" ... | Includes the files attached to the view levels . Disabled view levels do not get included . MAIN_VIEW - > BEFORE_CONTROLLER_VIEW - > CONTROLLER_VIEW - > AFTER_CONTROLLER_VIEW - > ACTION_VIEW If a view level has cache enabled stop rendering |
19,755 | function interpolate ( $ message , array $ context = [ ] ) { $ replace = array ( ) ; foreach ( $ context as $ key => $ val ) { if ( ( $ key == 'exception' || $ key == 'throwable' ) && $ val instanceof \ Throwable ) { $ val = $ val -> getTraceAsString ( ) ; } if ( is_object ( $ val ) ) { $ val = 'Objects can not be inte... | Interpolates context values into the message placeholders |
19,756 | public function watchForRead ( $ socketObject ) : void { $ rawSocket = $ this -> getRawSocket ( $ socketObject ) ; \ array_push ( $ this -> watchedSockets , $ rawSocket ) ; $ this -> watchedSocketObjects [ $ this -> getRawSocketKey ( $ rawSocket ) ] = $ socketObject ; } | Currently only supports watching read events |
19,757 | public function addPrefix ( RouteEvent $ event ) { $ route = $ event -> getRoute ( ) ; $ route -> setPath ( $ this -> prefix . $ route -> getPath ( ) ) ; } | Add a prefix on each route |
19,758 | public function getIndexByName ( $ name ) { foreach ( $ this -> sections as $ i => $ sec ) { if ( $ sec instanceof Section ) { if ( $ sec -> getName ( ) == $ name ) { return $ i ; } } } return - 1 ; } | Get section index by section name - 1 for not exists . |
19,759 | public function getSectionByName ( $ name ) { foreach ( $ this -> sections as $ i => $ sec ) { if ( $ sec instanceof Section ) { if ( $ sec -> getName ( ) == $ name ) { return $ sec ; } } } return null ; } | Get section by section name null for not exists . |
19,760 | public static function set ( $ name , $ value , $ expiration = null , $ path = null , $ domain = null , $ secure = null , $ http_only = null ) { if ( \ Fuel :: $ is_cli ) { return false ; } $ value = \ Fuel :: value ( $ value ) ; is_null ( $ expiration ) and $ expiration = static :: $ config [ 'expiration' ] ; is_null ... | Sets a signed cookie . Note that all cookie values must be strings and no automatic serialization will be performed! |
19,761 | public static function delete ( $ name , $ path = null , $ domain = null , $ secure = null , $ http_only = null ) { unset ( $ _COOKIE [ $ name ] ) ; return static :: set ( $ name , null , - 86400 , $ path , $ domain , $ secure , $ http_only ) ; } | Deletes a cookie by making the value null and expiring it . |
19,762 | public function prepareException ( MvcEvent $ e ) { if ( $ e -> getRequest ( ) instanceof Request ) { $ error = $ e -> getError ( ) ; if ( ! empty ( $ error ) && ! $ e -> getResult ( ) instanceof Response ) { switch ( $ error ) { case Application :: ERROR_CONTROLLER_NOT_FOUND : case Application :: ERROR_CONTROLLER_INVA... | Whoops handle exceptions |
19,763 | public function recordThat ( DomainEvent $ event ) { $ this -> bumpVersion ( ) ; if ( is_null ( $ this -> uncommittedEvents ) ) { $ this -> uncommittedEvents = new UncommittedEvents ( $ this -> getIdentity ( ) ) ; } $ this -> uncommittedEvents -> append ( $ event ) ; $ this -> when ( $ event ) ; return $ this ; } | Register a event happening on the aggregate |
19,764 | public function toArray ( ) { return [ 'id' => $ this -> id , 'author' => $ this -> author , 'title' => $ this -> title , 'date' => $ this -> date -> format ( 'U' ) , 'component' => $ this -> component , 'image' => $ this -> image , 'handler' => $ this -> handler , ] ; } | Return array repesentation of this search result . |
19,765 | protected function send ( $ msg ) { $ msg .= PHP_EOL ; return socket_write ( $ this -> socket , $ msg , strlen ( $ msg ) ) ; } | Atomic send of a string trough the socket |
19,766 | public function getCatalogIndex ( $ projectId = null ) { return $ this -> callService ( $ this -> url_plan [ 'get_catalog_index' ] , array ( 'project_id' => $ projectId ? : $ this -> project_id , ) ) ; } | Get catalog index |
19,767 | public function addCommandHandler ( CommandHandlerInterface $ commandHandler , string $ payloadName ) : CommandDispatcher { $ this -> commandHandlers [ $ payloadName ] = $ commandHandler ; return $ this ; } | Add command handler for payload name . |
19,768 | protected function getCommandHandler ( CommandMessageInterface $ commandMessage ) : CommandHandlerInterface { $ name = $ commandMessage -> getPayloadType ( ) -> getName ( ) ; $ commandHandlers = $ this -> getCommandHandlers ( ) ; if ( array_key_exists ( $ name , $ commandHandlers ) === false ) { throw new CommandHandle... | Get command handler for command message . |
19,769 | protected function formatStub ( $ stub , array $ replacement ) { foreach ( $ replacement as $ src => $ dest ) { $ stub = str_replace ( $ src , $ dest , $ stub ) ; } return $ stub ; } | replace stub text |
19,770 | protected function store ( $ stub ) { $ output = $ this -> getOutputPath ( ) ; if ( $ this -> files -> exists ( $ output ) ) { return false ; } $ this -> files -> put ( $ output , $ stub ) ; return true ; } | save formatted stub text |
19,771 | public function getSlugForTitle ( $ title ) { $ slug = Str :: slug ( $ title ) ; $ latestSlug = $ this -> model -> whereRaw ( "slug RLIKE '^{$slug}(-[0-9]*)?$'" ) -> latest ( ) -> value ( 'slug' ) ; if ( $ latestSlug ) { $ pieces = explode ( '-' , $ latestSlug ) ; $ number = end ( $ pieces ) ; return $ slug . '-' . ( $... | Generate a unique Slug for a given Title . |
19,772 | public function findByRoot ( $ rootParagraphId ) { $ root = ( ( int ) $ rootParagraphId ) ? : null ; $ extra = $ this -> getMapper ( ) -> findByRoot ( $ root ) ; if ( empty ( $ extra ) ) { $ extra = $ this -> getMapper ( ) -> create ( array ( 'rootParagraphId' => $ root , ) ) ; } return $ extra ; } | Get customize extra by selector & media |
19,773 | protected function getMemoryLimit ( ) : ? int { $ short = [ 'k' => 1024 , 'm' => 1048576 , 'g' => 1073741824 , ] ; $ setting = ( string ) ini_get ( 'memory_limit' ) ; if ( ! ( $ len = strlen ( $ setting ) ) ) { return null ; } $ last = strtolower ( $ setting [ $ len - 1 ] ) ; $ numeric = ( int ) $ setting ; $ numeric *... | Returns the memory limit in bytes . |
19,774 | protected function build ( $ in , $ out ) { $ workDir = getenv ( 'WORK_DIR' ) . '/' ; $ content = $ this -> filesystem -> read ( $ workDir . $ in ) ; $ document = $ this -> builder -> build ( $ content ) ; $ this -> filesystem -> overwrite ( $ workDir . $ out , $ document ) ; } | Build a Markdown document . |
19,775 | private function buildMenuWithoutExistingParent ( $ menuAccessible ) { $ withoutParent = collect ( $ this -> itemsWithoutParent ) -> unique ( 'route' ) -> all ( ) ; foreach ( $ withoutParent as & $ item ) { $ children = $ this -> buildMenuTree ( $ menuAccessible , $ item [ 'route' ] ) ; if ( $ children ) { $ item [ 'ch... | Add child menu items to their parents . Only two levels |
19,776 | protected function init ( ) { $ this -> dependencies = array ( ) ; foreach ( $ this -> context -> getDependenciesFile ( ) as $ nameFile ) { $ this -> dependencies = array_merge ( $ this -> dependencies , $ this -> context -> readConfigurationFile ( $ nameFile ) ) ; } $ this -> loadDependencies = array ( ) ; foreach ( $... | Realiza lar carga inicial |
19,777 | public function injectDependenciesOfType ( $ object , $ type ) { foreach ( $ this -> loadDependencies as $ name => $ dependency ) { $ types = explode ( "," , $ dependency [ 'load_in' ] ) ; if ( in_array ( $ type , $ types ) ) { $ this -> loadDependencyInObject ( $ object , $ name , $ name , $ dependency ) ; } } } | Recorre las dependencias con load_in y analiza si carga o no una instancia de la dependencia en el objeto . Las nombres de las propiedades son las claves en la definicion de cada dependencia Es llamado por GenericLoader en su construccion para inyectar las clases correspondientes . Esta funcion supone que las Clases de... |
19,778 | public function injectDependencies ( $ object , array $ dependencies ) { $ dependenciesDefinition = $ this -> dependencies ; foreach ( $ dependencies as $ property => $ dependencyName ) { if ( isset ( $ dependenciesDefinition [ $ dependencyName ] ) ) { $ dependency = $ dependenciesDefinition [ $ dependencyName ] ; $ th... | Carga cada una de las dependencias indicadas en su correspondiente propiedad del objeto Esta funcion supone que las Clases de las dependencias ya se encuentran importadas . |
19,779 | public function getDependencyInstance ( $ dependencyName ) { if ( isset ( $ this -> dependencies [ $ dependencyName ] ) ) { return $ this -> loadDependency ( $ dependencyName , $ this -> dependencies [ $ dependencyName ] ) ; } return null ; } | Retorna una dependencia instanciada En este caso la dependencia no se injecta a ningun objeto |
19,780 | public function injectProperties ( $ object , $ propertiesDefinition ) { $ properties = $ this -> parseProperties ( $ propertiesDefinition ) ; $ reflection = new Reflection ( $ object ) ; $ reflection -> setProperties ( $ properties , TRUE ) ; } | Injecta definicion de propiedades a una instancia |
19,781 | protected function loadDependencyInObject ( $ object , $ property , $ dependencyName , $ dependencyDefinition ) { $ dependency = $ this -> loadDependency ( $ dependencyName , $ dependencyDefinition ) ; $ reflection = new Reflection ( $ object ) ; $ reflection -> setProperty ( $ property , $ dependency , TRUE ) ; } | Carga la dependencia y la setea en la propiedad del objeto a inyectar |
19,782 | protected function loadDependency ( $ name , $ dependencyDefinition , & $ loadedDependencies = array ( ) ) { $ newInstance = NULL ; if ( isset ( $ this -> singletons [ $ name ] ) ) { $ newInstance = $ this -> singletons [ $ name ] ; } else { $ namespace = ( isset ( $ dependencyDefinition [ 'namespace' ] ) ? $ dependenc... | Realiza la carga de una dependencia que luego va a ser inyectada |
19,783 | protected function parseProperties ( $ propertiesDefinition , & $ loadedDependencies = array ( ) ) { $ parseProperties = array ( ) ; foreach ( $ propertiesDefinition as $ key => $ definition ) { $ property = NULL ; if ( isset ( $ definition [ 'ref' ] ) ) { $ property = $ this -> getDependency ( $ definition [ 'ref' ] ,... | Parsea los valores en string al tipo que corresponda segun el valor y el tipo definido . |
19,784 | protected function getDependency ( $ name , & $ loadedDependencies = array ( ) ) { $ dependency = NULL ; $ dependencies = $ this -> dependencies ; if ( isset ( $ dependencies [ $ name ] ) ) { if ( isset ( $ loadedDependencies [ $ name ] ) ) { $ dependency = $ loadedDependencies [ $ name ] ; } else { $ dependency = $ th... | Devuelve la dependencia en base a un nombre y una lista de dependencias . Si no existe devuelve NULL |
19,785 | public function render ( $ viewPath , array $ params = [ ] ) { ob_start ( ) ; ob_implicit_flush ( false ) ; $ this -> params = $ params ; extract ( array_merge ( $ params , $ this -> getBlocks ( ) ) , EXTR_OVERWRITE ) ; require ( file_exists ( $ viewPath ) ? $ viewPath : '../' . $ viewPath ) ; return ob_get_clean ( ) ;... | Render view file |
19,786 | public function content ( $ parentView = null ) { if ( $ parentView === null ) { $ content = ob_get_clean ( ) ; ob_clean ( ) ; $ this -> params [ 'scripts' ] = $ this -> generateScripts ( ) ; $ this -> params [ 'css' ] = $ this -> generateCSS ( ) ; echo $ this -> render ( $ this -> parentLayout , array_merge ( $ this -... | Content for parent layout |
19,787 | public function block ( $ name = null ) { if ( $ name === null ) { $ this -> addBlock ( $ this -> currentBlock , ob_get_clean ( ) ) ; $ this -> currentBlock = '' ; ob_clean ( ) ; } else { $ this -> currentBlock = $ name ; ob_start ( ) ; } } | Start or stop content block |
19,788 | public function generateScripts ( ) { $ result = '' ; $ rawScript = [ ] ; $ this -> scripts = array_unique ( $ this -> scripts , SORT_REGULAR ) ; foreach ( $ this -> scripts as $ scriptInfo ) { if ( ! $ scriptInfo [ 2 ] ) { $ result .= '<script src="' . $ scriptInfo [ 0 ] . '" type="' . $ scriptInfo [ 1 ] . '"></script... | Generate script tags |
19,789 | public function generateCSS ( ) { $ result = '' ; $ cssRaw = '' ; $ this -> styles = array_unique ( $ this -> styles , SORT_REGULAR ) ; foreach ( $ this -> styles as $ style ) { if ( $ style [ 1 ] ) { $ cssRaw .= $ style [ 0 ] ; } else { $ result .= '<link href="' . $ style [ 0 ] . '" rel="stylesheet" type="text/css" /... | Generate CSS tags |
19,790 | public function load ( $ file , $ type = null ) { $ path = $ this -> locator -> locate ( $ file ) ; $ collection = new RouteCollection ( ) ; if ( $ class = $ this -> findClass ( $ path ) ) { $ collection -> addResource ( new FileResource ( $ path ) ) ; $ module = $ this -> moduleManager -> get ( $ class ) ; $ routeName... | Loads from modules in a file |
19,791 | public function appendHeadScript ( $ src , $ isFile = true ) { $ this -> headScripts [ ] = $ this -> createScript ( $ src , $ isFile ) ; } | Append script to header |
19,792 | public function prependHeadScript ( $ src , $ isFile = true ) { $ script = $ this -> createScript ( $ src , $ isFile ) ; $ scripts = $ this -> headScripts ; array_unshift ( $ scripts , $ script ) ; $ this -> headScripts = $ scripts ; } | Prepend script to header |
19,793 | public function getHeadScripts ( ) { $ output = '' ; foreach ( $ this -> headScripts as $ script ) { $ output .= $ script . "\n" ; } $ output = rtrim ( $ output , "\n" ) ; return $ output ; } | Get header script |
19,794 | public function appendAfterBodyScript ( $ src , $ isFile = true ) { $ this -> afterBodyScripts [ ] = $ this -> createScript ( $ src , $ isFile ) ; } | Append after body script |
19,795 | public function prependAfterBodyScript ( $ src , $ isFile = true ) { $ script = $ this -> createScript ( $ src , $ isFile ) ; $ scripts = $ this -> afterBodyScripts ; array_unshift ( $ scripts , $ script ) ; $ this -> afterBodyScripts = $ scripts ; } | Prepend after body script |
19,796 | public function getAfterBodyScripts ( ) { $ output = '' ; foreach ( $ this -> afterBodyScripts as $ script ) { $ output .= $ script . "\n" ; } $ output = rtrim ( $ output , "\n" ) ; return $ output ; } | Get after body script |
19,797 | protected function findModule ( ) { if ( $ this -> isGreenPage ( ) ) { $ moduleName = $ this -> DesignModule ; if ( $ moduleName ) { return Green :: inst ( ) -> getDesignModule ( $ moduleName ) ; } } $ url = $ this -> request -> getURL ( ) ; foreach ( Green :: inst ( ) -> getDesignModules ( ) as $ module ) { if ( ( str... | Finds the DesignModule object whether through the attached data record or through the public_url match |
19,798 | protected function handleAction ( $ request , $ action ) { $ module = $ this -> findModule ( ) ; if ( ! $ module ) { return parent :: handleAction ( $ request , $ action ) ; } $ data = [ ] ; if ( $ this -> isGreenPage ( ) ) { $ data = $ this -> data ( ) -> toViewableData ( ) ; } elseif ( $ module -> getDataSource ( ) )... | Intercepts the handleAction method to force a customised viewer |
19,799 | public function insert ( array $ values ) { $ batch = true ; foreach ( $ values as $ value ) { if ( ! is_array ( $ value ) ) { $ batch = false ; break ; } } if ( ! $ batch ) { $ values = [ $ values ] ; } $ result = $ this -> collection -> insertMany ( $ values ) ; return ( 1 == ( int ) $ result -> isAcknowledged ( ) ) ... | Insert documents . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.