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 ( $ headers ) ; } if ( null !== $ data ) { $ data = $ this -> dataFormalize ( $ data ) ; $ request -> setContent ( $ data ) ; } $ request -> setFormat ( $ this -> resource ) ; return $ request ; }
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' , T ( 'ButtonBar.LinkUrlText' , 'Enter your URL:' ) ) ; $ Sender -> AddDefinition ( 'ButtonBarImageUrl' , T ( 'ButtonBar.ImageUrlText' , 'Enter image URL:' ) ) ; $ Sender -> AddDefinition ( 'ButtonBarBBCodeHelpText' , T ( 'ButtonBar.BBCodeHelp' , 'You can use <b><a href="http://en.wikipedia.org/wiki/BBCode" target="_new">BBCode</a></b> in your post.' ) ) ; $ Sender -> AddDefinition ( 'ButtonBarHtmlHelpText' , T ( 'ButtonBar.HtmlHelp' , 'You can use <b><a href="http://htmlguide.drgrog.com/cheatsheet.php" target="_new">Simple Html</a></b> in your post.' ) ) ; $ Sender -> AddDefinition ( 'ButtonBarMarkdownHelpText' , T ( 'ButtonBar.MarkdownHelp' , 'You can use <b><a href="http://en.wikipedia.org/wiki/Markdown" target="_new">Markdown</a></b> in your post.' ) ) ; $ Sender -> AddDefinition ( 'InputFormat' , $ Formatter ) ; }
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' , array ( 'class' => 'P' ) ) ; else echo $ View ; }
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 ( ) ; if ( isset ( $ config [ 'loader' ] [ 'paths' ] ) ) { $ loader -> addPaths ( $ config [ 'loader' ] [ 'paths' ] ) ; } if ( isset ( $ config [ 'loader' ] [ 'composerAutoloader' ] ) ) { $ loader -> setComposerAutoloader ( $ config [ 'loader' ] [ 'composerAutoloader' ] ) ; } else { $ loader -> addPath ( __DIR__ . '/Rails' ) ; } $ loader -> register ( ) ; } elseif ( $ config [ 'loader' ] instanceof Rails \ Loader \ Loader ) { $ loader = $ config [ 'loader' ] ; } else { throw new InvalidArgumentException ( sprintf ( 'Loader must be either array or instance of Rails\Loader\Loader, %s passed' , gettype ( $ config [ 'loader' ] ) ) ) ; } } $ sm = new Zend \ ServiceManager \ ServiceManager ( ) ; self :: $ serviceManager = $ sm ; $ sm -> setService ( 'loader' , $ loader ) ; $ sm -> setService ( 'rails.config' , new Rails \ ActiveSupport \ ArrayObject ( [ 'use_cache' => false ] ) ) ; $ sm -> setFactory ( 'inflector' , function ( ) { return new Rails \ ActiveSupport \ Inflector \ Inflector ( new Rails \ ActiveSupport \ Inflector \ Inflections \ EnglishInflections , 'en' ) ; } ) ; $ sm -> setFactory ( 'i18n' , function ( ) { $ tr = new Rails \ I18n \ LoadingTranslator ( ) ; $ tr -> setDefaultLocale ( 'en' ) ; $ tr -> setLoader ( new Rails \ I18n \ Loader ( ) ) ; $ tr -> loader ( ) -> addPaths ( [ __DIR__ . '/Rails/ActiveSupport/Carbon/locales' , __DIR__ . '/Rails/I18n/locales' , ] ) ; return $ tr ; } ) ; self :: $ booted = true ; }
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 ( $ factory -> canCreate ( $ container , $ name ) ) { $ normalized = $ this -> normalizeName ( $ name ) ; $ this -> names [ $ normalized ] = $ name ; $ this -> entries [ $ name ] = $ entry ; return true ; } return false ; }
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 ( $ message ) ; } if ( is_string ( $ entry ) && ! class_exists ( $ entry ) ) { throw new Exception \ ClassNotFoundException ( $ entry ) ; } }
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 instance ' . 'of "%s"; "%s" was given.' , __METHOD__ , FactoryInterface :: class , $ type ) ; throw new Exception \ InvalidArgumentException ( $ message ) ; } if ( is_string ( $ entry ) ) { if ( ! class_exists ( $ entry ) ) { throw new Exception \ ClassNotFoundException ( $ entry ) ; } if ( ! is_subclass_of ( $ entry , FactoryInterface :: class ) ) { $ message = sprintf ( 'Entry "%s" in "%s" is expected to be an instance of "%s".' , $ entry , __METHOD__ , FactoryInterface :: class ) ; throw new Exception \ InvalidArgumentException ( $ message ) ; } } }
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" was given.' , __METHOD__ , AbstractFactoryInterface :: class , $ type ) ; throw new Exception \ InvalidArgumentException ( $ message ) ; } if ( is_string ( $ entry ) ) { if ( ! class_exists ( $ entry ) ) { throw new Exception \ ClassNotFoundException ( $ entry ) ; } if ( ! is_subclass_of ( $ entry , AbstractFactoryInterface :: class ) ) { $ message = sprintf ( 'Entry "%s" in "%s" is expected to be an instance of "%s".' , $ entry , __METHOD__ , AbstractFactoryInterface :: class ) ; throw new Exception \ InvalidArgumentException ( $ message ) ; } } }
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 ( $ message ) ; } if ( ! $ this -> has ( $ entry ) ) { throw new Exception \ NotFoundException ( $ entry ) ; } }
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_ERROR : case E_USER_ERROR : case E_PARSE : case E_COMPILE_ERROR : case E_CORE_ERROR : case E_RECOVERABLE_ERROR : return LogLevel :: ERROR ; } return LogLevel :: ERROR ; }
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 ) ) { throw new Exceptions \ ActionNotFoundException ( sprintf ( "Action '%s::%s' was not defined" , $ controller -> getClass ( ) , $ action ) ) ; } $ controller -> beforeAction ( ) ; $ controller -> send ( $ action ) ; $ controller -> afterAction ( ) ; return $ controller -> getResponse ( ) ; }
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 -> getRequest ( ) ) ; }
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(%s)' , $ name ) ; } , function ( array $ variables , $ name , $ defaultValue = null ) { return $ variables [ 'container' ] -> get ( 'elcodi.manager.configuration' ) -> get ( $ name , $ defaultValue ) ; } ) , ] ; }
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 ( $ this -> getHeader ( 'X-Requested-With' ) ) == 'xmlhttprequest' ) { return true ; } else { return false ; } } elseif ( $ sTest == 'json' ) { if ( $ this -> isAcceptMimetype ( 'application/json' ) === true ) { return true ; } else { return false ; } } elseif ( $ sTest == 'xml' ) { if ( $ this -> isAcceptMimetype ( 'application/xml' ) === true || $ this -> isAcceptMimetype ( 'text/xml' ) === true ) { return true ; } else { return false ; } } }
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 ) ) { return true ; } } return false ; } }
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 ( ';' , $ sValue ) ; $ sValue = trim ( $ arsParams [ 0 ] ) ; foreach ( $ arsParams as $ arsParam ) { $ nQPos = strpos ( $ arsParam , 'q=' ) ; if ( $ nQPos !== false ) { $ nPrefValue = substr ( $ arsParam , $ nQPos + 2 ) ; } } } if ( ! isset ( $ arsAccept [ $ nPrefValue ] ) ) { $ arsAccept [ $ nPrefValue ] = [ ] ; } if ( $ nPrefValue ) { $ arsAccept [ $ nPrefValue ] [ ] = $ sValue ; } } krsort ( $ arsAccept ) ; return $ arsAccept ; }
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 ) ? : $ directive_key_dirty ; if ( ! isset ( $ cache [ $ directive_key ] ) ) { $ cache [ $ directive_key ] = $ this -> handleDirective ( $ directive_key , $ file ) ; } $ result = $ this -> handleSubdirectives ( $ directive_with_filters , $ cache [ $ directive_key ] ) ; $ str = str_replace ( $ key , $ result , $ str ) ; } return new InterpolatorResult ( $ cache , $ str ) ; }
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 ] : $ directive ; $ result = $ this -> handleSubdirectives ( $ directive_with_filters , $ model [ $ field ] , $ this -> handlers_filters ) ; $ str = str_replace ( $ key , $ result , $ str ) ; } return new InterpolatorResult ( $ model , $ str ) ; }
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 $ block ; }
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 -> findByOwner ( $ block ) ; $ version = $ this -> getNewVersion ( $ block ) ; foreach ( $ owned as $ descendant ) { $ this -> revertSingle ( $ descendant , $ version ) ; $ descendant -> setPublish ( true ) ; $ descendant -> setVersion ( $ version ) ; $ descendant -> setRootVersion ( $ version ) ; $ this -> save ( $ descendant ) ; } $ this -> revertSingle ( $ block , $ version ) ; $ block -> setPublish ( true ) ; $ block -> setVersion ( $ version ) ; $ block -> setRootVersion ( $ version ) ; $ this -> save ( $ block ) ; }
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 , $ latest ) ; } else { if ( $ block -> getVersion ( ) > $ version ) { $ block -> getParent ( ) -> removeChild ( $ block ) ; unset ( $ 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 ( ) -> removeEventListener ( array ( 'onFlush' ) , $ listenerInst ) ; }
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 -> getEventManager ( ) -> removeEventListener ( array ( 'onFlush' ) , $ listenerInst ) ; }
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 -> getChildren ( ) ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; } $ pass = array ( ) ; foreach ( $ iterator as $ object ) { if ( in_array ( $ object -> getId ( ) , $ pass ) ) { $ iterator -> next ( ) ; } array_push ( $ pass , $ object -> getId ( ) ) ; if ( $ object -> getParent ( ) && $ object -> getParent ( ) -> getId ( ) == $ block -> getId ( ) ) { if ( ! $ block -> getChildren ( ) -> contains ( $ object ) ) { $ block -> addChild ( $ object ) ; } } } foreach ( $ block -> getChildren ( ) as $ child ) { if ( $ child instanceof BlockContainerInterface ) { self :: treeAddMissingChildren ( $ child , $ iterator ) ; } } }
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 ] = '\\' . $ element ; break ; case '/' : case '-' : $ regex [ $ element . '-' . $ index ] = $ element ; break ; default : if ( ':' === substr ( $ element , 0 , 1 ) ) { $ elementName = substr ( $ element , 1 ) ; $ position ++ ; if ( ! isset ( $ parameters [ $ elementName ] ) ) { $ parameters [ $ elementName ] = new Parameter ( $ elementName ) ; } $ regex [ $ elementName ] = '(' . $ parameters [ $ elementName ] -> getType ( ) . ')' ; $ this -> parameterCollection -> add ( $ parameters [ $ elementName ] ) ; } else { $ regex [ $ element ] = $ element ; } } } $ this -> pattern = '`^' . implode ( '' , $ regex ) . '$`i' ; }
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 ) ; foreach ( $ matches as $ position => $ value ) { $ this -> parameterCollection -> getByPosition ( $ position ) -> setValue ( $ value ) ; } return true ; } return false ; }
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 ) { $ object -> with ( $ value , ( is_numeric ( $ key ) ? null : $ key ) ) ; } $ object -> freeze ( ) ; return $ object ; } return $ this ; }
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 ( $ param -> getClass ( ) ) ) { $ paramsInfos [ 'class' ] = $ param -> getClass ( ) -> getName ( ) ; } elseif ( ! empty ( $ this -> propertyTypes [ $ param -> getName ( ) ] ) ) { $ paramsInfos [ 'class' ] = $ this -> propertyTypes [ $ param -> getName ( ) ] ; } $ this -> requiredParams [ $ i ++ ] = $ paramsInfos ; } } catch ( \ ReflectionException $ e ) { } }
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 -> getErrors ( ) ) ) ) ; }
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 ) ) { $ arguments [ $ k ] = $ this -> resolveArguments ( $ container , $ argument ) ; } elseif ( $ argument instanceof Definition ) { if ( $ argument instanceof DefinitionDecorator ) { $ arguments [ $ k ] = $ argument = $ this -> resolveDefinition ( $ container , $ argument ) ; if ( $ isRoot ) { $ container -> setDefinition ( $ k , $ argument ) ; } } $ argument -> setArguments ( $ this -> resolveArguments ( $ container , $ argument -> getArguments ( ) ) ) ; $ argument -> setMethodCalls ( $ this -> resolveArguments ( $ container , $ argument -> getMethodCalls ( ) ) ) ; $ argument -> setProperties ( $ this -> resolveArguments ( $ container , $ argument -> getProperties ( ) ) ) ; $ configurator = $ this -> resolveArguments ( $ container , array ( $ argument -> getConfigurator ( ) ) ) ; $ argument -> setConfigurator ( $ configurator [ 0 ] ) ; $ factory = $ this -> resolveArguments ( $ container , array ( $ argument -> getFactory ( ) ) ) ; $ argument -> setFactory ( $ factory [ 0 ] ) ; } } return $ arguments ; }
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_start ( ) ; include $ __prop -> path ; $ __view = ob_get_contents ( ) ; ob_end_clean ( ) ; if ( $ _sky_return ) { return $ __view ; } self :: $ temp .= $ __view ; }
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 ] ) ) $ data [ $ field ] = array ( ) ; $ attr [ 'validator' ] = $ validate ; unset ( $ attr [ 0 ] ) ; array_push ( $ data [ $ field ] , $ attr ) ; } } return $ data ; }
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_reflection -> hasMethod ( 'validate' ) && $ model_reflection -> getMethod ( 'validate' ) -> isPublic ( ) ) $ this -> model -> validate ( ) ; $ this -> record -> clear_model ( ) ; return $ this -> record ; }
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 -> addOnBlank ( $ options [ 0 ] , $ options [ 'message' ] ) ; } }
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 ) ; $ attribute = $ options [ 0 ] ; $ var = $ this -> model -> $ attribute ; if ( isset ( $ options [ 'in' ] ) ) $ enum = $ options [ 'in' ] ; elseif ( isset ( $ options [ 'within' ] ) ) $ enum = $ options [ 'within' ] ; if ( ! is_array ( $ enum ) ) array ( $ enum ) ; $ message = str_replace ( '%s' , $ var , $ options [ 'message' ] ) ; if ( $ this -> isNullWithOption ( $ var , $ options ) || $ this -> isBlankWithOption ( $ var , $ options ) ) continue ; if ( ( 'inclusion' == $ type && ! in_array ( $ var , $ enum ) ) || ( 'exclusion' == $ type && in_array ( $ var , $ enum ) ) ) $ this -> record -> add ( $ attribute , $ message ) ; } }
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 ) ; $ attribute = $ options [ 0 ] ; $ var = $ this -> model -> $ attribute ; if ( is_null ( $ options [ 'with' ] ) || ! is_string ( $ options [ 'with' ] ) || ! is_string ( $ options [ 'with' ] ) ) throw new ValidationsArgumentError ( 'A regular expression must be supplied as the [with] option of the configuration array.' ) ; else $ expression = $ options [ 'with' ] ; if ( $ this -> isNullWithOption ( $ var , $ options ) || $ this -> isBlankWithOption ( $ var , $ options ) ) continue ; if ( ! @ preg_match ( $ expression , $ var ) ) $ this -> record -> add ( $ attribute , $ options [ 'message' ] ) ; } }
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 ) { $ options = array_merge ( $ configuration , $ attr ) ; $ pk = $ this -> model -> get_primary_key ( ) ; $ pk_value = $ this -> model -> $ pk [ 0 ] ; if ( is_array ( $ options [ 0 ] ) ) { $ add_record = join ( "_and_" , $ options [ 0 ] ) ; $ fields = $ options [ 0 ] ; } else { $ add_record = $ options [ 0 ] ; $ fields = array ( $ options [ 0 ] ) ; } $ sql = "" ; $ conditions = array ( "" ) ; $ pk_quoted = $ connection -> quote_name ( $ pk [ 0 ] ) ; if ( $ pk_value === null ) $ sql = "{$pk_quoted} IS NOT NULL" ; else { $ sql = "{$pk_quoted} != ?" ; array_push ( $ conditions , $ pk_value ) ; } foreach ( $ fields as $ field ) { $ field = $ this -> model -> get_real_attribute_name ( $ field ) ; $ quoted_field = $ connection -> quote_name ( $ field ) ; $ sql .= " AND {$quoted_field}=?" ; array_push ( $ conditions , $ this -> model -> $ field ) ; } $ conditions [ 0 ] = $ sql ; if ( $ this -> model -> exists ( array ( 'conditions' => $ conditions ) ) ) $ this -> record -> add ( $ add_record , $ options [ 'message' ] ) ; } }
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 ) . ' ' . $ msg ) ; if ( $ closure ) $ closure ( $ attribute , $ message ) ; } } } return $ errors ; }
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 $ string ; }
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 ( ) , 'namespace' => $ this -> getNameSpace ( ) ] ) ) ; } return $ this -> controllerGenerator ; }
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 -> output -> writeln ( "<info>{$info}</info>" ) ; return $ class ; }
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 ] ) ; } $ this -> requestBody = $ this -> getRequestBody ( ) ; }
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 ( $ fetch = mysql_fetch_assoc ( $ res ) ) { $ countriesList [ ] = $ fetch [ 'nom' ] ; } return $ countriesList ; }
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 ( $ fetch = mysql_fetch_assoc ( $ res ) ) { $ citiesList [ ] = $ fetch [ 'nom' ] ; } return $ citiesList ; }
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 = $ this -> connexionBdd -> requete ( $ requete ) ; while ( $ fetch = mysql_fetch_assoc ( $ res ) ) { $ sneighborhood [ ] = $ fetch [ 'nom' ] ; } return $ sneighborhood ; }
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 = mysql_fetch_assoc ( $ res ) ) { $ street [ ] = $ fetch [ 'nom' ] ; } return $ street ; }
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 = $ this -> connexionBdd -> requete ( $ requete ) ; while ( $ fetch = mysql_fetch_assoc ( $ res ) ) { $ address [ ] = $ fetch [ 'nom' ] ; } return $ address ; }
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 ( $ requete ) ; while ( $ fetch = mysql_fetch_assoc ( $ res ) ) { $ person [ ] = $ fetch [ 'nom' ] . " " . $ fetch [ 'prenom' ] ; } return $ person ; }
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 JOIN quartier q on q.idVille = v.idVille LEFT JOIN sousQuartier sq on sq.idQuartier = q.idQuartier WHERE sq.idSousQuartier = $id " ; break ; case 'rue' : $ requete = " SELECT v.nom FROM ville v LEFT JOIN quartier q on q.idVille = v.idVille LEFT JOIN sousQuartier sq on sq.idQuartier = q.idQuartier LEFT JOIN rue r on r.idSousQuartier = sq.idSousQuartier WHERE r.idRue = $id " ; break ; default : return false ; } $ result = $ this -> connexionBdd -> requete ( $ requete ) ; $ row = mysql_fetch_assoc ( $ result ) ; return $ row [ 'nom' ] ; }
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 ) ; $ useMinMax = true ; } if ( isset ( $ dependencyId [ 'max' ] ) ) { $ this -> addUsingAlias ( SkillDependencyTableMap :: COL_DEPENDENCY_ID , $ dependencyId [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( SkillDependencyTableMap :: COL_DEPENDENCY_ID , $ dependencyId , $ comparison ) ; }
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 ( $ expectedArguments as $ k => $ expectedArgument ) { if ( $ expectedArgument instanceof \ Closure ) { if ( ! $ expectedArgument ( $ args [ $ k ] ) ) { return false ; } } elseif ( $ expectedArgument instanceof \ Mockery \ Matcher \ Any ) { continue ; } elseif ( is_numeric ( $ args [ $ k ] ) && is_numeric ( $ expectedArgument ) && ( ( ( double ) $ args [ $ k ] ) ) === ( ( double ) $ expectedArgument ) ) { continue ; } elseif ( $ args [ $ k ] !== $ expectedArgument ) { return false ; } } return true ; } ) ; $ this -> commentBuilder -> setArgs ( $ expectedArguments ) ; return $ this ; }
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 ( $ args ) ; } throw new UnexpectedCallException ( $ message ) ; } ) ; $ this -> expectation -> setPostPerformCallback ( function ( ) { } ) ; $ this -> commentBuilder -> setTimes ( 0 ) ; return $ this ; }
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 .