idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
4,900 | public function extractJson ( ) { foreach ( $ this -> getRows ( ) as & $ row ) { foreach ( $ this -> getJsonFields ( ) as $ field ) { if ( isset ( $ row [ $ field ] ) ) { $ data = json_decode ( $ row [ $ field ] , JSON_OBJECT_AS_ARRAY ) ; foreach ( ( array ) $ data as $ k => $ v ) { $ row [ sprintf ( '_%s__%s' , $ fiel... | Extract json data |
4,901 | public static function isEven ( $ value , $ scale = null ) { if ( ! static :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be of type float (or string representing a big float)." ) ; } return static :: equals ( static :: mod ( $ value , 2.0 , $ scale ) , 0.0 , $ scale ) ; } | Tests if the given value is even . |
4,902 | public static function isOdd ( $ value , $ scale = null ) { if ( ! static :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be of type float (or string representing a big float)." ) ; } return static :: equals ( static :: abs ( static :: mod ( $ value , 2.0 , $ scale ) ) , 1.0 , $... | Tests if the given value is odd . |
4,903 | public static function inRange ( $ value , $ lower , $ upper , $ lowerExclusive = false , $ upperExclusive = false ) { if ( ! static :: is ( $ value ) || ! static :: is ( $ lower ) || ! static :: is ( $ upper ) ) { throw new \ InvalidArgumentException ( "The \$value, \$lower and \$upper parameters must be of type float... | Tests if an integer is in a range . |
4,904 | public static function abs ( $ float ) { if ( ! static :: is ( $ float ) ) { throw new \ InvalidArgumentException ( "The \$float parameter must be of type float (or string representing a big float)." ) ; } if ( Float :: is ( $ float ) ) { return Float :: abs ( $ float ) ; } else { return Str :: replace ( $ float , '-' ... | Gets the absolute value of the given float . |
4,905 | public static function viewData ( $ data , $ links = null , $ meta = null , $ included = null ) { $ viewParameters = new \ stdClass ( ) ; if ( $ links ) { $ viewParameters -> links = $ links ; } $ viewParameters -> data = $ data ; if ( $ included !== null ) { $ viewParameters -> included = $ included ; } if ( $ meta ) ... | View JSONAPI data |
4,906 | protected static function getRequestInclude ( $ parameters , $ modelClass = null ) { if ( ! is_object ( $ parameters ) && is_array ( $ parameters ) ) { $ parameters = ( object ) $ parameters ; } $ include = [ ] ; if ( $ modelClass !== null ) { foreach ( $ modelClass :: getRelationships ( ) as $ relationshipKey => $ rel... | Extract included related resources from parameters |
4,907 | protected static function getRequestData ( $ parameters ) { if ( ! is_object ( $ parameters ) && is_array ( $ parameters ) ) { $ parameters = ( object ) $ parameters ; } Request :: requireParameters ( $ parameters , [ 'data' ] ) ; return $ parameters -> data ; } | Get request primary data |
4,908 | protected static function getRequestRelationships ( $ parameters ) { if ( ! is_object ( $ parameters ) && is_array ( $ parameters ) ) { $ parameters = ( object ) $ parameters ; } Request :: requireParameters ( $ parameters , [ 'data' ] ) ; if ( isset ( $ parameters -> data -> relationships ) ) { return ( object ) $ par... | Get request relationships if any attributes . |
4,909 | private function startsWith ( $ string , $ prefix ) { return $ prefix === "" || strrpos ( $ string , $ prefix , - strlen ( $ string ) ) !== FALSE ; } | Check if a string starts with a prefix |
4,910 | private function endswith ( $ string , $ suffix ) { $ strlen = strlen ( $ string ) ; $ testlen = strlen ( $ suffix ) ; if ( $ testlen > $ strlen ) { return false ; } return substr_compare ( $ string , $ suffix , - $ testlen ) === 0 ; } | Check if a string ends with a suffix |
4,911 | public static function render ( Query \ Delete $ query ) { return Compiler :: withDb ( $ query -> getDb ( ) , function ( ) use ( $ query ) { return Compiler :: expression ( array ( 'DELETE' , $ query -> getType ( ) , Aliased :: combine ( $ query -> getTable ( ) ) , Compiler :: word ( 'FROM' , Aliased :: combine ( $ que... | Render a Delete object |
4,912 | private function getReturn ( $ method , $ default ) { if ( isset ( $ this -> returns [ $ method ] ) && ! empty ( $ this -> returns [ $ method ] ) ) { return array_shift ( $ this -> returns [ $ method ] ) ; } return $ default ; } | Dequeue a value for a specific method invocation |
4,913 | public function getConfigTreeBuilder ( ) { $ builder = new TreeBuilder ( ) ; $ rootNode = $ builder -> root ( 'best_it_ct_order_export' ) ; $ rootNode -> children ( ) -> arrayNode ( 'commercetools_client' ) -> isRequired ( ) -> children ( ) -> scalarNode ( 'id' ) -> cannotBeEmpty ( ) -> isRequired ( ) -> end ( ) -> sca... | Parses the config . |
4,914 | private function isCacheable ( RequestHandleInterface $ handle ) { if ( null === $ this -> cache ) { return false ; } if ( $ handle -> getMethod ( ) != self :: GET ) { return false ; } return true ; } | Returns true if handle is possible to be cached |
4,915 | public function onGet ( string $ path , $ target ) : ConfigurableRoute { return $ this -> addRoute ( new Route ( $ path , $ target , 'GET' ) ) ; } | reply with given class or callable for GET request on given path |
4,916 | public function passThroughOnGet ( string $ path = '/[a-zA-Z0-9-_]+.html$' , $ target = HtmlFilePassThrough :: class ) : ConfigurableRoute { return $ this -> onGet ( $ path , $ target ) ; } | reply with HTML file stored in pages path |
4,917 | public function apiIndexOnGet ( string $ path ) : ConfigurableRoute { return $ this -> onGet ( $ path , new Index ( $ this -> routes , $ this -> mimeTypes ) ) ; } | reply with API index overview |
4,918 | public function redirectOnGet ( string $ path , $ target , int $ statusCode = 302 ) : ConfigurableRoute { return $ this -> onGet ( $ path , new Redirect ( $ target , $ statusCode ) ) ; } | reply with a redirect |
4,919 | public function onHead ( string $ path , $ target ) : ConfigurableRoute { return $ this -> addRoute ( new Route ( $ path , $ target , 'HEAD' ) ) ; } | reply with given class or callable for HEAD request on given path |
4,920 | public function onPost ( string $ path , $ target ) : ConfigurableRoute { return $ this -> addRoute ( new Route ( $ path , $ target , 'POST' ) ) ; } | reply with given class or callable for POST request on given path |
4,921 | public function onPut ( string $ path , $ target ) : ConfigurableRoute { return $ this -> addRoute ( new Route ( $ path , $ target , 'PUT' ) ) ; } | reply with given class or callable for PUT request on given path |
4,922 | public function onDelete ( string $ path , $ target ) : ConfigurableRoute { return $ this -> addRoute ( new Route ( $ path , $ target , 'DELETE' ) ) ; } | reply with given class or callable for DELETE request on given path |
4,923 | public function findResource ( $ uri , string $ requestMethod = null ) : UriResource { $ calledUri = CalledUri :: castFrom ( $ uri , $ requestMethod ) ; $ matchingRoutes = $ this -> routes -> match ( $ calledUri ) ; if ( $ matchingRoutes -> hasExactMatch ( ) ) { return $ this -> handleMatchingRoute ( $ calledUri , $ ma... | returns resource which is applicable for given request |
4,924 | private function handleMatchingRoute ( CalledUri $ calledUri , Route $ route ) : UriResource { if ( $ route -> requiresAuth ( ) ) { return new ProtectedResource ( $ route -> authConstraint ( ) , $ this -> resolveResource ( $ calledUri , $ route ) , $ this -> injector ) ; } return $ this -> resolveResource ( $ calledUri... | creates a processable route for given route |
4,925 | private function resolveResource ( CalledUri $ calledUri , Route $ route ) : ResolvingResource { return new ResolvingResource ( $ this -> injector , $ calledUri , $ this -> collectInterceptors ( $ calledUri , $ route ) , $ this -> supportedMimeTypes ( $ route ) , $ route ) ; } | creates matching route |
4,926 | private function handleNonMethodMatchingRoutes ( CalledUri $ calledUri , MatchingRoutes $ matchingRoutes ) : UriResource { if ( $ calledUri -> methodEquals ( 'OPTIONS' ) ) { return new ResourceOptions ( $ this -> injector , $ calledUri , $ this -> collectInterceptors ( $ calledUri ) , $ this -> supportedMimeTypes ( ) ,... | creates a processable route when a route can be found regardless of request method |
4,927 | public function preInterceptOnGet ( $ preInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> preIntercept ( $ preInterceptor , $ path , 'GET' ) ; } | pre intercept with given class or callable on all GET requests |
4,928 | public function preInterceptOnHead ( $ preInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> preIntercept ( $ preInterceptor , $ path , 'HEAD' ) ; } | pre intercept with given class or callable on all HEAD requests |
4,929 | public function preInterceptOnPost ( $ preInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> preIntercept ( $ preInterceptor , $ path , 'POST' ) ; } | pre intercept with given class or callable on all POST requests |
4,930 | public function preInterceptOnPut ( $ preInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> preIntercept ( $ preInterceptor , $ path , 'PUT' ) ; } | pre intercept with given class or callable on all PUT requests |
4,931 | public function preInterceptOnDelete ( $ preInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> preIntercept ( $ preInterceptor , $ path , 'DELETE' ) ; } | pre intercept with given class or callable on all DELETE requests |
4,932 | public function preIntercept ( $ preInterceptor , string $ path = null , string $ requestMethod = null ) : RoutingConfigurator { if ( ! is_callable ( $ preInterceptor ) && ! ( $ preInterceptor instanceof PreInterceptor ) && ! class_exists ( ( string ) $ preInterceptor ) ) { throw new \ InvalidArgumentException ( 'Given... | pre intercept with given class or callable on all requests |
4,933 | public function postInterceptOnGet ( $ postInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> postIntercept ( $ postInterceptor , $ path , 'GET' ) ; } | post intercept with given class or callable on all GET requests |
4,934 | public function postInterceptOnHead ( $ postInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> postIntercept ( $ postInterceptor , $ path , 'HEAD' ) ; } | post intercept with given class or callable on all HEAD requests |
4,935 | public function postInterceptOnPost ( $ postInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> postIntercept ( $ postInterceptor , $ path , 'POST' ) ; } | post intercept with given class or callable on all POST requests |
4,936 | public function postInterceptOnPut ( $ postInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> postIntercept ( $ postInterceptor , $ path , 'PUT' ) ; } | post intercept with given class or callable on all PUT requests |
4,937 | public function postInterceptOnDelete ( $ postInterceptor , string $ path = null ) : RoutingConfigurator { return $ this -> postIntercept ( $ postInterceptor , $ path , 'DELETE' ) ; } | post intercept with given class or callable on all DELETE requests |
4,938 | public function postIntercept ( $ postInterceptor , string $ path = null , string $ requestMethod = null ) : RoutingConfigurator { if ( ! is_callable ( $ postInterceptor ) && ! ( $ postInterceptor instanceof PostInterceptor ) && ! class_exists ( ( string ) $ postInterceptor ) ) { throw new \ InvalidArgumentException ( ... | post intercept with given class or callable on all requests |
4,939 | private function getPreInterceptors ( CalledUri $ calledUri , Route $ route = null ) : array { $ global = $ this -> getApplicable ( $ calledUri , $ this -> preInterceptors ) ; if ( null === $ route ) { return $ global ; } return array_merge ( $ global , $ route -> preInterceptors ( ) ) ; } | returns list of applicable pre interceptors for this request |
4,940 | private function getPostInterceptors ( CalledUri $ calledUri , Route $ route = null ) : array { $ global = $ this -> getApplicable ( $ calledUri , $ this -> postInterceptors ) ; if ( null === $ route ) { return $ global ; } return array_merge ( $ route -> postInterceptors ( ) , $ global ) ; } | returns list of applicable post interceptors for this request |
4,941 | private function getApplicable ( CalledUri $ calledUri , array $ interceptors ) : array { $ applicable = [ ] ; foreach ( $ interceptors as $ interceptor ) { if ( $ calledUri -> satisfies ( $ interceptor [ 'requestMethod' ] , $ interceptor [ 'path' ] ) ) { $ applicable [ ] = $ interceptor [ 'interceptor' ] ; } } return ... | calculates which interceptors are applicable for given request method |
4,942 | public function setDefaultMimeTypeClass ( string $ mimeType , $ mimeTypeClass ) : RoutingConfigurator { SupportedMimeTypes :: setDefaultMimeTypeClass ( $ mimeType , $ mimeTypeClass ) ; return $ this ; } | sets a default mime type class for given mime type but doesn t mark the mime type as supported for all routes |
4,943 | public function supportsMimeType ( string $ mimeType , $ mimeTypeClass = null ) : RoutingConfigurator { if ( null === $ mimeTypeClass && ! SupportedMimeTypes :: provideDefaultClassFor ( $ mimeType ) ) { throw new \ InvalidArgumentException ( 'No default class known for mime type ' . $ mimeType . ', please provide a cla... | add a supported mime type |
4,944 | private function supportedMimeTypes ( Route $ route = null ) : SupportedMimeTypes { if ( $ this -> disableContentNegotation ) { return SupportedMimeTypes :: createWithDisabledContentNegotation ( ) ; } if ( null !== $ route ) { return $ route -> supportedMimeTypes ( $ this -> mimeTypes , $ this -> mimeTypeClasses ) ; } ... | retrieves list of supported mime types |
4,945 | public function getJSData ( ) { return [ 'name' => $ this -> name , 'title' => $ this -> title , 'description' => $ this -> description , 'column' => $ this -> column , 'extraColumn' => $ this -> extraColumn , 'columnFormat' => $ this -> columnFormat , 'addForm' => $ this -> addForm , 'editForm' => $ this -> editForm ,... | Prepare data for JS list config model |
4,946 | protected function configureRoutes ( RouteCollection $ collection ) { parent :: configureRoutes ( $ collection ) ; $ collection -> add ( 'duplicate' , $ this -> getRouterIdParameter ( ) . '/duplicate' ) ; $ collection -> add ( 'generateEntityCode' ) ; if ( $ collection -> get ( 'batch' ) ) { $ collection -> get ( 'batc... | Configure routes for list actions . |
4,947 | private static function arrayDepth ( $ array , $ level = 0 ) { if ( ! $ array ) { return $ level ; } if ( ! is_array ( $ array ) ) { return $ level ; } ++ $ level ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ level = $ level < self :: arrayDepth ( $ value , $ level ) ? self :: arrayDepth (... | Returns the level of depth of an array . |
4,948 | public function bundleExists ( $ bundle ) { $ kernelBundles = $ this -> getConfigurationPool ( ) -> getContainer ( ) -> getParameter ( 'kernel.bundles' ) ; if ( array_key_exists ( $ bundle , $ kernelBundles ) ) { return true ; } if ( in_array ( $ bundle , $ kernelBundles ) ) { return true ; } return false ; } | Checks if a Bundle is installed . |
4,949 | public function renameFormTab ( $ tabName , $ newTabName , $ keepOrder = true ) { $ tabs = $ this -> getFormTabs ( ) ; if ( ! $ tabs ) { return ; } if ( ! isset ( $ tabs [ $ tabName ] ) ) { throw new \ Exception ( sprintf ( 'Tab %s does not exist.' , $ tabName ) ) ; } if ( isset ( $ tabs [ $ newTabName ] ) ) { return ;... | Rename a form tab after form fields have been configured . |
4,950 | public function renameShowTab ( $ tabName , $ newTabName , $ keepOrder = true ) { $ tabs = $ this -> getShowTabs ( ) ; if ( ! $ tabs ) { return ; } if ( ! isset ( $ tabs [ $ tabName ] ) ) { throw new \ Exception ( sprintf ( 'Tab %s does not exist.' , $ tabName ) ) ; } if ( isset ( $ tabs [ $ newTabName ] ) ) { return ;... | Rename a show tab after show fields have been configured . |
4,951 | public function removeTab ( $ tabNames , $ mapper ) { $ currentTabs = $ this -> getFormTabs ( ) ; foreach ( $ currentTabs as $ k => $ item ) { if ( is_array ( $ tabNames ) && in_array ( $ item [ 'name' ] , $ tabNames ) || ! is_array ( $ tabNames ) && $ item [ 'name' ] === $ tabNames ) { foreach ( $ item [ 'groups' ] as... | Removes tab in current form Mapper . |
4,952 | public function removeAllFieldsFromFormGroup ( $ groupName , $ mapper ) { $ formGroups = $ this -> getFormGroups ( ) ; foreach ( $ formGroups as $ name => $ formGroup ) { if ( $ name === $ groupName ) { foreach ( $ formGroups [ $ name ] [ 'fields' ] as $ key => $ field ) { $ mapper -> remove ( $ key ) ; } } } } | Removes all fields from form groups and remove them from mapper . |
4,953 | public static function create ( $ body ) { if ( 0 !== strpos ( $ body , static :: START_TOKEN ) ) { throw new InvalidArgumentException ( "Unexpected response body." ) ; } if ( static :: END_TOKEN !== substr ( $ body , - strlen ( static :: END_TOKEN ) ) ) { throw new InvalidArgumentException ( "Unexpected response body.... | Creates a response from the given http response body . |
4,954 | public static function render ( SQL \ Join $ join ) { $ condition = $ join -> getCondition ( ) ; $ table = $ join -> getTable ( ) ; return Compiler :: expression ( array ( $ join -> getType ( ) , 'JOIN' , $ table instanceof SQL \ Aliased ? Aliased :: render ( $ table ) : $ table , is_array ( $ condition ) ? self :: ren... | Render a Join object |
4,955 | public function template ( $ template , $ data = Array ( ) ) { \ Template :: with ( $ template , $ data ) ; \ View :: serve ( ) ; } | A template to add to the view and return . |
4,956 | public function getAuthorizeUrl ( $ request_token , $ callback_uri = NULL , $ state = NULL ) { if ( empty ( $ callback_uri ) && isset ( $ request_token [ 'callback_uri' ] ) ) { $ callback_uri = $ request_token [ 'callback_uri' ] ; } if ( empty ( $ state ) ) { $ state = md5 ( mt_rand ( ) ) ; } $ params = array ( ) ; if ... | Return a redirect url . |
4,957 | protected function normalizeAccessToken ( $ access_token ) { if ( ! isset ( $ access_token [ 'token_type' ] ) ) { $ access_token [ 'token_type' ] = 'Bearer' ; } if ( ! isset ( $ access_token [ 'expires_at' ] ) && isset ( $ access_token [ 'expires_in' ] ) ) { $ access_token [ 'expires_at' ] = $ access_token [ 'expires_i... | Normalize access token |
4,958 | public static function getRelationshipData ( $ relationshipKey , $ id , Fields $ fields = null , $ primaryDataParameters = [ ] , $ relationshipParameters = [ ] ) { if ( ! static :: relationshipExists ( $ relationshipKey ) ) { throw new \ Phramework \ Exceptions \ ServerException ( sprintf ( '"%s" is not a valid relatio... | Get records from a relationship link |
4,959 | public static function getIncludedData ( $ primaryData , $ include = [ ] , Fields $ fields = null , $ additionalResourceParameters = [ ] ) { $ tempRelationshipIds = new \ stdClass ( ) ; foreach ( $ include as $ relationshipKey ) { if ( ! static :: relationshipExists ( $ relationshipKey ) ) { throw new RequestException ... | Get jsonapi s included object selected by include argument using id s of relationship s data from resources in primary data object |
4,960 | private function deviceRepository ( $ persistenceStorage , $ userAgentHandlerChain ) { $ devicePatcher = new WURFL_Xml_DevicePatcher ( ) ; $ deviceRepositoryBuilder = new WURFL_DeviceRepositoryBuilder ( $ persistenceStorage , $ userAgentHandlerChain , $ devicePatcher ) ; return $ deviceRepositoryBuilder -> build ( $ th... | Returns a WURFL device repository |
4,961 | public static function commentTable ( $ table , $ comment , $ connection = null ) { if ( is_null ( $ connection ) ) { $ connection = DB :: connection ( ) ; } if ( $ connection -> getDriverName ( ) === 'sqlite' ) { return ; } $ connection -> statement ( sprintf ( 'ALTER TABLE `%s` COMMENT = "%s"' , $ table , addslashes ... | Add a comment at the level of a table . |
4,962 | public static function describeTable ( $ table , $ connection = null ) { if ( is_null ( $ connection ) ) { $ connection = DB :: connection ( ) ; } if ( $ connection -> getDriverName ( ) === 'sqlite' ) { $ result = $ connection -> select ( sprintf ( 'PRAGMA table_info(%s)' , $ table ) ) ; $ column_key = 'name' ; } else ... | Describe a table s columns . |
4,963 | protected function isFixtureAlreadyLoaded ( $ fixtureObject ) { if ( ! $ this -> loadedFixtures ) { $ this -> loadedFixtures = [ ] ; $ loadedFixtures = $ this -> em -> getRepository ( 'OkvpnFixtureBundle:DataFixture' ) -> findAll ( ) ; foreach ( $ loadedFixtures as $ fixture ) { $ this -> loadedFixtures [ $ fixture -> ... | Determines whether the given data fixture is already loaded or not |
4,964 | public function setMinute ( $ minute ) { if ( ! in_array ( $ minute , range ( 0 , 59 ) ) ) { throw new InvalidArgumentException ( 'Minute must be between 0 and 59' ) ; } $ this -> minute = $ minute ; return $ this ; } | Sets minutes in repetition |
4,965 | public function doPostRequest ( $ uri , $ data = null ) { return $ this -> doRequest ( Request :: POST , $ uri , $ data ) ; } | Create POST request to CORAL backend |
4,966 | public function saveModifiedFiles ( $ installPath ) { DebugPrinter :: log ( 'Saving modified items' ) ; $ tmpRoot = sys_get_temp_dir ( ) . DIRECTORY_SEPARATOR ; $ installPath = trim ( $ installPath , '\\/' ) . DIRECTORY_SEPARATOR ; $ fsm = new Filesystem ; DebugPrinter :: log ( 'Items to search: %s' , implode ( ', ' , ... | Saves config files during install . |
4,967 | public function restoreModifiedFiles ( $ installPath ) { DebugPrinter :: log ( 'Restoring modified items' ) ; $ tmpRoot = sys_get_temp_dir ( ) . DIRECTORY_SEPARATOR ; $ installPath = trim ( $ installPath , '\\/' ) . DIRECTORY_SEPARATOR ; $ fsm = new Filesystem ; DebugPrinter :: log ( 'Items to search: %s' , implode ( '... | Restores previously saved config files . |
4,968 | protected function setPermissions ( $ installPath , $ basePerms = 0644 ) { $ fsm = new Filesystem ; foreach ( $ this -> chmodNodes as $ fsNode ) { $ path = $ installPath . DIRECTORY_SEPARATOR . $ fsNode ; $ isFile = is_file ( $ path ) ; $ isDir = is_dir ( $ path ) ; if ( ! $ isFile && ! $ isDir ) { DebugPrinter :: log ... | Sets Opencart folder permissions as required in manual . |
4,969 | public function rotateInstalledFiles ( $ installPath ) { $ fsm = new Filesystem ; $ tempDir = sys_get_temp_dir ( ) . DIRECTORY_SEPARATOR . uniqid ( 'oci-' ) ; DebugPrinter :: log ( 'Rotating files using `%s` dir' , $ tempDir ) ; $ dirs = glob ( $ installPath . DIRECTORY_SEPARATOR . '*' , GLOB_ONLYDIR ) ; foreach ( $ di... | Moves installed files out of upload dir . |
4,970 | public function copyConfigFiles ( $ installPath ) { $ filesystem = new Filesystem ; $ configFiles = array ( '/config' , '/admin/config' , ) ; foreach ( $ configFiles as $ configFile ) { $ source = $ installPath . $ configFile . '-dist.php' ; $ target = $ installPath . $ configFile . '.php' ; if ( $ filesystem -> exists... | Copies configuration files from their dists as specified by installation notes . |
4,971 | public function decodeJson ( $ assoc = false ) { $ result = json_decode ( $ this -> body , $ assoc ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new PipelinerHttpException ( $ this , "Error while parsing returned JSON" ) ; } return $ result ; } | Decodes the response s body into an object . |
4,972 | protected function appendRelatedModelsToModelData ( array $ model ) { $ relationships = array_merge ( array_get ( $ model , 'relationships.normal' ) , array_get ( $ model , 'relationships.reverse' ) ) ; $ model [ 'related_models' ] = [ ] ; foreach ( $ relationships as $ name => $ relationship ) { $ relatedModelId = $ r... | Append related model data for related models |
4,973 | protected function makeTranslatedDataFromModelData ( array $ model ) { $ sluggable = ( $ model [ 'sluggable' ] && array_get ( $ model , 'sluggable_setup.translated' ) ) ; return [ 'module' => $ model [ 'module' ] , 'name' => $ model [ 'name' ] . config ( 'pxlcms.generator.models.translation_model_postfix' ) , 'table' =... | Make model data array for translation model |
4,974 | public function get ( ) { return array_key_exists ( $ this -> subject -> getName ( ) , $ this -> matches ) ? $ this -> matches [ $ this -> subject -> getName ( ) ] -> get ( ) : $ this -> surrogate -> get ( ) ; } | Provides the value the instance of the mapped subject is mapped to or throws a runtime exception if the instance has not been mapped to anything . |
4,975 | static function factory ( Plugin $ plugin , $ type ) { $ plugin -> validator -> extend ( 'can_edit' , function ( $ attribute , $ value , $ parameters , $ validator ) { if ( empty ( $ value ) ) { return false ; } $ current_user = wp_get_current_user ( ) ; if ( empty ( $ current_user ) ) { return false ; } if ( $ attribu... | Create a profile section of the given type and associate it with the given Plugin |
4,976 | public function usePermissionRelatedByParentIdQuery ( $ relationAlias = null , $ joinType = Criteria :: LEFT_JOIN ) { return $ this -> joinPermissionRelatedByParentId ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'PermissionRelatedByParentId' , '\Alchemy\Component\Cerberus\Model\Per... | Use the PermissionRelatedByParentId relation Permission object |
4,977 | public function usePermissionRelatedByIdQuery ( $ relationAlias = null , $ joinType = Criteria :: LEFT_JOIN ) { return $ this -> joinPermissionRelatedById ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'PermissionRelatedById' , '\Alchemy\Component\Cerberus\Model\PermissionQuery' ) ; ... | Use the PermissionRelatedById relation Permission object |
4,978 | public function filterByRolePermission ( $ rolePermission , $ comparison = null ) { if ( $ rolePermission instanceof \ Alchemy \ Component \ Cerberus \ Model \ RolePermission ) { return $ this -> addUsingAlias ( PermissionTableMap :: COL_ID , $ rolePermission -> getPermissionId ( ) , $ comparison ) ; } elseif ( $ roleP... | Filter the query by a related \ Alchemy \ Component \ Cerberus \ Model \ RolePermission object |
4,979 | public function filterByRole ( $ role , $ comparison = Criteria :: EQUAL ) { return $ this -> useRolePermissionQuery ( ) -> filterByRole ( $ role , $ comparison ) -> endUse ( ) ; } | Filter the query by a related Role object using the role_permission table as cross reference |
4,980 | public function setStatusCode ( int $ statusCode , string $ reasonPhrase = null ) : Response { $ this -> status -> setCode ( $ statusCode , $ reasonPhrase ) ; return $ this ; } | sets the status code to be send |
4,981 | public function addHeader ( string $ name , string $ value ) : Response { $ this -> headers -> add ( $ name , $ value ) ; return $ this ; } | add a header to the response |
4,982 | public function containsHeader ( string $ name , string $ value = null ) : bool { if ( $ this -> headers -> contain ( $ name ) ) { if ( null !== $ value ) { return $ value === $ this -> headers [ $ name ] ; } return true ; } return false ; } | check if response contains a certain header |
4,983 | public function addCookie ( Cookie $ cookie ) : Response { $ this -> cookies [ $ cookie -> name ( ) ] = $ cookie ; return $ this ; } | add a cookie to the response |
4,984 | public function removeCookie ( string $ name ) : Response { $ this -> addCookie ( Cookie :: create ( $ name , 'remove' ) -> expiringAt ( time ( ) - 86400 ) ) ; return $ this ; } | removes cookie with given name |
4,985 | public function containsCookie ( string $ name , string $ value = null ) : bool { if ( isset ( $ this -> cookies [ $ name ] ) ) { if ( null !== $ value ) { return $ this -> cookies [ $ name ] -> value ( ) === $ value ; } return true ; } return false ; } | checks if response contains a certain cookie |
4,986 | public function methodNotAllowed ( string $ requestMethod , array $ allowedMethods ) : Error { $ this -> status -> methodNotAllowed ( $ allowedMethods ) ; return Error :: methodNotAllowed ( $ requestMethod , $ allowedMethods ) ; } | creates a 405 Method Not Allowed message |
4,987 | private function sendHead ( ) : Response { $ this -> header ( $ this -> status -> line ( $ this -> version , $ this -> sapi ) ) ; foreach ( $ this -> headers as $ name => $ value ) { $ this -> header ( $ name . ': ' . $ value ) ; } foreach ( $ this -> cookies as $ cookie ) { $ cookie -> send ( ) ; } $ this -> header ( ... | sends head only |
4,988 | public function selectremote ( Panel \ Action \ SelectRemote $ action ) { $ element = $ action -> getElement ( ) ; $ element -> addAttribute ( 'id' , $ element -> getName ( ) ) ; $ element -> addClass ( 'select2-remote input-callback' ) ; $ element -> addAttribute ( 'data-css' , 'form-control input-large input-sm' ) ; ... | Render a Select 2 |
4,989 | public static function listSubscriptions ( $ user , $ page = 1 , $ per_page = 20 , $ order_by = self :: ORDERBY_CREATED_AT , $ order_dir = self :: ORDERDIR_ASC , $ include_finished = false , $ hash_type = false , $ hash = false ) { if ( $ page < 1 ) { throw new DataSift_Exception_InvalidData ( "The specified page numbe... | Get a page of push subscriptions in the given user s account where each page contains up to per_page items . Results will be ordered according to the supplied ordering parameters . |
4,990 | public static function listByPlaybackId ( $ user , $ playback_id , $ page = 1 , $ per_page = 20 , $ order_by = self :: ORDERBY_CREATED_AT , $ order_dir = self :: ORDERDIR_ASC , $ include_finished = false , $ hash_type = false , $ hash = false ) { return self :: listSubscriptions ( $ user , $ page , $ per_page , $ order... | Get a page of push subscriptions to the given stream playback_id where each page contains up to per_page items . Results will be ordered according to the supplied ordering parameters . |
4,991 | protected function init ( $ data ) { if ( ! isset ( $ data [ 'id' ] ) ) { throw new DataSift_Exception_InvalidData ( 'No id found' ) ; } $ this -> _id = $ data [ 'id' ] ; if ( ! isset ( $ data [ 'name' ] ) ) { throw new DataSift_Exception_InvalidData ( 'No name found' ) ; } $ this -> _name = $ data [ 'name' ] ; if ( ! ... | Extract data from an array . |
4,992 | protected function parseOutputParams ( $ params , $ prefix = '' ) { $ retval = array ( ) ; foreach ( $ params as $ key => $ val ) { if ( is_array ( $ val ) ) { $ retval = array_merge ( $ retval , $ this -> parseOutputParams ( $ val , $ prefix . $ key . '.' ) ) ; } else { $ retval [ $ prefix . $ key ] = $ val ; } } retu... | Recursive method to parse the output_params as received from the API into the flattened dot - notation used by the client libraries . |
4,993 | public function setOutputParam ( $ key , $ val ) { if ( $ this -> isDeleted ( ) ) { throw new DataSift_Exception_InvalidData ( 'Cannot modify a deleted subscription' ) ; } parent :: setOutputParam ( $ key , $ val ) ; } | Set an output parameter . Checks to see if the subscription has been deleted and if not calls the base class to set the parameter . |
4,994 | public function save ( ) { $ params = array ( 'id' => $ this -> getId ( ) , 'name' => $ this -> getName ( ) ) ; foreach ( $ this -> _output_params as $ key => $ val ) { $ params [ DataSift_Push_Definition :: OUTPUT_PARAMS_PREFIX . $ key ] = $ val ; } $ this -> init ( $ this -> _user -> post ( 'push/update' , $ params )... | Save changes to the name and output_parameters of this subscription . |
4,995 | public function delete ( ) { $ this -> _user -> post ( 'push/delete' , array ( 'id' => $ this -> getId ( ) ) ) ; $ this -> _status = self :: STATUS_DELETED ; } | Delete this subscription . |
4,996 | public function pull ( $ size = 20971520 , $ cursor = false ) { if ( strtolower ( $ this -> _output_type ) != 'pull' ) { throw new DataSift_Exception_InvalidData ( "Output type is not pull" ) ; } $ params = array ( 'id' => $ this -> getId ( ) , 'size' => $ size ) ; if ( $ cursor !== false ) { $ params [ 'cursor' ] = $ ... | Pull data from this subscription . |
4,997 | public function getLog ( $ page = 1 , $ per_page = 20 , $ order_by = self :: ORDERBY_REQUEST_TIME , $ order_dir = self :: ORDERDIR_DESC ) { return self :: getLogs ( $ this -> _user , $ page , $ per_page , $ order_by , $ order_dir , $ this -> getId ( ) ) ; } | Get a page of the log for this subscription order as specified . |
4,998 | public function rewind ( ) { if ( ! $ this -> rewindable && ! $ this -> firstCross ) { throw new \ Exception ( 'Unable to traverse not rewindable iterator multiple time' ) ; } $ this -> firstCross = false ; $ this -> position = 0 ; } | Rewinds the Iterator to the first element . |
4,999 | public function count ( ) { if ( ! isset ( $ this -> count ) ) { $ this -> count = $ this -> repository -> count ( $ this -> query ) ; } return $ this -> count ; } | Count number of document from collection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.