idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
58,200 | public function update ( $ service , $ headers = null , $ data ) { return $ this -> put ( $ service , $ headers , $ data ) ; } | Update request Use HTTP PUT to update data |
58,201 | public function put ( $ service , $ headers = null , $ data = null ) { return $ this -> customRequest ( $ service , 'PUT' , $ headers , $ data ) ; } | PUT request Use HTTP PUT to update data |
58,202 | public function read ( $ service , $ headers = null , $ data = null ) { return $ this -> get ( $ service , $ headers , $ data ) ; } | Read request Use HTTP GET to read data |
58,203 | public function get ( $ service , $ headers = null , $ data = null ) { return $ this -> customRequest ( $ service , 'GET' , $ headers , $ data ) ; } | GET request Use HTTP GET to read data |
58,204 | public function customRequest ( $ service , $ method = 'GET' , $ headers = null , $ data = null ) { $ serviceUrl = $ this -> urlService ( $ service ) ; $ request = new Request ( $ serviceUrl , $ method ) ; $ headers = $ this -> recieveHeaders ( $ headers ) ; if ( null !== $ headers ) { $ request -> setHeaders ( $ heade... | Custom request to call |
58,205 | protected function urlService ( $ service ) { if ( $ service instanceof Uri ) { $ uri = $ service -> get ( ) ; } else { $ uri = $ service ; } return $ this -> baseUrl . '/' . ltrim ( $ uri , '/' ) ; } | Change the service to a complete URL |
58,206 | protected function AttachButtonBarResources ( $ Sender , $ Formatter ) { if ( ! in_array ( $ Formatter , $ this -> Formats ) ) return ; $ Sender -> AddJsFile ( 'buttonbar.js' , 'plugins/ButtonBar' ) ; $ Sender -> AddJsFile ( 'jquery.hotkeys.js' , 'plugins/ButtonBar' ) ; $ Sender -> AddDefinition ( 'ButtonBarLinkUrl' , ... | Insert buttonbar resources |
58,207 | public function Gdn_Form_BeforeBodyBox_Handler ( $ Sender ) { $ Wrap = false ; if ( Gdn :: Controller ( ) instanceof PostController ) $ Wrap = true ; $ this -> AttachButtonBar ( $ Sender , $ Wrap ) ; } | Attach ButtonBar anywhere BodyBox is used . |
58,208 | protected function AttachButtonBar ( $ Sender , $ Wrap = FALSE ) { $ Formatter = C ( 'Garden.InputFormatter' , 'Html' ) ; if ( ! in_array ( $ Formatter , $ this -> Formats ) ) return ; $ View = Gdn :: Controller ( ) -> FetchView ( 'buttonbar' , '' , 'plugins/ButtonBar' ) ; if ( $ Wrap ) echo Wrap ( $ View , 'div' , arr... | Attach button bar in place |
58,209 | public static function boot ( array $ config ) { if ( self :: $ booted ) { return ; } if ( ! isset ( $ config [ 'loader' ] ) ) { throw new BadMethodCallException ( 'Requires at least loader instance or configuration' ) ; } else { if ( is_array ( $ config [ 'loader' ] ) ) { $ loader = new Rails \ Loader \ Loader ( ) ; i... | Boot Rails . |
58,210 | public function setSharedByDefault ( $ sharedByDefault ) { if ( $ this -> locked ) { throw new Exception \ LockedContainerException ( ) ; } $ this -> sharedByDefault = ( bool ) $ sharedByDefault ; return $ this ; } | Set shared by default |
58,211 | public function setAllowOverride ( $ allowOverride ) { if ( $ this -> locked ) { throw new Exception \ LockedContainerException ( ) ; } $ this -> allowOverride = ( bool ) $ allowOverride ; return $ this ; } | Set allow override |
58,212 | public function setAutoLock ( $ autoLock ) { if ( $ this -> locked ) { throw new Exception \ LockedContainerException ( ) ; } $ this -> autoLock = ( bool ) $ autoLock ; return $ this ; } | Set auto lock |
58,213 | protected function hasAbstract ( $ name , $ key , array $ entry ) { if ( is_string ( $ entry [ 'entry' ] ) ) { $ factory = $ entry [ 'entry' ] ; $ this -> entries [ $ key ] [ 'entry' ] = $ entry [ 'entry' ] = new $ factory ( ) ; } $ factory = $ entry [ 'entry' ] ; $ container = $ this -> delegator ? : $ this ; if ( $ f... | Check whether an abstract factory can create a given name . |
58,214 | protected function validateClassEntry ( $ entry ) { if ( ! is_string ( $ entry ) && ! is_object ( $ entry ) ) { $ type = gettype ( $ entry ) ; $ message = sprintf ( 'Argument "entry" in "%s" must be a string or an object; "%s" was given.' , __METHOD__ , $ type ) ; throw new Exception \ InvalidArgumentException ( $ mess... | Validate class entry . |
58,215 | protected function validateFactoryEntry ( $ entry ) { if ( ! is_string ( $ entry ) && ! is_callable ( $ entry ) && ! $ entry instanceof FactoryInterface ) { $ type = is_object ( $ entry ) ? get_class ( $ entry ) : gettype ( $ entry ) ; $ message = sprintf ( 'Argument "entry" in "%s" must be a string, a callable or an i... | Validate factory entry . |
58,216 | protected function validateAbstractFactoryEntry ( $ entry ) { if ( ! is_string ( $ entry ) && ! $ entry instanceof AbstractFactoryInterface ) { $ type = is_object ( $ entry ) ? get_class ( $ entry ) : gettype ( $ entry ) ; $ message = sprintf ( 'Argument "entry" in "%s" must be a string or an instance ' . 'of "%s"; "%s... | Validate abastract factory entry . |
58,217 | protected function validateAliasEntry ( $ entry ) { if ( ! is_string ( $ entry ) ) { $ type = is_object ( $ entry ) ? get_class ( $ entry ) : gettype ( $ entry ) ; $ message = sprintf ( 'Argument "entry" in "%s" must be a string; "%s" was given.' , __METHOD__ , $ type ) ; throw new Exception \ InvalidArgumentException ... | Validate alias entry . |
58,218 | protected function checkLockAndValidateName ( $ name ) { if ( $ this -> locked ) { throw new Exception \ LockedContainerException ( ) ; } if ( ! is_string ( $ name ) || trim ( $ name ) === '' ) { throw new Exception \ InvalidNameException ( $ name ) ; } } | Check lock and validate name . |
58,219 | public function addAbstractFactory ( $ name , $ abstractFactory , $ shared = null ) { return $ this -> add ( $ name , $ abstractFactory , self :: ENTRY_TYPE_ABSTRACT_FACTORY , $ shared ) ; } | Add abstract factory |
58,220 | protected function phpErrorLevel ( $ level ) { switch ( $ level ) { case E_NOTICE : case E_USER_NOTICE : case E_STRICT : case E_DEPRECATED : case E_USER_DEPRECATED : return LogLevel :: NOTICE ; case E_WARNING : case E_USER_WARNING : case E_COMPILE_WARNING : case E_CORE_WARNING : return LogLevel :: WARNING ; case E_ERRO... | Get LogLevel corresponding to PHP error |
58,221 | public function execute ( ) { $ controller = $ this -> getController ( ) ; if ( ! $ controller ) { $ controller = $ this -> factoryController ( ) ; $ this -> setController ( $ controller ) ; } $ this -> prepareController ( $ controller ) ; $ action = $ this -> getAction ( ) ; if ( ! $ controller -> respondTo ( $ action... | If the controller was not manually set it instanciates it with the provided controller class |
58,222 | public function prepareController ( $ controller ) { $ response = $ this -> getResponse ( ) ; if ( ! $ response ) { $ response = new Response ( ) ; } $ controller -> setView ( $ this -> getView ( ) ) -> setResponse ( $ response ) -> setDependencyContainer ( $ this -> getDependencyContainer ( ) ) -> setRequest ( $ this ... | Set data to the controller |
58,223 | protected function getVisitorsFilteredByDateRange ( Carbon $ start , Carbon $ end ) { return $ this -> getCachedVisitors ( ) -> filter ( function ( Visitor $ session ) use ( $ start , $ end ) { return $ session -> updated_at -> between ( $ start , $ end ) ; } ) ; } | Get the filtered visitors by date range . |
58,224 | protected function getVisitsFilteredByDateRange ( Carbon $ start , Carbon $ end ) { return $ this -> getCachedVisits ( ) -> filter ( function ( VisitorActivity $ visit ) use ( $ start , $ end ) { return $ visit -> created_at -> between ( $ start , $ end ) ; } ) ; } | Get the filtered visits by date range . |
58,225 | public function getFunctions ( ) { return [ new ExpressionFunction ( 'elcodi_config' , function ( $ name , $ defaultValue = null ) { return ( $ defaultValue ) ? sprintf ( '$this->get(\'elcodi.manager.configuration\')->get(%s,%s)' , $ name , $ defaultValue ) : sprintf ( '$this->get(\'elcodi.manager.configuration\')->get... | Get functions defined by this Expression Language element . |
58,226 | public static function set ( string $ defaultLocal ) { if ( self :: $ hasBeenSet ) { throw new LocaleException ( 'Default locale may only be set once' ) ; } self :: $ defaultLocal = $ defaultLocal ; self :: $ hasBeenSet = true ; } | Allows set on bootstrap and may only be set once |
58,227 | public function require ( ) : IQueueObject { $ queueObject = $ this -> remoteLoader -> load ( $ this -> name , $ this -> canCreateNew ( ) ) ; if ( ! $ queueObject ) { throw new QueueNotExistsException ( $ this -> name ) ; } return $ queueObject ; } | Exception is thrown if queue does not exist and can t be created . |
58,228 | public function getAuthorizationMethod ( ) { if ( $ this -> hasHeader ( 'Authorization' ) ) { $ authorization = $ this -> getHeader ( 'Authorization' ) ; return strstr ( $ authorization , ' ' , true ) ; } return false ; } | Get Authorization method |
58,229 | public function is ( $ sTest ) { $ arsMethod = array ( 'get' , 'put' , 'patch' , 'post' , 'delete' , 'head' , 'options' ) ; if ( in_array ( $ sTest , $ arsMethod ) ) { if ( strtolower ( $ this -> getMethod ( ) ) == $ sTest ) { return true ; } else { return false ; } } elseif ( $ sTest == 'ajax' ) { if ( strtolower ( $ ... | Check method ajax json and xml |
58,230 | private function isAccept ( $ acceptHeader , $ test ) { $ acceptList = $ this -> parseAccept ( $ acceptHeader ) ; if ( empty ( $ test ) ) { return $ acceptList ; } else { foreach ( $ acceptList as $ acceptType ) { if ( in_array ( $ test , $ acceptType ) ) { return true ; } if ( in_array ( '*/*' , $ acceptType ) ) { ret... | Check accept field |
58,231 | public function isAcceptCharset ( $ charset ) { if ( $ this -> hasHeader ( 'Accept-Charset' ) ) { return $ this -> isAccept ( $ this -> getHeader ( 'Accept-Charset' ) , $ charset ) ; } return false ; } | Check accept charset |
58,232 | public function isAcceptEncoding ( $ encoding ) { if ( $ this -> hasHeader ( 'Accept-Encoding' ) ) { return $ this -> isAccept ( $ this -> getHeader ( 'Accept-Encoding' ) , $ encoding ) ; } return false ; } | Check accept encoding |
58,233 | public function isAcceptLanguage ( $ language ) { if ( $ this -> hasHeader ( 'Accept-Language' ) ) { return $ this -> isAccept ( $ this -> getHeader ( 'Accept-Language' ) , $ language ) ; } return false ; } | Check accept language |
58,234 | public function isAcceptMimetype ( $ mimetype ) { if ( $ this -> hasHeader ( 'Accept' ) ) { return $ this -> isAccept ( $ this -> getHeader ( 'Accept' ) , $ mimetype ) ; } return false ; } | Check accept mimetype |
58,235 | private function parseAccept ( $ sHeaderLine ) { $ arsAccept = [ ] ; $ arsHeader = explode ( ',' , $ sHeaderLine ) ; foreach ( array_filter ( $ arsHeader ) as $ sValue ) { $ nPrefValue = '1.0' ; $ sValue = trim ( $ sValue ) ; $ semiPos = strpos ( $ sValue , ';' ) ; if ( $ semiPos !== false ) { $ arsParams = explode ( '... | Parse accept type line |
58,236 | protected function parseInterpolationString ( $ str ) { $ parsed = [ ] ; if ( ! preg_match_all ( '~\{([a-z\d_\-\|\#]+?)\}~i' , $ str , $ matches ) ) { return $ parsed ; } foreach ( $ matches [ 1 ] as $ key => $ value ) { $ parsed [ $ matches [ 0 ] [ $ key ] ] = explode ( '|' , $ value ) ; } return $ parsed ; } | Extract interpolation directives and filters from input string |
58,237 | protected function handleSubdirectives ( array $ data , $ arg ) { if ( count ( $ data ) <= 1 ) { return $ arg ; } array_shift ( $ data ) ; foreach ( $ data as $ value ) { $ arg = $ this -> handlers_filters -> call ( $ value , $ arg ) ; } return $ arg ; } | Call filter handlers by array of names from passed handlers list with argument |
58,238 | public function resolveStorePath ( $ str , File $ file ) { $ cache = [ ] ; $ parsed = $ this -> parseInterpolationString ( $ str ) ; foreach ( $ parsed as $ key => $ directive_with_filters ) { $ directive_key_dirty = reset ( $ directive_with_filters ) ; $ directive_key = strstr ( $ directive_key_dirty , '#' , true ) ? ... | Make path to file using path pattern |
58,239 | public function resolvePath ( $ str , $ model , $ model_map = array ( ) ) { $ parsed = $ this -> parseInterpolationString ( $ str ) ; foreach ( $ parsed as $ key => $ directive_with_filters ) { $ directive = reset ( $ directive_with_filters ) ; $ field = isset ( $ model_map [ $ directive ] ) ? $ model_map [ $ directive... | Make url to file using path pattern |
58,240 | public function find ( $ id , $ rootVersion = null , $ recursive = false ) { $ block = $ this -> getRepository ( ) -> find ( $ id ) ; if ( $ rootVersion ) { if ( ! $ recursive ) { $ this -> revert ( $ block , $ rootVersion ) ; } else { return $ this -> revertRecursiveFromNode ( $ block , $ rootVersion ) ; } } return $ ... | Find a Block in the repository with optional specified version . With rootVersion set and version false it will give you the newest by default . |
58,241 | public function publish ( BlockInterface $ block ) { if ( ! ( $ block instanceof BlockOwnerInterface ) && ! $ block -> isShared ( ) ) { throw new \ Exception ( 'Can only publish blocks of type BlockOwner or shared' ) ; } $ this -> killLoggableListener ( ) ; $ this -> killSoftDeletableListener ( ) ; $ owned = $ this -> ... | Publishes a block version |
58,242 | public function revert ( BlockInterface $ block , $ version ) { $ block -> accept ( new RevertVisitor ( $ this , $ version ) ) ; if ( $ block instanceof BlockContainerInterface ) { self :: treeAddMissingChildren ( $ block ) ; self :: treeRemoveInvalidChildren ( $ block ) ; $ block -> accept ( new SortVisitor ( ) ) ; } ... | Revert the block to the rootVersion and if version equals false it will give you the newest by default . |
58,243 | public function revertSingle ( BlockInterface $ block , $ version ) { $ repo = $ this -> em -> getRepository ( 'OpiferContentBundle:BlockLogEntry' ) ; $ logs = $ repo -> getLogEntriesRoot ( $ block , $ version ) ; if ( count ( $ logs ) ) { $ latest = current ( $ logs ) -> getVersion ( ) ; $ repo -> revert ( $ block , $... | Actual implementation of reverting a block to a state of the version . |
58,244 | public function killLoggableListener ( ) { foreach ( $ this -> em -> getEventManager ( ) -> getListeners ( ) as $ event => $ listeners ) { foreach ( $ listeners as $ hash => $ listener ) { if ( $ listener instanceof LoggableListener ) { $ listenerInst = $ listener ; break 2 ; } } } $ this -> em -> getEventManager ( ) -... | Removes the LoggableListener from the EventManager |
58,245 | public function killSoftDeletableListener ( ) { foreach ( $ this -> em -> getEventManager ( ) -> getListeners ( ) as $ event => $ listeners ) { foreach ( $ listeners as $ hash => $ listener ) { if ( $ listener instanceof SoftDeleteableListener ) { $ listenerInst = $ listener ; break 2 ; } } } $ this -> em -> getEventMa... | Removes the SoftDeleteableListener from the EventManager |
58,246 | public static function treeAddMissingChildren ( BlockContainerInterface $ block , \ RecursiveIteratorIterator $ iterator = null ) { if ( ! $ iterator ) { $ iterator = new \ RecursiveIteratorIterator ( new RecursiveBlockIterator ( ( $ block instanceof BlockOwnerInterface ) ? $ block -> getOwning ( ) : $ block -> getChil... | Fixes nested tree hierarchy between parent and children by examining child s parent . |
58,247 | protected function build ( array $ parameters ) { $ route = preg_split ( '`([/.-])`' , $ this -> route , - 1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ) ; $ regex = array ( ) ; $ position = 0 ; foreach ( $ route as $ index => $ element ) { switch ( $ element ) { case '.' : $ regex [ $ element . '-' . $ index ] =... | Build pattern based on the route to match uri . |
58,248 | public function verify ( $ url ) { $ url = parse_url ( $ url ) ; if ( $ url === false ) { throw new \ Exception ( 'Bad url to match (not an url ?)' ) ; } $ path = isset ( $ url [ 'path' ] ) ? $ url [ 'path' ] : '' ; if ( ( bool ) preg_match ( $ this -> pattern , $ path , $ matches ) ) { array_shift ( $ matches ) ; fore... | Verify if the url match with current route . |
58,249 | public function getUniqueCountry ( ) { if ( $ this -> country !== Yii :: $ app -> params [ 'defaultCountry' ] ) { $ countries = Locations :: countryList ( ) ; return $ countries [ $ this -> country ] ; } return ; } | Get unique country . |
58,250 | public function getCsz ( ) { $ str = $ this -> city ; if ( ! empty ( $ this -> subnational_division ) ) { $ str .= ", " . $ this -> subnational_division ; } if ( ! empty ( $ this -> postal_code ) ) { $ str .= " " . $ this -> postal_code ; } return $ str ; } | Get csz . |
58,251 | public function getCitySubnational ( ) { $ str = $ this -> city ; if ( ! empty ( $ this -> subnational_division ) ) { $ str .= ", " . $ this -> subnational_division ; } return $ str ; } | Get city subnational . |
58,252 | public function getFlatAddress ( ) { $ parts = [ 'address1' , 'address2' , 'csz' , 'country' ] ; $ address = [ ] ; foreach ( $ parts as $ part ) { if ( isset ( $ this -> { $ part } ) ) { $ address [ ] = $ this -> { $ part } ; } } return implode ( ', ' , $ address ) ; } | Get flat address . |
58,253 | public function make ( ) { if ( ( $ params = $ this -> canBuild ( ) ) ) { $ reflectionClass = new \ ReflectionClass ( $ this -> className ) ; $ object = $ reflectionClass -> newInstanceArgs ( is_array ( $ params ) ? $ params : [ ] ) ; $ this -> resetObject ( $ object ) ; foreach ( $ this -> params as $ key => $ value )... | Try to build the object if we can t return this class |
58,254 | protected function getReflectionInfos ( ) { try { $ this -> constructMethod = new \ ReflectionMethod ( $ this -> className , "__construct" ) ; $ params = $ this -> constructMethod -> getParameters ( ) ; $ i = 0 ; foreach ( $ params as $ param ) { $ paramsInfos = [ 'name' => $ param -> getName ( ) ] ; if ( ! empty ( $ p... | Find the construct parameters |
58,255 | protected function setProperty ( $ object , $ name = null ) { if ( $ name === null ) { $ this -> params [ ] = $ object ; } else { $ this -> params [ $ name ] = $ object ; } return $ this -> make ( ) ; } | Add the property to the parameters and tries to build the object |
58,256 | protected function resetObject ( & $ object ) { $ class = new \ ReflectionClass ( $ this -> className ) ; $ properties = $ class -> getDefaultProperties ( ) ; foreach ( $ properties as $ propName => $ property ) { if ( is_string ( $ property ) && class_exists ( $ property ) ) { $ object -> with ( null , $ propName ) ; ... | Reset the default object values to null if they were string |
58,257 | protected function canBuild ( ) { if ( ! empty ( $ this -> requiredParams ) ) { $ this -> builder -> build ( $ this -> requiredParams , $ this -> params ) ; if ( $ this -> builder -> getErrors ( ) ) { return false ; } return $ this -> builder -> getParams ( ) ; } return true ; } | Return true if the class doesn t require parameters Return an array of parameters if all parameters can be found Return false if we can t construct the object |
58,258 | protected function decoratorError ( ) { $ errors = $ this -> builder -> getErrors ( ) ; if ( empty ( $ errors ) ) { $ this -> builder -> build ( $ this -> requiredParams , $ this -> params ) ; } throw new Exception ( sprintf ( "Error when building %s - %s" , $ this -> className , implode ( ' - ' , $ this -> builder -> ... | Throw a build exception for every error found in the building process |
58,259 | public function process ( ContainerBuilder $ container ) { $ this -> compiler = $ container -> getCompiler ( ) ; $ this -> formatter = $ this -> compiler -> getLoggingFormatter ( ) ; $ container -> setDefinitions ( $ this -> resolveArguments ( $ container , $ container -> getDefinitions ( ) , true ) ) ; } | Process the ContainerBuilder to replace DefinitionDecorator instances with their real Definition instances . |
58,260 | private function resolveArguments ( ContainerBuilder $ container , array $ arguments , $ isRoot = false ) { foreach ( $ arguments as $ k => $ argument ) { if ( $ isRoot ) { $ arguments [ $ k ] = $ argument = $ container -> getDefinition ( $ k ) ; $ this -> currentId = $ k ; } if ( is_array ( $ argument ) ) { $ argument... | Resolves definition decorator arguments . |
58,261 | public static function load ( $ _sky_name , $ _sky_var = [ ] , $ _sky_return = false ) { $ __prop = Loader :: getName ( $ _sky_name , 'view' ) ; if ( ! file_exists ( $ __prop -> path ) ) { Exceptions :: showError ( 'Server Error' , 'Missing View File: ' . $ __prop -> path ) ; return ; } extract ( $ _sky_var ) ; ob_star... | Load View File |
58,262 | public function rules ( ) { $ data = array ( ) ; foreach ( $ this -> validators as $ validate ) { $ attrs = $ this -> klass -> getStaticPropertyValue ( $ validate ) ; foreach ( wrap_strings_in_arrays ( $ attrs ) as $ attr ) { $ field = $ attr [ 0 ] ; if ( ! isset ( $ data [ $ field ] ) || ! is_array ( $ data [ $ field ... | Returns validator data . |
58,263 | public function validate ( ) { foreach ( $ this -> validators as $ validate ) { $ definition = $ this -> klass -> getStaticPropertyValue ( $ validate ) ; $ this -> $ validate ( wrap_strings_in_arrays ( $ definition ) ) ; } $ model_reflection = Reflections :: instance ( ) -> get ( $ this -> model ) ; if ( $ model_reflec... | Runs the validators . |
58,264 | public function validatesPresenceOf ( $ attrs ) { $ configuration = array_merge ( self :: $ DEFAULT_VALIDATION_OPTIONS , array ( 'message' => Errors :: $ DEFAULT_ERROR_MESSAGES [ 'blank' ] , 'on' => 'save' ) ) ; foreach ( $ attrs as $ attr ) { $ options = array_merge ( $ configuration , $ attr ) ; $ this -> record -> a... | Validates a field is not null and not blank . |
58,265 | public function validatesInclusionOrExclusionOf ( $ type , $ attrs ) { $ configuration = array_merge ( self :: $ DEFAULT_VALIDATION_OPTIONS , array ( 'message' => Errors :: $ DEFAULT_ERROR_MESSAGES [ $ type ] , 'on' => 'save' ) ) ; foreach ( $ attrs as $ attr ) { $ options = array_merge ( $ configuration , $ attr ) ; $... | Validates that a value is in or out of a specified list of values . |
58,266 | public function validatesFormatOf ( $ attrs ) { $ configuration = array_merge ( self :: $ DEFAULT_VALIDATION_OPTIONS , array ( 'message' => Errors :: $ DEFAULT_ERROR_MESSAGES [ 'invalid' ] , 'on' => 'save' , 'with' => null ) ) ; foreach ( $ attrs as $ attr ) { $ options = array_merge ( $ configuration , $ attr ) ; $ at... | Validates that a value is matches a regex . |
58,267 | public function validatesUniquenessOf ( $ attrs ) { $ configuration = array_merge ( self :: $ DEFAULT_VALIDATION_OPTIONS , array ( 'message' => Errors :: $ DEFAULT_ERROR_MESSAGES [ 'unique' ] ) ) ; $ connection = $ this -> klass -> getMethod ( 'connection' ) -> invoke ( null ) ; foreach ( $ attrs as $ attr ) { $ option... | Validates the uniqueness of a value . |
58,268 | public function addOnBlank ( $ attribute , $ msg ) { if ( ! $ msg ) $ msg = self :: $ DEFAULT_ERROR_MESSAGES [ 'blank' ] ; if ( ( $ value = $ this -> model -> $ attribute ) === '' || $ value === null ) $ this -> add ( $ attribute , $ msg ) ; } | Adds the error message only if the attribute value was null or an empty string . |
58,269 | public function full_messages ( ) { $ full_messages = array ( ) ; $ this -> to_array ( function ( $ attribute , $ message ) use ( & $ full_messages ) { $ full_messages [ ] = $ message ; } ) ; return $ full_messages ; } | Returns all the error messages as an array . |
58,270 | public function to_array ( $ closure = null ) { $ errors = array ( ) ; if ( $ this -> errors ) { foreach ( $ this -> errors as $ attribute => $ messages ) { foreach ( $ messages as $ msg ) { if ( is_null ( $ msg ) ) continue ; $ errors [ $ attribute ] [ ] = ( $ message = Utils :: human_attribute ( $ attribute ) . ' ' .... | Returns all the error messages as an array including error key . |
58,271 | public function size ( ) { if ( $ this -> is_empty ( ) ) return 0 ; $ count = 0 ; foreach ( $ this -> errors as $ attribute => $ error ) $ count += count ( $ error ) ; return $ count ; } | Returns the number of error messages there are . |
58,272 | protected function anyKeyExists ( Dotenv $ dotenv ) { foreach ( $ this -> keys as $ key ) { if ( $ dotenv -> has ( $ key ) ) { return true ; } } return false ; } | Determine if any WordPres key already exists in the dotenv file |
58,273 | protected function randomKey ( $ length ) { $ string = '' ; while ( ( $ len = mb_strlen ( $ string ) ) < $ length ) { $ size = $ length - $ len ; $ bytes = random_bytes ( $ size ) ; $ string .= mb_substr ( str_replace ( [ '\\' , '/' , '"' , '\'' ] , '' , base64_encode ( $ bytes ) ) , 0 , $ size , 'UTF-8' ) ; } return $... | Create a random key with out slashes and quotes |
58,274 | public function getControllerName ( ) { if ( null == $ this -> controllerName ) { $ this -> controllerName = ucfirst ( $ this -> input -> getArgument ( 'controllerName' ) ) ; } return $ this -> controllerName ; } | Gets controllerName property |
58,275 | public function getPath ( ) { if ( null == $ this -> path ) { $ this -> path = $ this -> input -> getOption ( 'source-path' ) ; if ( ! is_dir ( $ this -> path ) ) { throw new FileNotFoundException ( "The provided path was not found in your system." ) ; } } return $ this -> path ; } | Gets path property |
58,276 | public function getEntityName ( ) { if ( null == $ this -> entityName ) { $ this -> entityName = $ this -> input -> getOption ( 'entity-name' ) ; } return $ this -> entityName ; } | Get the entity name |
58,277 | public function getControllerGenerator ( ) { if ( null == $ this -> controllerGenerator ) { $ class = $ this -> getTaskClass ( ) ; $ this -> setControllerGenerator ( new $ class ( [ 'entityName' => $ this -> getEntityName ( ) , 'controllerName' => $ this -> getControllerName ( ) , 'sourcePath' => $ this -> getPath ( ) ... | Gets controllerGenerator property |
58,278 | protected function getTaskClass ( ) { $ info = "Generate controller '{$this->getControllerName()}'..." ; $ class = CreateController :: class ; if ( null !== $ this -> getEntityName ( ) ) { $ info = "Generate CRUD controller '{$this->getControllerName()}'..." ; $ class = CreateCrudController :: class ; } $ this -> outpu... | Gets the task for this command |
58,279 | public function getAutoloader ( ) { if ( ! isset ( $ this -> autoloader ) ) { $ this -> autoloader = new Autoloader ( new FileLocator ( $ this -> getPath ( ) ) , $ this -> getInflector ( ) ) ; } return $ this -> autoloader ; } | Returns the autoloader |
58,280 | public function getGeneratorStrategy ( ) { if ( ! isset ( $ this -> generatorStrategy ) ) { $ this -> generatorStrategy = new FileWriterGeneratorStrategy ( new FileLocator ( $ this -> getPath ( ) ) ) ; } return $ this -> generatorStrategy ; } | Returns the Generator Strategy |
58,281 | public function getInflector ( ) { if ( ! isset ( $ this -> inflector ) ) { $ this -> inflector = new ClassNameInflector ( $ this -> getNamespace ( ) ) ; } return $ this -> inflector ; } | Returns the inflector |
58,282 | protected function getRequestData ( ) { $ this -> requestMethod = $ _SERVER [ 'REQUEST_METHOD' ] ; $ arrFullUri = explode ( "?" , $ _SERVER [ 'REQUEST_URI' ] ) ; $ this -> requestPath = $ arrFullUri [ 0 ] ; if ( isset ( $ arrFullUri [ 1 ] ) ) { $ this -> requestParams = C :: uriParams2Array ( $ arrFullUri [ 1 ] ) ; } $... | Collect all the request parameters |
58,283 | private function getCountryInterest ( ) { $ countriesList = array ( ) ; $ requete = " SELECT p.idPays , p.nom , i.idPays FROM pays p LEFT JOIN _interetPays i on i.idPays = p.idPays WHERE i.idUtilisateur = " . $ this -> userId . " " ; $ res = $ this -> connexionBdd -> requete ( $ requete ) ; while ( $ ... | Get the list of the countries in the interest list of the user |
58,284 | private function getCityInterest ( ) { $ citiesList = array ( ) ; $ requete = " SELECT v.idVille , v.nom , i.idVille FROM ville v LEFT JOIN _interetVille i on i.idVille = v.idVille WHERE i.idUtilisateur = " . $ this -> userId . " " ; $ res = $ this -> connexionBdd -> requete ( $ requete ) ; while ( $ ... | Get the list of the cities in the interest list of the user |
58,285 | private function getSubNeighborhoodInterest ( ) { $ sneighborhood = array ( ) ; $ requete = " SELECT sq.idSousQuartier , sq.nom , i.idSousQuartier FROM sousQuartier sq LEFT JOIN _interetSousQuartier i on i.idSousQuartier = sq.idSousQuartier WHERE i.idUtilisateur = " . $ this -> userId . " " ; $ res = ... | Get the list of the neighborhood in the interest list if the user |
58,286 | private function getStreetInterest ( ) { $ street = array ( ) ; $ requete = " SELECT r.idRue , r.nom , i.idRue FROM rue r LEFT JOIN _interetRue i on i.idRue = r.idSousQuartier WHERE i.idUtilisateur = " . $ this -> userId . " " ; $ res = $ this -> connexionBdd -> requete ( $ requete ) ; while ( $ fetch... | Get the list of the streets in the interest list if the user |
58,287 | private function getAddressInterest ( ) { $ address = array ( ) ; $ requete = " SELECT a.idHistoriqueAdresse , a.nom , i.idHistoriqueAdresse FROM historiqueAdresse a LEFT JOIN _interetAdresse i on i.idHistoriqueAdresse = a.idHistoriqueAdresse WHERE i.idUtilisateur = " . $ this -> userId . " " ; $ res ... | Get the list of the addresses in the interest list if the user |
58,288 | private function getPersonInterest ( ) { $ person = array ( ) ; $ requete = " SELECT p.idPersonne , p.nom ,p.prenom, i.idRue FROM personne p LEFT JOIN _interetRue i on i.idUtilisateur = p.idPersonne WHERE i.idUtilisateur = " . $ this -> userId . " " ; $ res = $ this -> connexionBdd -> requete ( $ requ... | Get the list of the person in the interest list if the user |
58,289 | private function getCityName ( $ id , $ type ) { switch ( $ type ) { case 'quartier' : $ requete = " SELECT v.nom FROM ville v LEFT JOIN quartier q on q.idVille = v.idVille WHERE q.idQuartier = $id " ; break ; case 'sousQuartier' : $ requete = " SELECT v.nom FROM ville v LEFT JO... | Get the city name with an id and a type of input |
58,290 | public function put ( $ element ) { if ( ! $ this -> contains ( $ element ) ) { $ this -> elements [ ] = $ element ; $ this -> fire ( new SetPutEvent ( $ element ) ) ; } } | Adds the given element to the set if is not yet contained in it . |
58,291 | public function remove ( $ element ) { foreach ( $ this -> elements as $ index => $ e ) { if ( $ e === $ element ) { unset ( $ this -> elements [ $ index ] ) ; $ this -> fire ( new SetRemoveEvent ( $ element ) ) ; return ; } } } | Removes given element from the set . |
58,292 | public function filterByDependencyId ( $ dependencyId = null , $ comparison = null ) { if ( is_array ( $ dependencyId ) ) { $ useMinMax = false ; if ( isset ( $ dependencyId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillDependencyTableMap :: COL_DEPENDENCY_ID , $ dependencyId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; ... | Filter the query on the dependency_id column |
58,293 | public function useSkillRelatedByDependencyIdQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinSkillRelatedByDependencyId ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'SkillRelatedByDependencyId' , '\gossi\trixionary\model\SkillQuery' ) ;... | Use the SkillRelatedByDependencyId relation Skill object |
58,294 | public function useSkillRelatedByParentIdQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinSkillRelatedByParentId ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'SkillRelatedByParentId' , '\gossi\trixionary\model\SkillQuery' ) ; } | Use the SkillRelatedByParentId relation Skill object |
58,295 | public function with ( ) { $ expectedArguments = func_get_args ( ) ; $ this -> expectation -> setMatchesCallback ( function ( $ name , $ args ) use ( $ expectedArguments ) { if ( $ name != $ this -> methodName ) { return false ; } if ( count ( $ args ) != count ( $ expectedArguments ) ) { return false ; } foreach ( $ e... | Call with any number of arguments to define exact - match arguments which the expectation should require . |
58,296 | public function withAnyArgs ( ) { $ this -> expectation -> setMatchesCallback ( function ( $ name , $ args ) { if ( $ name == $ this -> methodName ) { return true ; } else { return false ; } } ) ; $ this -> commentBuilder -> setAnyArgs ( ) ; return $ this ; } | Match any call to this method |
58,297 | public function withNoArgs ( ) { $ this -> expectation -> setMatchesCallback ( function ( $ name , $ args ) { if ( $ name == $ this -> methodName && count ( $ args ) == 0 ) { return true ; } else { return false ; } } ) ; $ this -> commentBuilder -> setArgs ( [ ] ) ; return $ this ; } | Match calls to this method with no args |
58,298 | public function never ( ) { $ this -> expectation -> setSatisfied ( true ) ; $ this -> expectation -> setPerformCallback ( function ( $ name , $ args ) { $ this -> expectation -> setSatisfied ( false ) ; $ message = "$name should never be called" ; if ( count ( $ args ) ) { $ message .= " with " . Util :: printArray ( ... | Define that this expectation should never be met |
58,299 | public function andReturn ( $ returnValue ) { $ this -> expectation -> setPerformCallback ( function ( $ name , $ args ) use ( $ returnValue ) { if ( $ returnValue instanceof \ Closure ) { return $ returnValue ( $ args ) ; } else { return $ returnValue ; } } ) ; return $ this ; } | Return the provided value . If a closure is provided the closure will be called with the method arguments and it s return value will be returned by the mock . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.