idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
238,900 | public function remove ( $ key ) { $ this -> validateKey ( $ key ) ; if ( $ this -> has ( $ key ) ) { unset ( $ this -> params [ $ key ] ) ; return true ; } else { return false ; } } | Return all parameters with the given key . |
238,901 | public function replace ( array $ new ) { foreach ( $ new as $ key => $ values ) { $ this -> validateKey ( $ key ) ; if ( ! is_array ( $ values ) ) { $ values = $ new [ $ key ] = [ $ values ] ; } foreach ( $ values as $ v ) { $ this -> validateValue ( $ v ) ; } } foreach ( $ new as $ key => $ values ) { $ this -> setAr... | Sets several new parameters replacing the old values if already present . |
238,902 | public function getArray ( $ key ) { $ this -> validateKey ( $ key ) ; return $ this -> has ( $ key ) ? $ this -> params [ $ key ] : [ ] ; } | Returns all values of the parameters with the given key . If no parameter with the given key exists an empty array is returned . |
238,903 | public function toArray ( $ onlyFirst = false ) { $ r = [ ] ; foreach ( $ this -> params as $ key => $ values ) { $ r [ $ key ] = $ onlyFirst ? $ values [ 0 ] : $ values ; } return $ r ; } | Get all parameters as an associative array with the parameter keys as array keys . Returns either only the first values of the parameters or all values of the parameters . |
238,904 | public function count ( $ key = null ) { if ( is_null ( $ key ) ) { return count ( $ this -> params ) ; } return count ( $ this -> getArray ( $ key ) ) ; } | Counts the parameters . Parameter keys that appear multiple times count as one array parameter . |
238,905 | function isProperty ( ) { $ i = $ this -> getAnnotationIndex ( self :: PROPERTY ) ; if ( $ i >= 0 ) { $ this -> format = $ this -> annotations [ $ i ] -> format ; return true ; } else { return false ; } } | Checks if this property is indeed a property . |
238,906 | function getValue ( $ entity ) { $ raw = $ this -> property -> getValue ( $ entity ) ; switch ( $ this -> format ) { case 'scalar' : return $ raw ; case 'object' : case 'array' : return serialize ( $ raw ) ; case 'json' : return json_encode ( $ raw ) ; case 'date' : if ( $ raw ) { $ value = clone $ raw ; $ value -> set... | Gets this property s value in the given entity . |
238,907 | function setValue ( $ entity , $ value ) { switch ( $ this -> format ) { case 'scalar' : $ this -> property -> setValue ( $ entity , $ value ) ; break ; case 'object' : case 'array' : $ this -> property -> setValue ( $ entity , unserialize ( $ value ) ) ; break ; case 'json' : $ this -> property -> setValue ( $ entity ... | Sets this property s value in the given entity . |
238,908 | function matches ( $ names ) { foreach ( func_get_args ( ) as $ name ) { if ( 0 === strcasecmp ( $ name , $ this -> name ) || 0 === strcasecmp ( $ name , $ this -> property -> getName ( ) ) || 0 === strcasecmp ( $ name , Reflection :: normalizeProperty ( $ this -> property -> getName ( ) ) ) ) { return true ; } } retur... | Checks if a supplied name matches this property s name . |
238,909 | private function validateAnnotations ( ) { $ count = 0 ; foreach ( $ this -> annotations as $ a ) { if ( strrpos ( get_class ( $ a ) , self :: ANNOTATION_NAMESPACE ) !== false ) { $ count ++ ; } } switch ( $ count ) { case 0 : return ; case 1 : if ( $ this -> getAnnotationIndex ( self :: INDEX ) < 0 ) { return ; } thro... | Validates the annotation combination on a property . |
238,910 | private function getAnnotationIndex ( $ name ) { for ( $ i = 0 ; $ i < count ( $ this -> annotations ) ; $ i ++ ) { if ( $ this -> annotations [ $ i ] instanceof $ name ) { return $ i ; } } return - 1 ; } | Gets the index of a annotation with the value specified or - 1 if it s not in the annotations array . |
238,911 | protected function update ( $ keyValue = null , String $ key , String $ table , Array $ properties = [ ] ) { if ( isset ( $ properties [ $ key ] ) ) { unset ( $ properties [ $ key ] ) ; } $ this -> queryBuilder ( ) -> where ( $ key , $ keyValue ) -> update ( $ table , $ properties ) ; } | Updates an existing record in the database table . |
238,912 | public function add ( $ index , $ data = null , $ toAdmin = false ) { if ( ! $ this -> has ( $ index ) ) { $ this -> data = Arr :: add ( $ this -> data , $ index , $ data ) ; $ this -> metas = Arr :: add ( $ this -> metas , $ this -> firstIndex ( $ index ) , [ 'admin' => $ toAdmin ] ) ; } return $ this ; } | Append new data |
238,913 | public function toJson ( $ admin = false ) { $ data = $ this -> prepareDataToJson ( $ admin ) ; if ( count ( $ data ) == 0 ) { return '{}' ; } return json_encode ( $ data ) ; } | Return the data as JSON |
238,914 | public function load ( ) { if ( false === $ this -> isLoaded ) { $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.pre' , $ this , [ ] ) ; $ this -> generate ( ) ; $ this -> injectBlocks ( ) ; $ this -> isLoaded = true ; $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.post' , $ this , [ ] ) ; } re... | inject blocks into the root view model |
238,915 | private function isAllowed ( $ blockId , ModelInterface $ block ) { $ result = $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ , $ this , [ 'block_id' => $ blockId , 'block' => $ block ] ) ; if ( $ result -> stopped ( ) ) { return $ result -> last ( ) ; } return true ; } | Determines whether a block should be allowed given certain parameters |
238,916 | public function addBlock ( $ blockId , ModelInterface $ block ) { $ this -> blockPool -> add ( $ blockId , $ block ) ; return $ this ; } | adds a block to the registry |
238,917 | protected function prepareDataForEntity ( array $ data ) { foreach ( $ this -> getMapper ( ) -> getTable ( ) -> getColumns ( ) as $ name => $ Column ) { if ( array_key_exists ( $ name , $ data ) === false ) { if ( $ Column -> isPk ( ) ) { $ data [ $ name ] = null ; } else if ( $ Column -> isNullable ( ) === false ) { t... | Makes sure data defined in the Entity is in proper format and all keys are set |
238,918 | protected function getNodes ( ReadBlockInterface $ block ) { $ nodes = null ; $ nodeName = $ block -> getAttribute ( 'nodeName' ) ; $ siteId = $ this -> currentSiteManager -> getSiteId ( ) ; if ( ! is_null ( $ nodeName ) ) { $ nodes = $ this -> nodeRepository -> getSubMenu ( $ nodeName , $ block -> getAttribute ( 'nbLe... | Get nodes to display |
238,919 | public static function defaultCommandFactory ( Description $ description ) { return function ( $ name , array $ args = [ ] , GuzzleClientInterface $ client ) use ( $ description ) { $ operation = null ; if ( $ description -> hasOperation ( $ name ) ) { $ operation = $ description -> getOperation ( $ name ) ; } else { $... | We re overriding this to support operation - specific requestion options . Currently this is for disabling auth on specific operations . |
238,920 | protected function processConfig ( array $ config ) { $ config [ 'command_factory' ] = self :: defaultCommandFactory ( $ this -> getDescription ( ) ) ; parent :: processConfig ( array_merge ( $ config , [ 'process' => false , ] ) ) ; if ( ! isset ( $ config [ 'process' ] ) || $ config [ 'process' ] === true ) { $ this ... | We re overriding this to use our command factory from above and to use custom objects for API results . |
238,921 | private function mapElements ( array $ elements , array $ mainElements , array & $ map , array & $ inverse ) : void { foreach ( $ elements as $ index => $ element ) { $ elementId = ( int ) $ element [ 'id' ] ; if ( ! array_key_exists ( $ index , $ mainElements ) ) { $ this -> logger -> warning ( 'Content element {id} h... | Map the passed elements . |
238,922 | public function authenticate ( string $ auth ) { if ( $ this -> router === null ) { return ; } try { $ response = $ this -> router -> authenticate ( $ auth , 'Basic' ) ; if ( ! ( $ response instanceof Response ) ) { $ response = new Response ; $ response -> status = HttpResponse :: HTTP_NO_CONTENT ; } $ response -> out... | Authenticates a Basic Authorization Header |
238,923 | public function run ( string $ method , string $ uri , array $ headers , string $ body ) { if ( $ this -> router === null ) { return ; } try { $ response = $ this -> router -> run ( $ method , $ uri , $ headers , $ body ) ; if ( $ response !== null ) { $ response -> output ( ) ; } } catch ( RouterException $ e ) { $ e ... | Runs the Router and outputs the Response |
238,924 | protected function createAssignment ( ) { $ url = config ( 'forge-publish.url' ) . config ( 'forge-publish.store_assignment_uri' ) ; try { $ response = $ this -> http -> post ( $ url , [ 'form_params' => [ 'name' => $ this -> assignmentName , 'repository_uri' => $ this -> repository_uri , 'repository_type' => $ this ->... | Create assignment . |
238,925 | public function close ( ) { if ( ! $ this -> link -> close ( ) ) { throw new DbException ( 'can\'t close database connection: ' . $ this -> link -> error , $ this -> link -> errno ) ; } return true ; } | Closes the connection . |
238,926 | protected function assembleComponent ( $ element ) { $ options = $ this -> getOptions ( ) ; $ element = parent :: __invoke ( $ element ) ; $ component = sprintf ( '<div style="padding: 0;" class="input-append color %s" data-color="%s" data-color-format="%s">%s' , $ options [ 'class' ] , $ options [ 'color' ] , $ option... | Put together the colorpicker component . |
238,927 | protected function prepareElement ( $ element ) { $ options = $ this -> getOptions ( ) ; $ currClass = $ element -> getAttribute ( 'class' ) ; $ class = $ currClass . ( null !== $ currClass ? ' ' : '' ) . $ options [ 'class' ] ; $ element -> setAttributes ( array ( 'class' => $ class , 'data-color' => $ options [ 'colo... | Prepare the element by applying all changes to it required for the colorpicker . |
238,928 | protected function setOptions ( $ options ) { $ options = array_merge ( array ( 'format' => 'hex' , 'invoke_inline' => false , 'include_dependencies' => false , 'as_component' => false , 'class' => 'colorpicker' , ) , $ options ) ; if ( ! in_array ( $ options [ 'format' ] , array ( 'hex' , 'rgb' , 'rgba' ) ) ) { throw ... | Set the options for the colorpicker . |
238,929 | protected function includeDependencies ( ) { $ view = $ this -> getView ( ) ; $ view -> headScript ( ) -> appendFile ( $ view -> basePath ( ) . '/js/bootstrap-colorpicker.js' ) ; $ view -> headLink ( ) -> prependStylesheet ( $ view -> basePath ( ) . '/css/colorpicker.css' ) ; } | Include the colorpicker dependencies . |
238,930 | 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 |
238,931 | 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 |
238,932 | 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 |
238,933 | 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 |
238,934 | 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 |
238,935 | 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 . |
238,936 | protected function _getAnimateChar ( ) { if ( $ this -> _animateCharNum >= count ( $ this -> _animateChars ) ) { $ this -> _animateCharNum = 0 ; } return $ this -> _animateChars [ $ this -> _animateCharNum ++ ] ; } | Get char for animate |
238,937 | 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 |
238,938 | 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 |
238,939 | 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 . |
238,940 | 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 . |
238,941 | 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 |
238,942 | 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 |
238,943 | public function cell ( Int $ spacing , Int $ padding ) : Table { $ this -> attr [ 'cellspacing' ] = $ spacing ; $ this -> attr [ 'cellpadding' ] = $ padding ; return $ this ; } | Sets table cell |
238,944 | 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 |
238,945 | public function size ( Int $ width , Int $ height ) : Table { $ this -> attr [ 'width' ] = $ width ; $ this -> attr [ 'height' ] = $ height ; return $ this ; } | Sets table size |
238,946 | 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 |
238,947 | 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 |
238,948 | 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 |
238,949 | 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 |
238,950 | 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 |
238,951 | 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 . |
238,952 | 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 . |
238,953 | 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 . |
238,954 | 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 . |
238,955 | 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 |
238,956 | 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 . |
238,957 | 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 . |
238,958 | 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 . |
238,959 | 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 . |
238,960 | 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 . |
238,961 | 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 . |
238,962 | 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 |
238,963 | 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 |
238,964 | public function onBeforeDelete ( ) { parent :: onBeforeDelete ( ) ; foreach ( $ this -> Locations ( ) as $ item ) { $ item -> delete ( ) ; } foreach ( $ this -> Notes ( ) as $ item ) { $ item -> delete ( ) ; } } | Cleanup DB on removal |
238,965 | 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 |
238,966 | 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 |
238,967 | 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 . |
238,968 | 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 . |
238,969 | public function onTranslationList ( ) { $ this -> breadcrumbs -> register ( 'translations' , function ( $ breadcrumbs ) { $ breadcrumbs -> push ( 'Translations' , handles ( 'antares::translations/index/' . area ( ) ) ) ; } ) ; $ this -> shareOnView ( 'translations' ) ; } | on translations list |
238,970 | 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 |
238,971 | 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 |
238,972 | 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 |
238,973 | 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 |
238,974 | 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 |
238,975 | 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 . |
238,976 | 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 . |
238,977 | protected function emptyDirectory ( $ directory ) { foreach ( $ this -> doListContents ( $ directory , true ) as $ path ) { $ this -> deletePath ( $ path ) ; } } | Empties a directory . |
238,978 | 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 . |
238,979 | protected function getFileKeys ( $ path , array $ keys ) { if ( ! $ this -> hasFile ( $ path ) ) { return false ; } return $ this -> getKeys ( $ path , $ keys ) ; } | Returns the keys for a file . |
238,980 | 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 . |
238,981 | 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 . |
238,982 | protected function move ( $ resource , $ movement ) { $ resource -> setPosition ( $ resource -> getPosition ( ) + $ movement ) ; $ event = $ this -> getOperator ( ) -> update ( $ resource ) ; $ event -> toFlashes ( $ this -> getFlashBag ( ) ) ; } | Move the resource . |
238,983 | 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 . |
238,984 | 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 |
238,985 | 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 . |
238,986 | 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 |
238,987 | 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 . |
238,988 | protected function generateFullPath ( ) { return $ this -> fullPath = $ this -> pathGenerator -> generatePath ( $ this -> page , $ this -> path ? : '' ) ; } | Generate page full path . |
238,989 | 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 . |
238,990 | 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 |
238,991 | 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 |
238,992 | 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 |
238,993 | 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 |
238,994 | 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 |
238,995 | 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 . |
238,996 | 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 . |
238,997 | 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 . |
238,998 | 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 . |
238,999 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.