idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
5,000 | protected function readFields ( string $ sql ) : array { if ( trim ( $ sql ) === '' ) { throw new Exception \ EmptyQueryException ( 'Cannot read fields for an empty query' ) ; } $ sql = $ this -> getEmptiedQuery ( $ sql ) ; $ stmt = $ this -> pdo -> prepare ( $ sql ) ; if ( $ stmt -> execute ( ) !== true ) { throw new ... | Read fields from pdo source . |
5,001 | protected function filterCurrentItems ( Collection $ collection ) { $ endDate = new DateTime ( ) ; $ format = $ this -> configuration -> getGroupByDateFormat ( ) ; $ identifier = $ endDate -> format ( $ format ) ; return $ collection -> filter ( function ( ReportRow $ row ) use ( $ identifier ) { return $ row -> getIde... | Filters a collection to get only current items |
5,002 | protected function addResolvers ( ContainerBuilder $ container , string $ service , string $ tag ) { if ( ! $ container -> has ( $ service ) ) { return ; } $ definition = $ container -> getDefinition ( $ service ) ; $ taggedServices = $ container -> findTaggedServiceIds ( $ tag ) ; foreach ( $ taggedServices as $ id =>... | Add the Resolvers . |
5,003 | public function run ( ServerRequestInterface $ request , ResponseInterface $ response ) { $ route = $ request -> getAttribute ( 'route' ) ; $ callback = ! empty ( $ route -> fn ) ? $ route -> fn : null ; if ( ! is_callable ( $ callback ) ) { trigger_error ( "'fn' property of route shoud be a callable" , E_USER_NOTICE )... | Use function to handle request and response |
5,004 | public static function methodNotAllowed ( string $ requestMethod , array $ allowedMethods ) : self { return new self ( 'The given request method ' . strtoupper ( $ requestMethod ) . ' is not valid. Please use one of ' . join ( ', ' , $ allowedMethods ) . '.' , 'Method Not Allowed' ) ; } | creates error when access to resource with request method is not allowed |
5,005 | public static function inParams ( ParamErrors $ errors , ParamErrorMessages $ errorMessages ) : self { return new self ( Sequence :: of ( $ errors ) -> map ( function ( array $ errors , $ paramName ) use ( $ errorMessages ) : array { $ resolved = [ 'field' => $ paramName , 'errors' => [ ] ] ; foreach ( $ errors as $ id... | creates error with given list of param errors |
5,006 | public static function initializeWithDefaultsIn ( ConfigLocation $ configLocation , ConfigWriter $ configWriter ) { $ env = Environment :: setUp ( ) ; $ instance = new self ( [ 'processing' => array_merge ( $ env -> getConfig ( ) -> toArray ( ) , [ "connectors" => [ ] , "js_ticker" => [ 'enabled' => false , 'interval' ... | Uses Prooph \ Processing \ Environment to initialize with its defaults |
5,007 | public function configureJavascriptTicker ( array $ jsTickerConfig , ConfigWriter $ configWriter ) { $ this -> assertJsTickerConfig ( $ jsTickerConfig ) ; $ oldConfig = $ this -> config [ 'processing' ] [ 'js_ticker' ] ; $ this -> config [ 'processing' ] [ 'js_ticker' ] = $ jsTickerConfig ; $ this -> writeConfig ( $ co... | Configure the javascript ticker |
5,008 | private function writeConfig ( ConfigWriter $ configWriter ) { $ configWriter -> replaceConfigInDirectory ( $ this -> toArray ( ) , $ this -> configLocation -> toString ( ) . DIRECTORY_SEPARATOR . self :: $ configFileName ) ; } | Write config to file with the help of a config writer |
5,009 | private function hueToRgb ( $ v1 , $ v2 , $ vH ) { if ( $ vH < 0 ) { $ vH += 1 ; } if ( $ vH > 1 ) { $ vH -= 1 ; } if ( ( 6 * $ vH ) < 1 ) { return ( $ v1 + ( $ v2 - $ v1 ) * 6 * $ vH ) ; } if ( ( 2 * $ vH ) < 1 ) { return $ v2 ; } if ( ( 3 * $ vH ) < 2 ) { return ( $ v1 + ( $ v2 - $ v1 ) * ( ( 2 / 3 ) - $ vH ) * 6 ) ;... | Given a Hue returns corresponding RGB value |
5,010 | private function prepareKey ( $ key ) { if ( ! preg_match ( '/^[a-zA-Z0-9_-]+$/' , $ key ) ) { throw new InvalidArgumentException ( $ key ) ; } return $ this -> keyPrefix . strtr ( $ key , '-' , '_' ) ; } | Prepares a key for cache storage |
5,011 | public function addSelectRemote ( $ name , $ placeholder , $ data_url , $ action_url , $ length = 3 ) { $ e = new Action \ SelectRemote ( $ name , $ placeholder , $ data_url , $ action_url , $ length ) ; $ this -> addAction ( $ e ) ; return $ e ; } | Add select remote |
5,012 | public function checkProperty ( & $ property ) { if ( parent :: checkProperty ( $ property ) ) { if ( preg_match ( '/^(?:src|unicode-range|font-(?:family|variant|feature-settings|stretch|weight|style))$/D' , $ property ) ) { return true ; } else { $ this -> setIsValid ( false ) ; $ this -> addValidationError ( "Invalid... | Checks the declaration property . |
5,013 | public function getAjaxRenderer ( ) { if ( empty ( $ this -> AjaxRenderer ) ) { $ this -> AjaxRenderer = \ Drupal :: service ( 'main_content_renderer.ajax' ) ; } return $ this -> AjaxRenderer ; } | Gets the ajax renderer . |
5,014 | protected static function isArrayMultiline ( $ array ) { if ( empty ( $ array ) ) return false ; switch ( self :: getArrayMode ( ) ) { case self :: ARR_MODE_SINGLELINE : $ isMultiline = false ; break ; case self :: ARR_MODE_MULTILINE : $ isMultiline = true ; break ; default : $ isMultiline = Arr :: isAssoc ( $ array ) ... | Determines if array should be formatted as a multiline one or not |
5,015 | protected static function prepareArrayLines ( array $ array ) { $ isAssoc = Arr :: isAssoc ( $ array ) ; array_walk ( $ array , function ( & $ value , $ index , $ withIndexes = false ) { if ( is_array ( $ value ) ) { $ value = self :: formatArray ( $ value ) ; } else { $ value = self :: formatScalar ( $ value ) ; } if ... | Prepare array elements for formatting . |
5,016 | public static function indentLines ( $ text , $ indent , $ skipFirstLine = false ) { $ lines = explode ( PHP_EOL , $ text ) ; ! $ skipFirstLine || $ preparedLines [ ] = array_shift ( $ lines ) ; foreach ( $ lines as $ line ) { $ preparedLines [ ] = self :: indent ( $ indent ) . rtrim ( $ line ) ; } return implode ( PHP... | Add indents to multiline text |
5,017 | public static function formatArray ( array $ array , $ braces = true ) { $ isMultiline = self :: isArrayMultiline ( $ array ) ; $ array = self :: prepareArrayLines ( $ array ) ; $ eol = $ isMultiline ? PHP_EOL : '' ; $ output = implode ( $ array , ', ' . $ eol ) ; if ( $ isMultiline ) { $ output = self :: indentLines (... | Return text representation of array |
5,018 | public function get_wp_error ( ) { return $ this -> wp_error ? $ this -> wp_error : new \ WP_Error ( $ this -> code , $ this -> message , $ this ) ; } | Obtain the exception s \ WP_Error object . |
5,019 | public function upload ( $ file , $ key ) { if ( ! $ file || ! $ this -> isValidKey ( $ key ) ) return ; $ fileName = $ file -> getClientOriginalName ( ) ; $ pathinfo = pathinfo ( $ fileName ) ; $ this -> deleteStored ( $ key ) ; Storage :: putFileAs ( $ this -> getStoragePath ( ) , $ file , $ key . '.' . $ pathinfo [ ... | Upload file if exist and key is correct |
5,020 | private function getFileData ( $ key ) { foreach ( $ this -> getStoredList ( ) as $ filePath ) { $ pathinfo = pathinfo ( $ filePath ) ; if ( $ key == $ pathinfo [ 'filename' ] ) return [ 'storedPath' => $ filePath , 'path' => storage_path ( 'app/' . $ filePath ) , 'extension' => $ pathinfo [ 'extension' ] , 'size' => S... | Get file path and extension or null if file is not stored |
5,021 | private function registerDirectory ( $ basePath , $ prefix = '' ) { $ basePath = str_replace ( '\\' , '/' , $ basePath ) ; $ basePath = rtrim ( $ basePath , '/' ) . '/' ; $ prefix = ( $ prefix ? $ prefix . '_' : '' ) ; $ files = scandir ( $ basePath ) ; foreach ( $ files as $ file ) { if ( $ file [ 0 ] == '.' ) { conti... | Not fully PSR - 0 compatible but good enough for this particular plugin |
5,022 | public function getSystemUserArray ( ) { $ repo = $ this -> get ( 'sulu_security.user_repository' ) ; $ users = $ repo -> getUserInSystem ( ) ; $ contacts = [ ] ; foreach ( $ users as $ user ) { $ contact = $ user -> getContact ( ) ; $ contacts [ ] = array ( 'id' => $ contact -> getId ( ) , 'fullName' => $ contact -> g... | returns all sulu system users |
5,023 | public function getOrderStatus ( ) { $ statuses = $ this -> getDoctrine ( ) -> getRepository ( self :: $ orderStatusEntityName ) -> findAll ( ) ; $ locale = $ this -> getUser ( ) -> getLocale ( ) ; $ statusArray = [ ] ; foreach ( $ statuses as $ statusEntity ) { $ status = new OrderStatus ( $ statusEntity , $ locale ) ... | returns array of order statuses |
5,024 | protected function initCurlHandler ( $ uri ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ uri ) ; curl_setopt ( $ ch , CURLOPT_USERAGENT , 'twelvelabs/foursquare client' ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , $ this -> verifyHost ) ; if ... | initialize the cURL handler |
5,025 | public function supports ( $ packageType ) { DebugPrinter :: log ( 'Checking support for package type `%s` (%s)' , array ( $ packageType , $ packageType === $ this -> packageType ? 'y' : 'n' ) ) ; return $ packageType === $ this -> packageType ; } | Tells composer if this installer supports provided package type . |
5,026 | public static function factory ( $ user , $ type , $ definition , $ eventHandler ) { $ classname = 'DataSift_StreamConsumer_' . $ type ; if ( ! class_exists ( $ classname ) ) { throw new DataSift_Exception_InvalidData ( 'Consumer type "' . $ type . '" is unknown' ) ; } return new $ classname ( $ user , $ definition , $... | Factory function . Creates a StreamConsumer - derived object for the given type . |
5,027 | protected function onData ( $ json ) { $ interaction = json_decode ( trim ( $ json ) , true ) ; if ( $ interaction ) { if ( isset ( $ interaction [ 'status' ] ) ) { switch ( $ interaction [ 'status' ] ) { case 'error' : case 'failure' : $ this -> onError ( $ interaction [ 'message' ] ) ; $ this -> stop ( ) ; break ; ca... | This is called when a complete JSON item is received . |
5,028 | protected function onInteraction ( $ interaction , $ hash = false ) { $ this -> _eventHandler -> onInteraction ( $ this , $ interaction , $ hash ) ; } | This is called for each interaction received from the stream and must be implemented in extending classes . |
5,029 | protected function onDeleted ( $ interaction , $ hash = false ) { $ this -> _eventHandler -> onDeleted ( $ this , $ interaction , $ hash ) ; } | This is called for each DELETE request received from the stream and must be implemented in extending classes . |
5,030 | public function consume ( $ auto_reconnect = true ) { $ this -> _auto_reconnect = $ auto_reconnect ; $ this -> _state = self :: STATE_STARTING ; $ this -> onStart ( ) ; } | Once an instance of a StreamConsumer is ready for use call this to start consuming . Extending classes should implement onStart to handle actually starting . |
5,031 | protected function onStop ( $ reason = '' ) { if ( $ this -> _state != self :: STATE_STOPPING and $ reason == '' ) { $ reason = 'Unexpected' ; } $ this -> _state = self :: STATE_STOPPED ; $ this -> onStopped ( $ reason ) ; } | Default implementation of onStop . It s unlikely that this method will ever be used in isolation but rather it should be called as the final step in the extending class s implementation . |
5,032 | public function getKeys ( ) { $ keys = [ ] ; foreach ( $ this -> arrays as $ array ) { $ keys = array_merge ( $ keys , $ array instanceof \ ArrayAccess ? $ array -> getKeys ( ) : array_keys ( $ array ) ) ; } return array_unique ( $ keys ) ; } | Get a list of all defined keys . |
5,033 | protected function validateNumber ( $ value ) { $ return = new ValidateResult ( $ value , false ) ; if ( is_string ( $ value ) ) { $ value = str_replace ( ',' , '.' , $ value ) ; } if ( ! is_numeric ( $ value ) || filter_var ( $ value , FILTER_VALIDATE_FLOAT ) === false ) { $ return -> errorObject = new IncorrectParame... | Validate value without calling validateCommon |
5,034 | public static function createFromFieldset ( $ definition ) { $ definition = self :: parseDefinition ( $ definition ) ; $ root = new Group ( ) ; $ group = $ root ; $ dropdown = false ; $ first = true ; foreach ( $ definition as $ button ) { if ( self :: isInvalidDefinition ( $ button ) ) { continue ; } $ button = self :... | Create button from fieldset defintiion . |
5,035 | public static function createGroup ( array $ attributes = array ( ) , $ fromFieldset = false , $ vertical = false ) { $ group = new Group ( array ( ) , $ vertical ) ; static :: applyAttributes ( $ group , $ attributes , $ fromFieldset ) ; return $ group ; } | Create button group . |
5,036 | public static function createToolbar ( array $ attributes = array ( ) , $ fromFieldset = false ) { $ toolbar = new Toolbar ( ) ; static :: applyAttributes ( $ toolbar , $ attributes , $ fromFieldset ) ; return $ toolbar ; } | Create button toolbar . |
5,037 | public static function createDropdown ( $ label , array $ attributes = array ( ) , $ fromFieldset = false ) { $ dropdown = new Dropdown ( ) ; $ dropdown -> setLabel ( $ label ) ; static :: applyAttributes ( $ dropdown , $ attributes , $ fromFieldset ) ; return $ dropdown ; } | Create dropdown button . |
5,038 | public static function createDropdownHeader ( $ label , array $ attributes = array ( ) , $ fromFieldset = false ) { $ dropdown = new Dropdown \ Header ( ) ; $ dropdown -> setLabel ( $ label ) ; static :: applyAttributes ( $ dropdown , $ attributes , $ fromFieldset ) ; return $ dropdown ; } | Create dropdown header . |
5,039 | public static function createDropdownDivider ( array $ attributes = array ( ) , $ fromFieldset = false ) { $ dropdown = new Dropdown \ Divider ( ) ; static :: applyAttributes ( $ dropdown , $ attributes , $ fromFieldset ) ; return $ dropdown ; } | Create dropdown divider . |
5,040 | public static function createDropdownItem ( $ label , $ url , array $ attributes = array ( ) , $ fromFieldset = false ) { $ button = static :: createButton ( $ label , $ url , $ attributes , $ fromFieldset ) ; $ button -> setAttribute ( 'role' , 'menuitem' ) ; $ dropdown = new Dropdown \ Item ( $ button ) ; return $ dr... | Create dropdown item . |
5,041 | protected static function applyAttributes ( Attributes $ node , array $ attributes , $ fromFieldset = false ) { if ( empty ( $ attributes ) ) { return ; } if ( $ fromFieldset ) { foreach ( $ attributes as $ attribute ) { if ( $ attribute [ 'name' ] ) { if ( $ attribute [ 'name' ] == 'class' ) { if ( ! $ attribute [ 'va... | Apply attributes . |
5,042 | protected static function enableToolbar ( $ root ) { if ( ! $ root instanceof Toolbar ) { $ group = $ root ; $ root = static :: createToolbar ( array ( ) , true ) ; if ( $ group instanceof Group && $ group -> getChildren ( ) ) { $ root -> addChild ( $ group ) ; } } return $ root ; } | Enable the toolbar . |
5,043 | private static function parseDropdownChild ( $ dropdown , $ button ) { if ( $ dropdown === false || ! $ dropdown instanceof Dropdown ) { return ; } if ( $ button [ 'type' ] == 'child' ) { $ child = static :: createDropdownItem ( $ button [ 'label' ] , $ button [ 'url' ] , $ button [ 'attributes' ] , true ) ; } else { i... | Parse dropdown child . |
5,044 | protected static function parseDefinition ( $ definition ) { if ( ! is_array ( $ definition ) ) { $ definition = deserialize ( $ definition , true ) ; return $ definition ; } return $ definition ; } | Parse button definition . |
5,045 | protected static function encodeValue ( $ button ) { if ( isset ( $ button [ 'button' ] ) && $ button [ 'button' ] == 'link' ) { if ( substr ( $ button [ 'value' ] , 0 , 7 ) == 'mailto:' ) { if ( version_compare ( VERSION . '.' . BUILD , '3.5.5' , '>=' ) ) { $ button [ 'value' ] = \ StringUtil :: encodeEmail ( $ button... | Encode button value . |
5,046 | protected static function createNewGroup ( & $ root , $ button , & $ dropdown , $ addToRoot = true ) { if ( $ addToRoot ) { $ root = self :: enableToolbar ( $ root ) ; } if ( $ dropdown !== false ) { $ dropdown = false ; } $ group = static :: createGroup ( $ button [ 'attributes' ] , true , ( $ button [ 'type' ] === 'v... | Create a new group element . |
5,047 | public static function get ( $ name ) { $ namespaces = config ( 'crude.namespace' ) ; if ( ! is_array ( $ namespaces ) ) { $ fullName = $ namespaces . $ name ; return class_exists ( $ fullName ) ? new $ fullName ( ) : null ; } foreach ( $ namespaces as $ namespace ) { $ fullName = $ namespace . $ name ; if ( class_exis... | Create crude instance |
5,048 | protected function prePersistOrUpdate ( $ object , $ method ) { $ analyzer = new ClassAnalyzer ( ) ; foreach ( $ analyzer -> getTraits ( $ this ) as $ traitname ) { $ rc = new \ ReflectionClass ( $ traitname ) ; if ( method_exists ( $ this , $ exec = $ method . $ rc -> getShortName ( ) ) ) { $ this -> $ exec ( $ object... | function prePersistOrUpdate . |
5,049 | public function setIndent ( int $ indent = 2 ) : self { if ( ! Number :: Range ( $ indent , 2 , 8 ) ) { throw new CompilerException ( sprintf ( '"%d" is an invalid indent value' , $ indent ) ) ; } return $ this ; } | Set indent spacer |
5,050 | public function setCallback ( Closure $ callback = null ) { if ( $ this -> callback !== null || $ callback === null ) { throw new \ RuntimeException ( "Cannot redeclare this comparer callback." ) ; } $ this -> callback = Closure :: bind ( $ callback , $ this , get_called_class ( ) ) ; } | This comparer does not allow to set the callback outside this class . |
5,051 | protected function get ( $ tag ) { if ( isset ( $ this -> data [ $ tag ] ) ) { return $ this -> data [ $ tag ] ; } return null ; } | Returns the value for the given tag . |
5,052 | public function clean ( ) { foreach ( $ this -> data as $ key => $ data ) { if ( empty ( $ data ) ) { unset ( $ this -> data [ $ key ] ) ; } } return $ this ; } | Removes keys with empty value . |
5,053 | public function apply ( array $ data ) { if ( $ this -> antiCsrf && ! $ this -> antiCsrf -> isValid ( $ data ) ) { throw new CsrfViolationException ; } $ this -> fill ( $ data ) ; return $ this -> filter -> apply ( $ data ) ; } | Applies the filter to a subject . |
5,054 | public function getFromEntity ( $ entity , array $ formParameters , $ limitFields = null ) { $ extracted_data = array ( ) ; foreach ( $ formParameters as $ field ) { $ getter_name = "get" . $ this -> dashesToCamelCase ( $ field ) ; if ( ( $ limitFields === null || in_array ( $ field , $ limitFields ) ) && method_exists... | Get data from an entity using getter methods |
5,055 | public function saveToEntity ( $ entity , $ formData , $ limitFields = null ) { foreach ( $ formData as $ field => $ value ) { $ setter_name = "set" . $ this -> dashesToCamelCase ( $ field ) ; if ( ( $ limitFields === null || in_array ( $ field , $ limitFields ) ) && method_exists ( $ entity , $ setter_name ) ) { $ ent... | Save data to an entity using setter methods |
5,056 | public function setModel ( \ Illuminate \ Database \ Eloquent \ Model $ model ) { $ this -> model = $ model ; if ( $ this -> model instanceof ResourceInterface ) { $ this -> enableAutoEagerLoading = true ; } } | Set the repository model . |
5,057 | protected function finalize ( $ result ) { $ this -> eagerLoad = [ ] ; $ this -> criteria -> reset ( ) ; $ this -> scope = null ; return $ result ; } | Utility method for flags reset . Always use this to return results . |
5,058 | protected function applyAutoEagerLoading ( $ fetch = 'unit' ) { if ( ! empty ( $ this -> eagerLoad ) ) { return ; } if ( $ this -> enableAutoEagerLoading && $ fetch == 'unit' ) { $ this -> eagerLoad = $ this -> model -> unitRelations ( ) ; } elseif ( $ this -> enableAutoEagerLoading && $ fetch == 'list' ) { $ this -> e... | Check whether the autoEagerLoading feature has to be applied . |
5,059 | protected function getInjector ( ) { if ( $ this -> injector === null ) { $ this -> injector = \ Injector :: inst ( ) ; } return $ this -> injector ; } | Retrieves the Injector instance |
5,060 | private function triggerExists ( $ trigger_name ) { if ( $ triggers = $ this -> getConnection ( ) -> execute ( 'SHOW TRIGGERS' , $ trigger_name ) ) { foreach ( $ triggers as $ trigger ) { if ( $ trigger [ 'Trigger' ] == $ trigger_name ) { return true ; } } } return false ; } | Check if trigger exists . |
5,061 | public function store ( $ attributes ) { $ attributes = $ this -> formatStoreAttributes ( $ attributes ) ; $ model = $ this -> model -> create ( $ this -> mapAttributesWithScope ( $ attributes ) ) ; if ( $ this -> canOrder ( ) ) { if ( $ this -> storeInLastPlace ) { $ attr = $ this -> crudeSetup -> getOrderAttribute ( ... | Store new model |
5,062 | public function updateById ( $ id , $ attributes ) { $ attributes = $ this -> formatUpdateAttributes ( $ attributes ) ; $ model = $ this -> model -> find ( $ id ) ; if ( empty ( $ model ) ) return $ this ; $ model -> update ( $ this -> mapAttributesWithScope ( $ attributes ) ) ; $ apiModel = $ this -> getById ( $ model... | Update by id |
5,063 | public function deleteById ( $ id ) { $ model = $ this -> getById ( $ id ) ; if ( empty ( $ model ) ) return $ this ; if ( $ this instanceof \ JanDolata \ CrudeCRUD \ Engine \ Interfaces \ WithFileInterface ) { $ fileAttrName = $ this -> fileAttrName ; $ modelFiles = $ model -> $ fileAttrName ; foreach ( $ modelFiles a... | Delete by id |
5,064 | public function recursiveConvertInArray ( $ array ) { $ newArray = [ ] ; foreach ( $ array as $ key => $ value ) { if ( $ value instanceof \ MongoDB \ Model \ BSONDocument || $ value instanceof \ MongoDB \ Model \ BSONArray ) { $ value = ( array ) $ value ; } if ( is_array ( $ value ) ) { $ value = $ this -> recursiveC... | Convert BSONDocument and BSONArray to array recursively |
5,065 | public function getHydrator ( $ class ) { $ metadata = $ this -> classMetadataFactory -> getMetadataForClass ( $ class ) ; return new Hydrator ( $ this -> classMetadataFactory , $ metadata , $ this -> documentManager , $ this -> repositoryFactory ) ; } | Get hydrator for specified class |
5,066 | public function getNextOccurence ( DateRepetition $ dateRepetition , DateTime $ datetime = null ) { if ( null === $ datetime ) { $ datetime = $ this -> timeProvider -> now ( ) ; } switch ( true ) { case $ dateRepetition instanceof WeeklyDateRepetition : return $ this -> getNextOccurenceForWeeklyDateRepetition ( $ dateR... | Find next occurence of date repetition |
5,067 | public function add ( $ method ) { if ( ! $ method instanceof MethodInterface ) { throw new \ InvalidArgumentException ( 'This Method must be a instance of \ClassGeneration\MethodInterface' ) ; } if ( $ method -> getName ( ) === null ) { $ method -> setName ( 'method' . ( $ this -> count ( ) + 1 ) ) ; } parent :: set (... | Adds a new Method on collection . |
5,068 | public function toString ( ) { $ string = '' ; $ methods = $ this -> getIterator ( ) ; foreach ( $ methods as $ method ) { $ string .= $ method -> toString ( ) ; } return $ string ; } | Parse the Method Collection to string . |
5,069 | function fail ( $ callback ) { if ( is_null ( $ this -> state ) ) { $ this -> onError [ ] = $ callback ; } else if ( ! $ this -> state ) { $ callback ( $ this -> result ) ; } return $ this ; } | If the wrapped operation ultimately fails on all attempts invoke the given function . Many functions can be added to the stack . If the attempted execution of the wrapped operation has already failed the the function given here will be invoked instantly . |
5,070 | function until ( $ limit ) { $ until = function ( ) use ( $ limit ) { if ( is_int ( $ limit ) ) { if ( $ this -> attempts < $ limit ) { return true ; } else { return false ; } } else { if ( $ limit ( $ this -> lastException , $ this -> attempts ) ) { return true ; } else { return false ; } } } ; $ defaultResult = funct... | Start the loop with the given limit |
5,071 | public function generator ( $ className ) { foreach ( $ this -> generators as $ generator ) { if ( $ generator -> supports ( $ className ) ) { return $ generator -> createGenerator ( $ className ) ; } } return false ; } | Generates a generator from class name rules |
5,072 | private function createGeneratorFactory ( $ generatorClass , \ Closure $ factory = null ) { return function ( $ sourceClass , $ prefixClass ) use ( $ factory , $ generatorClass ) { if ( $ factory ) { return $ factory ( $ sourceClass , $ prefixClass , $ this -> generationIo , $ this -> definedClasses , $ generatorClass ... | Returns generator factory |
5,073 | public function validate ( \ ReflectionFunctionAbstract $ reflectionFunction ) { foreach ( $ reflectionFunction -> getParameters ( ) as $ parameter ) { $ this -> validateParameter ( $ parameter ) ; } return $ this ; } | Validates method signature and tries to generate missing classes |
5,074 | protected static function handleGETById ( $ parameters , $ id , $ modelClass , $ primaryDataParameters = [ ] , $ relationshipParameters = [ ] ) { $ filterValidationModel = $ modelClass :: getFilterValidationModel ( ) ; $ idAttribute = $ modelClass :: getIdAttribute ( ) ; if ( ! empty ( $ filterValidationModel ) && isse... | handles GETById requests |
5,075 | public static function doInsert ( $ criteria , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( RolePermissionTableMap :: DATABASE_NAME ) ; } if ( $ criteria instanceof Criteria ) { $ criteria = clone $ criteria ; } else { $ criteria = $ crit... | Performs an INSERT on the database given a RolePermission or Criteria object . |
5,076 | protected function evaluateFilter ( $ value , $ filter ) { $ filter = explode ( ' ' , $ filter , 2 ) ; if ( 1 === count ( $ filter ) ) { $ args = [ ] ; $ filter = $ filter [ 0 ] ; } else { $ args = array_map ( 'trim' , explode ( ',' , $ filter [ 1 ] ) ) ; $ filter = $ filter [ 0 ] ; } if ( false === isset ( $ this -> f... | Evaluates the given value with the given filter . |
5,077 | public function getProcessor ( $ name ) { return isset ( $ this -> processors [ $ name ] ) ? $ this -> processors [ $ name ] : false ; } | Return a processor by an identifier if it exists |
5,078 | public function setUrl ( $ url ) { if ( is_string ( $ url ) ) { $ this -> url = $ url ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ url ) . "' for argument 'url' given. String expected." ) ; } } | Sets the document URL filter . |
5,079 | public function setUrlPrefix ( $ urlPrefix ) { if ( is_string ( $ urlPrefix ) ) { $ this -> urlPrefix = $ urlPrefix ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ urlPrefix ) . "' for argument 'urlPrefix' given. String expected." ) ; } } | Sets the document URL prefix filter . |
5,080 | public function setDomain ( $ domain ) { if ( is_string ( $ domain ) ) { $ this -> domain = $ domain ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ domain ) . "' for argument 'domain' given. String expected." ) ; } } | Sets the document domain filter . |
5,081 | public function setRegexp ( $ regexp ) { if ( is_string ( $ regexp ) ) { $ this -> regexp = $ regexp ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ regexp ) . "' for argument 'regexp' given. String expected." ) ; } } | Sets the document regular expression filter . |
5,082 | public function getUser ( $ id ) { $ response = $ this -> client -> get ( $ this -> getResourceEndpoint ( ) . '/' . ( int ) $ id ) ; return $ response [ 'Response' ] [ 0 ] [ 'UserCompany' ] ; } | Gets a user its information . |
5,083 | public function getSectionFields ( $ section , $ flatten = true ) { if ( $ flatten === false ) { $ fields = $ this -> fields ; } else { $ fields = $ this -> getFlattenedFields ( ) ; } $ matchedFields = array ( ) ; foreach ( $ fields as $ fieldName => $ field ) { if ( isset ( $ field [ 'options' ] [ 'section' ] ) && $ f... | Get fields for a certain section |
5,084 | public function getFlattenedFields ( ) { if ( ! isset ( $ this -> flatFields ) ) { $ this -> flatFields = [ ] ; foreach ( $ this -> fields as $ field ) { if ( isset ( $ field [ 'fields' ] ) && is_array ( $ field [ 'fields' ] ) ) { $ this -> flatFields += $ this -> flattenCollection ( $ field ) ; } else { $ this -> flat... | Flatten all fields by moving collections into the main array |
5,085 | protected function flattenCollection ( $ field ) { if ( ! isset ( $ field [ 'fields' ] ) || ! is_array ( $ field [ 'fields' ] ) ) { return [ ] ; } $ fields = [ ] ; foreach ( $ field [ 'fields' ] as $ field ) { if ( isset ( $ field [ 'fields' ] ) && is_array ( $ field [ 'fields' ] ) ) { $ fields += $ this -> flattenColl... | Flatten the fields in a collection |
5,086 | public function getFieldsWithoutSection ( ) { $ matchedFields = array ( ) ; foreach ( $ this -> fields as $ fieldName => $ field ) { if ( ! isset ( $ field [ 'options' ] [ 'section' ] ) || $ field [ 'options' ] [ 'section' ] === null || $ field [ 'options' ] [ 'section' ] === '' ) { $ matchedFields [ $ fieldName ] = $ ... | Get any fields that don t have a section set |
5,087 | protected function translate ( $ str , $ params = array ( ) ) { if ( isset ( $ this -> translator ) ) { return $ this -> translator -> trans ( $ str , $ params ) ; } else { $ finalParams = array ( ) ; foreach ( $ params as $ placeholder => $ value ) { $ finalParams [ '{' . $ placeholder . '}' ] = $ value ; } return str... | Translate a string if the translator has been injected |
5,088 | protected function _getLinkId ( ) { if ( $ connect = ldap_connect ( $ this -> _params [ 'hostname' ] , $ this -> _params [ 'port' ] ) ) { ldap_set_option ( $ connect , LDAP_OPT_PROTOCOL_VERSION , $ this -> _params [ 'protocolVersion' ] ) ; ldap_set_option ( $ connect , LDAP_OPT_REFERRALS , 0 ) ; return $ connect ; } re... | open the connection to the ldap server |
5,089 | protected function _bindLdapAdminUser ( ) { $ connect = $ this -> _getLinkId ( ) ; if ( ! $ connect ) { jLog :: log ( 'ldapdao: impossible to connect to ldap' , 'auth' ) ; return false ; } if ( $ this -> _params [ 'adminUserDn' ] == '' ) { $ bind = ldap_bind ( $ connect ) ; } else { $ bind = ldap_bind ( $ connect , $ t... | open the connection to the ldap server and bind to the admin user |
5,090 | public function getRequestData ( ) { parent :: getRequestData ( ) ; if ( $ this -> getRequest ( ) instanceof Request ) { if ( in_array ( $ this -> getRequest ( ) -> getMethod ( ) , array ( 'PUT' , 'DELETE' ) ) ) { $ this -> requestData [ $ this -> getRequest ( ) -> getMethod ( ) ] = $ this -> getRequest ( ) -> request ... | Cached values for request . |
5,091 | public function hasParameterValues ( ) { foreach ( $ this -> parameters as $ name => $ parameter ) { if ( ! $ parameter -> isRequired ( ) ) { return true ; } } return false ; } | Returns whether the type has parameters with default values . |
5,092 | public function acceptsBinding ( $ binding ) { return $ binding instanceof $ this -> acceptedBindingClass || $ binding === $ this -> acceptedBindingClass || is_subclass_of ( $ binding , $ this -> acceptedBindingClass ) ; } | Returns whether the type accepts a binding class . |
5,093 | public function updateApiEntity ( Order $ apiOrder , $ locale ) { $ items = $ apiOrder -> getItems ( ) ; $ prices = $ supplierItems = null ; $ totalPrice = $ this -> priceCalculator -> calculate ( $ items , $ prices , $ supplierItems ) ; if ( $ supplierItems ) { $ supplierItems = array_values ( $ supplierItems ) ; $ th... | Function updates the api - entity like price - calculations |
5,094 | public function getContactData ( $ addressData , $ contact ) { $ result = array ( ) ; if ( $ addressData && isset ( $ addressData [ 'firstName' ] ) && isset ( $ addressData [ 'lastName' ] ) ) { $ result [ 'firstName' ] = $ addressData [ 'firstName' ] ; $ result [ 'lastName' ] = $ addressData [ 'lastName' ] ; $ result [... | Returns contact data as an array . Either by provided address or contact |
5,095 | public function convertStatus ( $ order , $ statusId , $ flush = false , $ persist = true ) { if ( $ order instanceof Order ) { $ order = $ order -> getEntity ( ) ; } $ currentStatus = $ order -> getStatus ( ) ; if ( $ currentStatus ) { if ( $ currentStatus instanceof \ Massive \ Bundle \ Purchase \ OrderBundle \ Api \... | Converts the status of an order |
5,096 | public function findOrderEntityById ( $ id ) { try { return $ this -> em -> getRepository ( static :: $ orderEntityName ) -> find ( $ id ) ; } catch ( NoResultException $ nre ) { throw new EntityNotFoundException ( static :: $ orderEntityName , $ id ) ; } } | Find order entity by id |
5,097 | public function findOrderEntityForItemWithId ( $ id , $ returnMultipleResults = false ) { try { return $ this -> em -> getRepository ( static :: $ orderEntityName ) -> findOrderForItemWithId ( $ id , $ returnMultipleResults ) ; } catch ( NoResultException $ nre ) { throw new EntityNotFoundException ( static :: $ itemEn... | Find order for item with id |
5,098 | protected function createMediaForSupplierItems ( $ items , $ locale ) { foreach ( $ items as $ item ) { if ( isset ( $ item [ 'items' ] ) && count ( $ item [ 'items' ] > 0 ) ) { $ this -> createMediaForItems ( $ item [ 'items' ] , $ locale ) ; } } } | Creates correct media - api for supplier - items array |
5,099 | protected function createMediaForItems ( $ items , $ locale ) { foreach ( $ items as $ item ) { $ product = $ item -> getProduct ( ) ; if ( $ product ) { $ this -> productManager -> createProductMedia ( $ product , $ locale ) ; } $ item -> setProduct ( $ product ) ; } } | Creates correct media - api for items array |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.