idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
58,000 | public function publish ( $ language ) { $ translations = $ this -> getTranslationGroups ( $ language -> translations ) ; foreach ( $ translations as $ area => $ groups ) { foreach ( $ groups as $ group => $ items ) { if ( ! isset ( $ this -> hints [ $ group ] ) ) { continue ; } $ path = $ this -> getResourcePath ( $ l... | publish translations from database |
58,001 | protected function putGitignore ( $ area ) { $ target = resource_path ( implode ( DIRECTORY_SEPARATOR , [ 'lang' , $ area , '.gitignore' ] ) ) ; if ( ! file_exists ( $ target ) ) { return $ this -> filesystem -> put ( $ target , "*\n!.gitignore" ) ; } return true ; } | Puts gitignore file in lang directory |
58,002 | protected function getResourcePath ( $ locale , $ area , $ group ) { $ path = resource_path ( implode ( DIRECTORY_SEPARATOR , [ 'lang' , $ area , $ group , $ locale ] ) ) ; if ( $ this -> filesystem -> exists ( $ path ) ) { $ this -> filesystem -> cleanDirectory ( $ path ) ; } else { $ this -> filesystem -> makeDirecto... | Gets resource path |
58,003 | protected function publishTranslations ( $ path , array $ items ) { foreach ( $ items as $ filename => $ translations ) { $ content = "<?php/** * Part of the Antares package. * * NOTICE OF LICENSE * * Licensed under the 3-clause BSD License. * * This source file is subject to the 3-clause BSD License that is * bundled ... | writing translations to files |
58,004 | protected function getTranslationGroups ( Collection $ list ) { $ groups = [ ] ; foreach ( $ list as $ model ) { if ( ! isset ( $ groups [ $ model -> area ] [ $ model -> group ] ) ) { $ groups [ $ model -> area ] [ $ model -> group ] = [ ] ; } $ groups [ $ model -> area ] [ $ model -> group ] = Arr :: add ( $ groups [ ... | grouping translations by component name |
58,005 | public function getEndpointForRequest ( RequestInterface $ request ) : EndpointInterface { $ requestClass = get_class ( $ request ) ; if ( ! isset ( $ this -> endpointsByRequestClass [ $ requestClass ] ) ) { throw new UnsupportedRequestException ( $ requestClass ) ; } return $ this -> endpointsByRequestClass [ $ reques... | Returns the endpoint for the request . |
58,006 | protected function _getAnimateChar ( ) { if ( $ this -> _animateCharNum >= count ( $ this -> _animateChars ) ) { $ this -> _animateCharNum = 0 ; } return $ this -> _animateChars [ $ this -> _animateCharNum ++ ] ; } | Get char for animate |
58,007 | public function animateMessage ( ) { if ( ! $ this -> _showMessage ) { $ this -> _showMessage = true ; $ this -> _animateCharNum = 0 ; $ msg = $ this -> _getWaitMsg ( ) ; $ msg .= ' ' . $ this -> _getAnimateChar ( ) ; $ this -> _consoleOutput -> write ( $ msg , 0 ) ; } else { $ msg = $ this -> _getAnimateChar ( ) ; $ t... | Print message Please wait ... and animate char on console |
58,008 | public function hideMessage ( ) { if ( ! $ this -> _showMessage ) { return ; } $ msg = $ this -> _getWaitMsg ( ) ; $ msg .= ' x' ; $ this -> _consoleOutput -> write ( str_repeat ( "\x08" , mb_strlen ( $ msg ) ) , 0 ) ; $ this -> _showMessage = false ; } | Hide message Please wait ... on console |
58,009 | public function areDirty ( ) { if ( true === parent :: areDirty ( ) ) { return true ; } foreach ( $ this -> getOriginalAll ( ) as $ collection ) { if ( true === $ collection -> isDirty ( ) ) { return true ; } } return false ; } | Extended to also check for dirty states of has - many Collections . |
58,010 | public function calculateChangeSet ( ) { $ set = [ ] ; foreach ( $ this -> getOriginalAll ( ) as $ key => $ collection ) { if ( false === $ collection -> isDirty ( ) ) { continue ; } $ set [ $ key ] = $ collection -> calculateChangeSet ( ) ; } return $ set ; } | Overwritten to account for collection change sets . |
58,011 | function addWidget ( $ region , $ widget , $ priority = 0 ) { if ( ! $ this -> rBoxContainer ) { $ sm = $ this -> getServiceLocator ( ) -> getServiceLocator ( ) ; $ rBoxContainer = $ sm -> get ( 'yimaWidgetator.Widgetizer.Container' ) ; $ this -> rBoxContainer = $ rBoxContainer ; } $ this -> rBoxContainer -> addWidget ... | Add Widget To Region Box Container |
58,012 | function getWidgetManager ( ) { if ( ! $ this -> widgetManager ) { $ sm = $ this -> getServiceLocator ( ) -> getServiceLocator ( ) ; $ widgetManager = $ sm -> get ( 'yimaWidgetator.WidgetManager' ) ; if ( ! ( $ widgetManager instanceof WidgetManager ) || ! ( $ widgetManager instanceof AbstractPluginManager ) ) throw ne... | Get Widget Manager |
58,013 | public function cell ( Int $ spacing , Int $ padding ) : Table { $ this -> attr [ 'cellspacing' ] = $ spacing ; $ this -> attr [ 'cellpadding' ] = $ padding ; return $ this ; } | Sets table cell |
58,014 | public function border ( Int $ border , String $ color = NULL ) : Table { $ this -> attr [ 'border' ] = $ border ; if ( ! empty ( $ color ) ) { $ this -> attr [ 'bordercolor' ] = $ color ; } return $ this ; } | Sets table border |
58,015 | public function size ( Int $ width , Int $ height ) : Table { $ this -> attr [ 'width' ] = $ width ; $ this -> attr [ 'height' ] = $ height ; return $ this ; } | Sets table size |
58,016 | public function style ( Array $ attributes ) : Table { $ attribute = '' ; foreach ( $ attributes as $ key => $ values ) { if ( is_numeric ( $ key ) ) { $ key = $ values ; } $ attribute .= ' ' . $ key . ':' . $ values . ';' ; } $ this -> attr [ 'style' ] = $ attribute ; return $ this ; } | Sets table style attribute |
58,017 | public static function buildLabel ( $ name , $ label = '' , $ required = false ) { $ out = '' ; if ( ! empty ( $ label ) ) { $ class = 'control-label' ; $ requiredLabel = '.req' ; $ requiredSuffix = '<span class="required"><i class="icon-asterisk"></i></span>' ; $ requiredPrefix = '' ; $ requiredClass = 'labelrequired'... | Builds the label html |
58,018 | private static function buildWrapper ( $ field , $ name , $ label = '' , $ checkbox = false , $ required ) { $ getter = 'get' . Inflector :: camelize ( $ name ) ; $ error = null ; $ actual = Session :: instance ( 'ThinForm' ) -> getActual ( ) ; if ( null !== $ actual ) { $ error = $ actual -> getErrors ( ) -> $ getter ... | Builds the Twitter Bootstrap control wrapper |
58,019 | public function getDate ( ) { if ( false === $ this -> frontMatter -> has ( 'date' ) ) { return ( new DateTime ) -> setTimestamp ( $ this -> file -> getMTime ( ) ) ; } $ date = $ this -> frontMatter -> getDate ( ) ; if ( $ date instanceof DateTime ) { return $ date ; } return ( new DateTime ) -> setTimestamp ( $ date )... | Front matter date or filemtime |
58,020 | public function getUri ( ) { if ( $ this -> isIndex ( ) ) { return $ this -> getUriPath ( ) ; } $ path = $ this -> getUriPath ( ) . DIRECTORY_SEPARATOR . $ this -> getFilename ( ) ; return trim ( $ path , DIRECTORY_SEPARATOR ) ; } | URI to the content based on directory path |
58,021 | protected function getUriPath ( ) { $ path = dirname ( $ this -> getPathFromContent ( ) ) ; $ parts = explode ( DIRECTORY_SEPARATOR , $ path ) ; $ uriParts = array_filter ( $ parts , function ( $ dirname ) { return false === $ this -> isTopLevel ( ) ; } ) ; return trim ( implode ( DIRECTORY_SEPARATOR , $ uriParts ) , D... | Returns the URI parts to the Entry up to but not including the slug based on the file location . |
58,022 | public function run ( $ args ) { if ( ! isset ( $ args [ 0 ] ) ) { $ this -> usageError ( 'The environment id is not specified.' ) ; } $ id = $ args [ 0 ] ; $ this -> flush ( ) ; echo "\nCopying environment files... \n" ; $ environmentPath = $ this -> basePath . '/' . $ this -> environmentsDir . '/' . $ id ; if ( ! fil... | Changes the current environment . |
58,023 | private function getChannelList ( ) { if ( empty ( $ this -> channelList ) ) { $ response = $ this -> makeRequest ( 'GET' , 'get_rubric_object_list.json' , [ ] ) ; $ this -> channelList = $ this -> deserialize ( $ response -> getBody ( ) -> getContents ( ) , ChannelList :: class ) ; } return $ this -> channelList ; } | Returns ChannelList containing all channels belonging to the video manager . |
58,024 | private function getChannelIdsInclusiveSubChannels ( $ channelIds ) { $ subChannelIds = [ ] ; foreach ( $ channelIds as $ channelId ) { $ subChannels = $ this -> getChannelList ( ) -> getChildren ( $ channelId ) ; $ subChannelIds = array_merge ( $ subChannelIds , $ subChannels -> map ( function ( Channel $ channel ) { ... | Returns an array containing all channel IDs inclusive sub channels . |
58,025 | public function init ( $ param ) { if ( empty ( $ param ) ) return false ; $ this -> header = '' ; $ param_list = new ParamList ( ) ; foreach ( $ param as $ key => $ value ) { if ( property_exists ( $ this , $ key ) ) $ this -> $ key = $ value ; elseif ( property_exists ( $ param_list , strtolower ( str_replace ( '-' ,... | set the parameters |
58,026 | protected function getSiteByName ( $ sites , $ site_name ) { $ site_found = collect ( $ sites ) -> filter ( function ( $ site ) use ( $ site_name ) { return $ site -> name === $ site_name ; } ) -> first ( ) ; if ( $ site_found ) { return $ site_found ; } return null ; } | Get forge site from sites by name . |
58,027 | protected function getSite ( $ sites , $ site_id ) { $ site_found = collect ( $ sites ) -> filter ( function ( $ site ) use ( $ site_id ) { return $ site -> id === $ site_id ; } ) -> first ( ) ; if ( $ site_found ) { return $ site_found ; } return null ; } | Get forge site from sites . |
58,028 | protected function getSiteName ( $ sites , $ site_id ) { if ( $ site = $ this -> getSite ( $ sites , $ site_id ) ) { return $ site -> name ; } return null ; } | Get forge site name from site id . |
58,029 | protected function getSiteId ( $ sites , $ site_name ) { if ( $ site = $ this -> getSiteByName ( $ sites , $ site_name ) ) { return $ site -> id ; } return null ; } | Get forge site id from site name . |
58,030 | public function isItemInventoried ( Mage_Sales_Model_Quote_Item $ item ) { if ( $ item -> getParentItemId ( ) || $ item -> getParentItem ( ) ) { return false ; } if ( $ item -> getHasChildren ( ) ) { foreach ( $ item -> getChildren ( ) as $ childItem ) { $ childStock = $ childItem -> getProduct ( ) -> getStockItem ( ) ... | Test if the item needs to have its quantity checked for available inventory . |
58,031 | protected function isManagedStock ( Mage_CatalogInventory_Model_Stock_Item $ stock ) { return ( ( $ this -> _config -> isBackorderable || ( int ) $ stock -> getBackorders ( ) === Mage_CatalogInventory_Model_Stock :: BACKORDERS_NO ) && $ stock -> getManageStock ( ) > 0 ) ; } | If the inventory configuration allow order item to be backorderable simply check if the Manage stock for the item is greater than zero . Otherwise if the inventory configuration do not allow order items to be backorderable then ensure the item is not backorder and has manage stock . |
58,032 | public function getTagsList ( ) { $ return = "" ; $ tags = $ this -> Tags ( ) -> column ( "Title" ) ; $ this -> extend ( "updateTagsList" , $ tags ) ; return implode ( $ this -> config ( ) -> list_seperator , $ tags ) ; } | Generate as string of tag titles seperated by a comma |
58,033 | public function getListsList ( ) { $ return = "" ; $ list = $ this -> Lists ( ) -> column ( "Title" ) ; $ this -> extend ( "updateListsList" , $ tags ) ; return implode ( $ this -> config ( ) -> list_seperator , $ list ) ; } | Generate as string of list titles seperated by a comma |
58,034 | public function onBeforeDelete ( ) { parent :: onBeforeDelete ( ) ; foreach ( $ this -> Locations ( ) as $ item ) { $ item -> delete ( ) ; } foreach ( $ this -> Notes ( ) as $ item ) { $ item -> delete ( ) ; } } | Cleanup DB on removal |
58,035 | protected function getPrivateNodes ( ) { if ( ! Member :: currentUserID ( ) ) { return array ( ) ; } $ groups = Member :: currentUser ( ) -> Groups ( ) -> column ( ) ; if ( ! count ( $ groups ) ) { return $ groups ; } $ fields = $ this -> queryFields ( ) ; $ query = new SQLQuery ( $ fields , '"' . $ this -> baseClass .... | Get private nodes assuming SilverStripe s default perm structure |
58,036 | public function createMenuNode ( $ data ) { $ cls = $ this -> itemClass ; $ node = $ cls :: create ( $ data , $ this ) ; $ this -> items [ $ node -> ID ] = $ node ; return $ node ; } | Creates a menu item from an array of data |
58,037 | public function toHandler ( $ command ) { $ class = get_class ( $ command ) ; $ offset = ( $ this -> positionAt ( 'Command' , $ class ) ) ? : $ this -> positionAt ( 'Request' , $ class ) ; $ handlerClass = substr_replace ( $ class , 'Handler' , $ offset ) ; if ( ! class_exists ( $ handlerClass ) ) { $ message = "Comman... | Translate a command to its respective handler . |
58,038 | public function toValidator ( $ command ) { $ class = get_class ( $ command ) ; $ offset = ( $ this -> positionAt ( 'Command' , $ class ) ) ? : $ this -> positionAt ( 'Request' , $ class ) ; return substr_replace ( $ class , 'Validator' , $ offset ) ; } | Translate a command to its respective validator . |
58,039 | public function onTranslationList ( ) { $ this -> breadcrumbs -> register ( 'translations' , function ( $ breadcrumbs ) { $ breadcrumbs -> push ( 'Translations' , handles ( 'antares::translations/index/' . area ( ) ) ) ; } ) ; $ this -> shareOnView ( 'translations' ) ; } | on translations list |
58,040 | public function onLanguageAdd ( ) { $ this -> onTranslationList ( ) ; $ this -> breadcrumbs -> register ( 'languages' , function ( $ breadcrumbs ) { $ breadcrumbs -> parent ( 'translations' ) ; $ breadcrumbs -> push ( 'Languages' , handles ( 'antares::translations/languages/index' ) ) ; } ) ; $ this -> breadcrumbs -> r... | on language add |
58,041 | public function onImportTranslations ( ) { $ this -> onTranslationList ( ) ; $ this -> breadcrumbs -> register ( 'translations-import' , function ( $ breadcrumbs ) { $ breadcrumbs -> parent ( 'translations' ) ; $ breadcrumbs -> push ( 'Import translations' ) ; } ) ; $ this -> shareOnView ( 'translations-import' ) ; } | on import translations |
58,042 | public function onLanguagesList ( ) { $ this -> breadcrumbs -> register ( 'translations' , function ( $ breadcrumbs ) { $ breadcrumbs -> push ( 'Translations' , handles ( 'antares::translations/index/' . area ( ) ) , [ 'force_link' => true ] ) ; } ) ; $ this -> shareOnView ( 'translations' ) ; } | On languages list |
58,043 | public function ajaxIndexAction ( Request $ request ) : Response { if ( ! $ request -> isXmlHttpRequest ( ) ) { return $ this -> redirectToAction ( 'index' ) ; } $ attributeGroupId = ( int ) $ request -> request -> get ( 'id' ) ; $ attributeGroup = $ this -> getManager ( ) -> findAttributeGroup ( $ attributeGroupId ) ;... | Ajax action for listing attributes in variants editor |
58,044 | public function ajaxAddAction ( Request $ request ) : Response { if ( ! $ request -> isXmlHttpRequest ( ) ) { return $ this -> redirectToAction ( 'index' ) ; } $ attributeName = $ request -> request -> get ( 'name' ) ; $ attributeGroupId = ( int ) $ request -> request -> get ( 'set' ) ; try { $ attribute = $ this -> ge... | Adds new attribute value using ajax request |
58,045 | public static function createFromPath ( $ path ) { if ( ! is_dir ( $ path ) || ! is_readable ( $ path ) ) { throw new \ LogicException ( sprintf ( '%s does not exist or is not readable.' , $ path ) ) ; } return static :: createFromFilesystem ( new Filesystem ( new Local ( $ path ) ) ) ; } | Creates a Memory adapter from a filesystem folder . |
58,046 | public static function createFromFilesystem ( FilesystemInterface $ filesystem ) { $ filesystem -> addPlugin ( new ListWith ( ) ) ; $ adapter = new static ( ) ; $ config = new Config ( ) ; foreach ( $ filesystem -> listWith ( [ 'timestamp' , 'visibility' ] , '' , true ) as $ meta ) { if ( $ meta [ 'type' ] === 'dir' ) ... | Creates a Memory adapter from a Flysystem filesystem . |
58,047 | protected function emptyDirectory ( $ directory ) { foreach ( $ this -> doListContents ( $ directory , true ) as $ path ) { $ this -> deletePath ( $ path ) ; } } | Empties a directory . |
58,048 | protected function ensureSubDirs ( $ directory , Config $ config = null ) { $ config = $ config ? : new Config ( ) ; return $ this -> createDir ( Util :: dirname ( $ directory ) , $ config ) ; } | Ensures that the sub - directories of a directory exist . |
58,049 | protected function getFileKeys ( $ path , array $ keys ) { if ( ! $ this -> hasFile ( $ path ) ) { return false ; } return $ this -> getKeys ( $ path , $ keys ) ; } | Returns the keys for a file . |
58,050 | protected function getKeys ( $ path , array $ keys ) { if ( ! $ this -> has ( $ path ) ) { return false ; } $ return = [ ] ; foreach ( $ keys as $ key ) { if ( $ key === 'path' ) { $ return [ $ key ] = $ path ; continue ; } $ return [ $ key ] = $ this -> storage [ $ path ] [ $ key ] ; } return $ return ; } | Returns the keys for a path . |
58,051 | public function moveUpAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ resource = $ context -> getResource ( ) ; $ this -> isGranted ( 'EDIT' , $ resource ) ; $ this -> move ( $ resource , - 1 ) ; return $ this -> redirectToReferer ( $ this -> generateUrl ( $ this -> config -> getRoute... | Move up the resource . |
58,052 | protected function move ( $ resource , $ movement ) { $ resource -> setPosition ( $ resource -> getPosition ( ) + $ movement ) ; $ event = $ this -> getOperator ( ) -> update ( $ resource ) ; $ event -> toFlashes ( $ this -> getFlashBag ( ) ) ; } | Move the resource . |
58,053 | public function getAnchors ( ) { $ list = ArrayList :: create ( ) ; if ( $ page = $ this -> getCurrentPage ( Page :: class ) ) { $ html = HTMLValue :: create ( $ page -> Content ) ; $ anchors = $ html -> query ( "//*[@id]" ) ; foreach ( $ anchors as $ anchor ) { $ list -> push ( ArrayData :: create ( [ 'Link' => $ page... | Answers an array list of anchors identified within the current page content . |
58,054 | function assertToken ( $ tokenStr ) { if ( false === $ token = $ this -> _accessTokens -> findByIdentifier ( ( string ) $ tokenStr ) ) throw new exOAuthAccessDenied ; $ accessToken = new AccessTokenEntity ( new HydrateGetters ( $ token ) ) ; return $ accessToken ; } | Validate Authorize Token With OAuth Server |
58,055 | function getType ( ) { if ( $ this -> _type ) { return $ this -> _type ; } else { $ myclass = get_class ( $ this ) ; return strtolower ( substr ( $ myclass , strrpos ( $ myclass , '\\' ) + 1 , - 5 ) ) ; } } | This essentially returns the field s class name without the Field part . |
58,056 | public function setUri ( $ uri ) { if ( null !== $ uri && ! is_string ( $ uri ) ) { require_once 'Zend/Navigation/Exception.php' ; throw new Zend_Navigation_Exception ( 'Invalid argument: $uri must be a string or null' ) ; } $ this -> _uri = $ uri ; return $ this ; } | Sets page URI |
58,057 | public function resolve ( ) { $ this -> page -> setName ( $ this -> name ) -> setOnline ( ! empty ( $ this -> online ) ) -> setTitle ( $ this -> title ) -> setMeta ( array ( 'title' => $ this -> title ) ) -> setPath ( $ this -> getFullPath ( ) ) ; $ this -> assertEntityIsValid ( $ this -> page , array ( 'Page' , 'creat... | Page creation method . |
58,058 | protected function generateFullPath ( ) { return $ this -> fullPath = $ this -> pathGenerator -> generatePath ( $ this -> page , $ this -> path ? : '' ) ; } | Generate page full path . |
58,059 | protected function _sendRequest ( ) { $ logger = $ this -> _logger ; $ logContext = $ this -> _logContext ; $ response = null ; try { $ response = $ this -> _api -> setRequestBody ( $ this -> _request ) -> send ( ) -> getResponseBody ( ) ; } catch ( InvalidPayload $ e ) { $ logMessage = "Invalid payload for {$this->_ge... | Sending the payload request and returning the response . |
58,060 | public function setCacheAdapter ( AdapterAbstract $ adapter ) { if ( $ this -> isSetup ) { $ e = new ApplicationIsAlreadySetupException ( 'You cannot set the cache after calling setup()' ) ; $ this -> error ( $ e ) ; } $ this -> cache = $ adapter ; } | Set an application level cache adapter . This adapter will be made available to all runnables |
58,061 | public function setup ( ) { $ this -> request = new Request ( ) ; $ this -> response = new Response ( ) ; $ this -> env = new Environment ( ) ; $ this -> mode = $ this -> env -> getMode ( ) ; if ( ! $ this -> env -> isProduction ( ) || $ this -> cache == null ) { $ this -> cache = new AdapterNull ( ) ; } $ this -> load... | Setup the application assigns all the packages config routes |
58,062 | private function loadPackages ( ) { foreach ( $ this -> packages as $ package ) { $ this -> packagesMetadata [ $ package -> getPackageName ( ) ] = array ( 'namespace' => $ package -> getNamespace ( ) , 'route_path' => $ package -> getRoutePath ( ) , 'config_path' => $ package -> getConfigPath ( ) , 'package_path' => $ ... | Load the package metadata from the given list |
58,063 | private function getRunnable ( $ package , $ class , $ method , $ className ) { $ view = $ this -> getViewFor ( $ package , $ class , $ method ) ; $ instance = new $ className ( $ this -> request , $ this -> response , $ view , $ this -> env , $ this -> cache , $ this -> router , $ this -> config ) ; $ instance -> init... | Get the corresponding runnable for the given parameters |
58,064 | private function getViewFor ( $ package , $ class , $ method ) { $ view = new View ( $ this , $ package , $ class , $ method ) ; $ view -> setRouter ( $ this -> router ) ; $ view -> setConfig ( $ this -> config ) ; return $ view ; } | Retrieve an instance of View for a given package class method combination |
58,065 | public function request ( DOMDocument $ doc , $ xsdName , $ uri , $ timeout = self :: DEFAULT_TIMEOUT , $ adapter = self :: DEFAULT_ADAPTER , Zend_Http_Client $ client = null , $ apiKey = null ) { if ( ! $ apiKey ) { $ apiKey = Mage :: helper ( 'radial_core' ) -> getConfigModel ( ) -> apiKey ; } $ xmlStr = $ doc -> C14... | Call the API . |
58,066 | protected function _processResponse ( Zend_Http_Response $ response , $ uri ) { $ this -> _status = $ response -> getStatus ( ) ; $ config = $ this -> _getHandlerConfig ( $ this -> _getHandlerKey ( $ response ) ) ; $ logMethod = isset ( $ config [ 'logger' ] ) ? $ config [ 'logger' ] : 'debug' ; $ logData = array_merge... | log the response and return the result of the configured handler method . |
58,067 | public function schemaValidate ( DOMDocument $ doc , $ xsdName ) { $ errors = array ( ) ; set_error_handler ( function ( $ errno , $ errstr ) use ( & $ errors ) { $ errors [ ] = "'$errstr' [Errno $errno]" ; } ) ; $ cfg = Mage :: helper ( 'radial_core' ) -> getConfigModel ( ) ; $ isValid = $ doc -> schemaValidate ( Mage... | Validates the DOM against a validation schema which should be a full path to an xsd for this DOMDocument . |
58,068 | protected function _processException ( Zend_Http_Client_Exception $ exception , $ uri ) { $ this -> _status = 0 ; $ config = $ this -> _getHandlerConfig ( $ this -> _getHandlerKey ( ) ) ; $ logMethod = isset ( $ config [ 'logger' ] ) ? $ config [ 'logger' ] : 'debug' ; $ logData = array_merge ( [ 'rom_request_url' => $... | handle the exception thrown by the zend client and return the result of the configured handler . |
58,069 | protected function _getHandlerKey ( Zend_Http_Response $ response = null ) { if ( $ response ) { $ code = $ response -> getStatus ( ) ; if ( $ response -> isSuccessful ( ) || $ response -> isRedirect ( ) ) { return 'success' ; } elseif ( $ code < 500 && $ code >= 400 ) { return 'client_error' ; } elseif ( $ code >= 500... | return a string that is a key to the handler config for the class of status codes . |
58,070 | public function input ( $ buffer , $ connection ) { $ len = strlen ( $ buffer ) ; if ( $ this -> max_packet_size > 0 && $ len >= $ this -> max_packet_size ) { throw new \ Exception ( $ connection . ' request packet size exceed max_packet_size ' , Server :: ERROR_LARGE_PACKET ) ; } return $ len ; } | Determines whether the current connection has received the complete packet zero value indicates that a complete packet is not received yet positive value indicates that a complete packet has been received and represents the number of bytes of the packet negative value indicates that the data is invalid or unrecognized |
58,071 | public function body ( ) { $ event = [ ] ; if ( ! empty ( $ this -> replyToken ) ) { $ event [ 'replyToken' ] = $ this -> replyToken ; } $ event [ 'type' ] = $ this -> eventType ( ) ; $ event [ 'timestamp' ] = time ( ) ; $ event [ 'source' ] = $ this -> source ; $ event [ 'message' ] = $ this -> message ; $ result = [ ... | Build webhook event and return body . Original webhook request body has this signature . |
58,072 | public function getCustomConfig ( $ name = '' ) { $ custom_config = $ this -> getConfigByName ( 'custom' ) ; return $ name ? ( $ custom_config [ $ name ] ?? null ) : $ custom_config ; } | Get Custom Configuration |
58,073 | public function getConfigByName ( $ config_name ) { if ( $ this -> isSingle ( ) ) { if ( isset ( $ this -> containers [ 'config' ] ) ) { return $ this -> containers [ 'config' ] -> get ( $ config_name ) ; } } return [ ] ; } | Get Configuration By Name |
58,074 | public function getUrlManagerConfig ( $ item ) { $ urlManager = $ this -> getConfigByName ( 'urlManager' ) ; if ( isset ( $ urlManager [ $ item ] ) ) { return $ urlManager [ $ item ] ; } return false ; } | Get Url Manager Config By Item Name |
58,075 | public function getJsFiles ( $ controller_id , $ template_id ) { $ js_files = [ ] ; $ asset_config = $ this -> getConfigByName ( 'assets' ) ; if ( isset ( $ asset_config [ $ controller_id ] [ $ template_id ] [ 'js' ] ) ) { $ js_files = $ asset_config [ $ controller_id ] [ $ template_id ] [ 'js' ] ; } return $ js_files ... | Get Js Files |
58,076 | public function getCssFiles ( $ controller_id , $ template_id ) { $ css_files = [ ] ; $ asset_config = $ this -> getConfigByName ( 'assets' ) ; if ( isset ( $ asset_config [ $ controller_id ] [ $ template_id ] [ 'css' ] ) ) { $ css_files = $ asset_config [ $ controller_id ] [ $ template_id ] [ 'css' ] ; } return $ css_... | Get Css Files |
58,077 | public function prepare ( $ content , ThemeInterface $ theme , TemplateInterface $ template , ZoneInterface $ zone , ComponentInterface $ component ) { $ this -> contextStack -> push ( $ this -> contextBuilder -> setContent ( $ content ) -> setTheme ( $ theme ) -> setTemplate ( $ template ) -> setZone ( $ zone ) -> set... | Prepare decorator context . |
58,078 | protected function usePropertyOptions ( $ selector , $ content , $ type ) { $ this -> isBootstrapAttribute ( 'on' , function ( $ return ) use ( $ type ) { $ this -> settings [ 'attr' ] [ 'on' ] = Base :: suffix ( $ return , '.bs.' . $ type ) ; } ) ; return $ this -> bootstrapObjectOptions ( $ selector === 'all' ? '[dat... | Protected use property options |
58,079 | public static function json ( $ json , $ member = '' , $ default_key = '' ) { return self :: option_group ( json_decode ( $ json , true ) , $ member , $ default_key ) ; } | Takes a JSON object as a string to convert to query string keys . |
58,080 | public static function yaml ( $ yaml , $ member = '' , $ default_key = '' ) { return self :: option_group ( sfYaml :: load ( $ yaml ) , $ member , $ default_key ) ; } | Takes a YAML object as a string to convert to query string keys . |
58,081 | public static function create ( $ reason ) : self { $ arguments = func_get_args ( ) ; switch ( $ reason ) { case static :: CLASS_DOES_NOT_EXIST : $ message = sprintf ( 'Class %s does not exist. Cannot retrieve its metadata' , $ arguments [ 1 ] ) ; return new static ( $ message ) ; case static :: VALUE_IS_NOT_AN_OBJECT ... | Create a new instance of InvalidArgumentException with meaningful message . |
58,082 | public static function getPatternFor ( Pattern $ parent , $ word ) { if ( self :: isWildcard ( $ word ) ) { return self :: getWildcardPattern ( $ parent , $ word ) ; } return new Word ( $ word ) ; } | Builds a pattern node based on a given word and its parent . |
58,083 | protected function loadFromStore ( ) { if ( false === $ this -> isLoaded ( ) ) { $ models = $ this -> store -> loadCollection ( $ this ) ; $ this -> setModels ( $ models ) ; $ this -> loaded = true ; } } | Loads this collection from the store . |
58,084 | public function setDelay ( $ delay ) { if ( ! ctype_digit ( ( string ) $ delay ) ) { throw new \ InvalidArgumentException ( 'Delay must be a number.' ) ; } $ this -> delay = $ delay ; return $ this ; } | The time it takes for the handler to respond . |
58,085 | public function start ( ) { $ this -> workerHandlerReady = true ; $ this -> serviceStreamReady = true ; $ this -> sendToService ( new ActionListRequest ( ) ) ; } | Initializes the worker . |
58,086 | public function process ( ) { if ( $ this -> worker -> getState ( ) == Worker :: INVALID ) { throw new \ RuntimeException ( 'Invalid state to process.' ) ; } $ expiry = 5000 + $ this -> delay ; if ( $ this -> worker -> isExpired ( $ expiry ) ) { $ this -> getLogger ( ) -> debug ( 'Worker is expired, no longer registere... | Perform one service cycle . This method checks whether there are any new requests to be handled either from the Worker Handler or from the Service . |
58,087 | protected function createWorkerHandlerStream ( Socket $ socket ) { $ socket -> setId ( 'manager' ) ; $ this -> getPoller ( ) -> add ( $ socket , ZMQ :: POLL_IN ) ; $ that = $ this ; $ this -> workerHandlerStream = $ socket -> getStream ( ) ; $ this -> workerHandlerStream -> addListener ( StreamInterface :: MESSAGE , fu... | Creates a socket to communicate with the worker handler . |
58,088 | protected function createServiceStream ( Socket $ socket ) { $ socket -> setId ( 'worker_service' ) ; $ this -> getPoller ( ) -> add ( $ socket , ZMQ :: POLL_IN ) ; $ that = $ this ; $ this -> serviceStream = $ socket -> getStream ( ) ; $ this -> serviceStream -> addListener ( StreamInterface :: MESSAGE , function ( Me... | Creates a socket to communicate with the service . |
58,089 | public function onWorkerHandlerMessage ( MessageInterface $ msg ) { $ this -> workerHandlerReady = true ; $ this -> worker -> touch ( ) ; if ( $ msg instanceof Destroy ) { $ this -> worker -> setState ( Worker :: INVALID ) ; return ; } if ( $ msg instanceof ExecuteJobRequest ) { $ this -> startJob ( $ msg ) ; return ; ... | Handles a Message from the Worker Handler . |
58,090 | private function handleHeartbeatResponse ( ) { $ state = $ this -> worker -> getState ( ) ; if ( Worker :: BUSY == $ state ) { return ; } if ( Worker :: RESULT_AVAILABLE == $ state ) { $ this -> handleResult ( ) ; return ; } if ( in_array ( $ state , array ( Worker :: READY , Worker :: RESULT , Worker :: REGISTER ) ) )... | Handles the heartbeat response from the worker handler . |
58,091 | public function onServiceMessage ( MessageInterface $ msg ) { $ this -> serviceStreamReady = true ; $ this -> getLogger ( ) -> debug ( 'Received Service Message of Type: ' . get_class ( $ msg ) ) ; if ( $ msg instanceof ActionListResponse ) { $ actions = $ msg -> getActions ( ) ; $ this -> getLogger ( ) -> debug ( 'The... | Handles a Message from the Service Handler . |
58,092 | public function startJob ( ExecuteJobRequest $ request ) { $ this -> worker -> setState ( Worker :: BUSY ) ; $ requestId = $ request -> getRequestId ( ) ; $ action = $ request -> getAction ( ) ; if ( ! $ this -> worker -> hasAction ( $ action ) ) { $ this -> getLogger ( ) -> debug ( 'Action ' . $ action . ' not found.'... | Starts a Job . |
58,093 | public function heartbeat ( ) { $ state = $ this -> worker -> getState ( ) ; if ( ! in_array ( $ state , array ( Worker :: BUSY , Worker :: READY ) ) ) { return ; } $ timeout = 2500 ; if ( ! $ this -> worker -> isExpired ( $ timeout ) ) { return ; } if ( $ this -> isWorkerHandlerReady ( ) ) { $ this -> sendToWorkerHand... | Performs a heartbeat with the Worker Handler . |
58,094 | public function handleResult ( ) { $ result = $ this -> worker -> getResult ( ) ; if ( $ result === null ) { return ; } if ( ! $ this -> isWorkerHandlerReady ( ) ) { return ; } $ this -> sendToWorkerHandler ( new Protocol \ JobResult ( $ this -> worker -> getRequestId ( ) , $ result ) ) ; $ this -> worker -> setState (... | Sends when the Service is done working this sends the result to the Worker Handler . |
58,095 | public function sendToWorkerHandler ( MessageInterface $ msg ) { if ( ! $ this -> isWorkerHandlerReady ( ) ) { $ this -> getLogger ( ) -> debug ( 'WorkerHandler socket not ready to send.' ) ; return ; } $ this -> workerHandlerReady = false ; $ this -> workerHandlerStream -> send ( $ msg ) ; } | Send the given Message to the Worker Handler . |
58,096 | public function sendToService ( MessageInterface $ msg ) { if ( ! $ this -> isServiceStreamReady ( ) ) { $ this -> getLogger ( ) -> debug ( 'Service socket not ready to send.' ) ; return ; } $ this -> getLogger ( ) -> debug ( 'Sending to service.' ) ; $ this -> serviceStreamReady = false ; $ this -> serviceStream -> se... | Send the given Message to the Service . |
58,097 | public function finish ( ) { $ writer = $ this -> writer ; if ( ! $ writer ) { $ writer = PHPExcel_IOFactory :: createWriter ( $ this -> excel , $ this -> format ) ; } $ writer -> save ( $ this -> filename ) ; } | Finish the writer . |
58,098 | private function delegateAuthenticator ( TokenInterface $ token ) { if ( ! $ authenticator = $ this -> resolveAuthenticator ( $ token ) ) { throw new \ RuntimeException ( sprintf ( 'No authentication authenticator found for token: "%s".' , get_class ( $ token ) ) ) ; } return $ authenticator ; } | Delegate a authenticator for a token . |
58,099 | private function resolveAuthenticator ( TokenInterface $ token ) { foreach ( $ this -> authenticators as $ authenticator ) { if ( $ authenticator -> supports ( $ token ) ) { return $ authenticator ; } } return false ; } | Resolve a token to its authenticator . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.