idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
17,200 | public function onPreDispatch ( ActionDispatchEvent $ event ) { $ message = sprintf ( 'Match callable "%s" for action "%s".' , Reflection :: getCalledMethod ( $ event -> getCallable ( ) -> getReflection ( ) ) , $ event -> getAction ( ) -> getName ( ) ) ; $ this -> logger -> debug ( $ message ) ; } | On pre dispatch event |
17,201 | public function onPostDispatch ( ActionDispatchEvent $ event ) { $ message = sprintf ( 'Complete handle API method "%s". Response object: %s' , $ event -> getAction ( ) -> getName ( ) , get_class ( $ event -> getResponse ( ) ) ) ; $ this -> logger -> debug ( $ message ) ; } | On post dispatch |
17,202 | public function onView ( ActionViewEvent $ event ) { $ message = sprintf ( 'The action "%s" return not ResponseInterface instance. Try create Response instance via result data...' , $ event -> getAction ( ) -> getName ( ) ) ; $ this -> logger -> debug ( $ message ) ; } | On view event |
17,203 | public static function autoLoadEntity ( $ sEntity , array $ aSql , $ sPrefix = '' , $ bAddOnStdClass = false , $ sEntityNamespace = null ) { if ( $ sEntity === '' ) { return ; } if ( $ sEntityNamespace !== null ) { self :: setEntityNamespace ( $ sEntityNamespace ) ; } $ sEntityName = self :: $ _sEntityNamespace . $ sEn... | auto load the domain by a sql return |
17,204 | public static function getAllEntity ( $ oEntityCall , $ bReturnNotNulOnly = false ) { if ( ! is_object ( $ oEntityCall ) ) { return array ( ) ; } $ oReflectionClass = new \ ReflectionClass ( get_class ( $ oEntityCall ) ) ; $ oReflectionMethod = $ oReflectionClass -> getMethods ( ) ; $ aFieldsToReturn = array ( ) ; fore... | get all field of entity in array |
17,205 | public function aroundProcessRelation ( \ Magento \ Quote \ Model \ Quote \ Relation $ subject , \ Closure $ proceed , \ Magento \ Framework \ Model \ AbstractModel $ object ) { $ proceed ( $ object ) ; assert ( $ object instanceof \ Magento \ Quote \ Model \ Quote ) ; $ quoteId = $ object -> getId ( ) ; $ addrShipping... | Process original relations then save partial payment totals . |
17,206 | public function getAPIKey ( ) { $ key = SiteConfig :: current_site_config ( ) -> GoogleAPIKey ; if ( ! $ key ) { $ key = self :: config ( ) -> api_key ; } return $ key ; } | Answers the API key from site or YAML configuration . |
17,207 | public function getAPILanguage ( ) { $ lang = SiteConfig :: current_site_config ( ) -> GoogleAPILanguage ; if ( ! $ lang ) { $ lang = self :: config ( ) -> api_language ; } return $ lang ; } | Answers the API language from site or YAML configuration . |
17,208 | public function getAnalyticsTrackingID ( ) { $ id = SiteConfig :: current_site_config ( ) -> GoogleAnalyticsTrackingID ; if ( ! $ id ) { $ id = self :: config ( ) -> analytics_tracking_id ; } return $ id ; } | Answers the analytics tracking ID from site or YAML configuration . |
17,209 | public function getVerificationCode ( ) { $ code = SiteConfig :: current_site_config ( ) -> GoogleVerificationCode ; if ( ! $ code ) { $ code = self :: config ( ) -> verification_code ; } return $ code ; } | Answers the site verification code from site or YAML configuration . |
17,210 | public function isAnalyticsEnabled ( ) { $ enabled = SiteConfig :: current_site_config ( ) -> GoogleAnalyticsEnabled ; if ( ! $ enabled ) { $ enabled = self :: config ( ) -> analytics_enabled ; } return ( boolean ) $ enabled ; } | Answers true if analytics is enabled for the site . |
17,211 | protected function loadUserRolesViaData ( $ userId ) { $ crudRoles = $ this -> userRoleIdentifier -> listEntries ( [ 'user' => $ userId ] , [ 'user' => '=' ] ) ; $ roles = [ 'ROLE_USER' ] ; if ( $ crudRoles !== null ) { foreach ( $ crudRoles as $ crudRole ) { $ role = $ crudRole -> get ( 'role' ) ; $ roles [ ] = $ role... | Loads the roles of an user via an AbstractData instance . |
17,212 | protected function loadUserRolesViaManyToMany ( $ user ) { $ roles = [ 'ROLE_USER' ] ; if ( is_string ( $ this -> userRoleIdentifier ) ) { foreach ( $ user -> get ( $ this -> userRoleIdentifier ) as $ role ) { $ roles [ ] = $ role [ 'name' ] ; } } return $ roles ; } | Loads the roles of an user via a many - to - many relationship |
17,213 | public function loadUserByUsername ( $ username ) { $ users = $ this -> userData -> listEntries ( [ $ this -> usernameField => $ username ] , [ $ this -> usernameField => '=' ] , 0 , 1 ) ; if ( count ( $ users ) === 0 ) { throw new UsernameNotFoundException ( ) ; } $ user = $ users [ 0 ] ; $ roles = is_string ( $ this ... | Loads and returns an user by username . Throws an UsernameNotFoundException on not existing username . |
17,214 | public static function add ( $ label , $ urlCode = null , $ addedArgs = array ( ) ) { self :: $ items [ ] = new BreadcrumbItem ( $ label , $ urlCode , $ addedArgs ) ; } | Add a new item to the breadcrumb |
17,215 | public function render ( ) { $ path = $ this -> resolvePathVariable ( ) ; $ content = "PATH=$path \n" . implode ( PHP_EOL , $ this -> getJobs ( ) ) ; return $ content ; } | Render the crontab and associated jobs |
17,216 | public function jobExists ( $ job = '' ) { $ process = new Process ( 'crontab -l' ) ; $ process -> run ( ) ; $ output = ( $ process -> getIncrementalOutput ( ) ) ; $ jobs = array_filter ( explode ( PHP_EOL , $ output ) , function ( $ line ) { return '' != trim ( $ line ) ; } ) ; return is_array ( $ jobs ) ? array_searc... | search job in jobs |
17,217 | private function parseHeader ( $ header ) { $ header = explode ( "\n" , $ header ) ; $ statusLine = explode ( ' ' , trim ( $ header [ 0 ] ) , 3 ) ; if ( ! isset ( $ statusLine [ 2 ] ) || substr ( $ statusLine [ 2 ] , 0 , 5 ) !== 'HTTP/' ) { throw new HttpException ( 'Request is not HTTP complaint.' , HttpCode :: BAD_RE... | Parses HTTP header & populates http headers |
17,218 | public function getHydratorClass ( $ class ) { $ inflector = $ this -> configuration -> getInflector ( ) ; $ realClass = $ inflector -> getUserClassName ( $ class ) ; $ hydratorClass = $ inflector -> getGeneratedClassName ( $ realClass , [ 'generator' => get_class ( $ this ) ] ) ; if ( ! class_exists ( $ hydratorClass ... | Returns a hydrator class for a class name |
17,219 | protected function generateAst ( $ realClass , $ hydratorClass ) { $ originalClass = new \ ReflectionClass ( $ realClass ) ; $ builder = new ClassBuilder ; $ traverser = new NodeTraverser ; $ ast = $ builder -> fromReflection ( $ originalClass ) ; $ traverser -> addVisitor ( new MethodDisablerVisitor ( function ( ) { r... | Generates an AST out of a given reflection class and a target hydrator name |
17,220 | protected function addMethodVisitors ( \ ReflectionClass $ originalClass , NodeTraverser $ traverser ) { $ accessibleProperties = $ this -> getProperties ( $ originalClass , \ ReflectionProperty :: IS_PUBLIC | \ ReflectionProperty :: IS_PROTECTED ) ; $ propertyWriters = $ this -> getPropertyWriters ( $ originalClass ) ... | Adds method visitors |
17,221 | protected function getPropertyWriters ( \ ReflectionClass $ originalClass ) { $ propertyWriters = $ this -> getProperties ( $ originalClass , \ ReflectionProperty :: IS_PRIVATE ) ; foreach ( $ propertyWriters as & $ property ) { $ property = new PropertyAccessor ( $ property , 'Writer' ) ; } return $ propertyWriters ; ... | Retrieves instance of private property writers |
17,222 | public function set ( $ name , $ value , $ ttl = 0 ) { $ name = trim ( $ name ) ; if ( $ name == '' ) { throw new CacheException ( 'Cache-entry name cannot be empty' ) ; } $ name = $ this -> _prependPrefix ( $ name ) ; if ( is_resource ( $ value ) ) { throw new CacheException ( 'Cannot cache values of type "resource"' ... | Add an entry to the MemcacheCache . |
17,223 | public function get ( $ name , & $ error = false ) { if ( ! $ this -> _enabled ) { return null ; } $ name = $ this -> _prependPrefix ( $ name ) ; error_clear_last ( ) ; $ value = @ $ this -> _Memcache -> get ( $ name ) ; $ last_error = error_get_last ( ) ; if ( $ value === false && $ last_error !== null && $ last_error... | Retrieve an entry from the MemcacheCache . |
17,224 | public function delete ( $ name ) { $ name = $ this -> _prependPrefix ( $ name ) ; $ result = @ $ this -> _Memcache -> delete ( $ name ) ; return $ result ; } | Delete an entry from the MemcacheCache . |
17,225 | public function Initialize ( ) { $ this -> Head = new HeadModule ( $ this ) ; $ this -> AddJsFile ( 'jquery.js' ) ; $ this -> AddJsFile ( 'jquery.livequery.js' ) ; $ this -> AddJsFile ( 'jquery.form.js' ) ; $ this -> AddJsFile ( 'jquery.popup.js' ) ; $ this -> AddJsFile ( 'jquery.gardenhandleajaxform.js' ) ; $ this -> ... | CSS JS and module includes . |
17,226 | public function Inform ( ) { $ this -> DeliveryType ( DELIVERY_TYPE_BOOL ) ; $ this -> DeliveryMethod ( DELIVERY_METHOD_JSON ) ; NotificationsController :: InformNotifications ( $ this ) ; $ this -> FireEvent ( 'BeforeInformNotifications' ) ; $ this -> Render ( ) ; } | Adds inform messages to response for inclusion in pages dynamically . |
17,227 | public static function InformNotifications ( $ Sender ) { $ Session = Gdn :: Session ( ) ; if ( ! $ Session -> IsValid ( ) ) return ; $ ActivityModel = new ActivityModel ( ) ; $ Where = array ( 'NotifyUserID' => Gdn :: Session ( ) -> UserID , 'Notified' => ActivityModel :: SENT_PENDING ) ; $ Where [ 'DateUpdated >' ] =... | Grabs all new notifications and adds them to the sender s inform queue . |
17,228 | protected function scopedInfo ( $ id ) { list ( $ rawId , $ scope ) = $ this -> splitId ( $ id ) ; if ( empty ( $ scope ) ) { $ scope = $ this -> default_scope ; $ def = $ this -> getResolver ( ) -> getService ( $ rawId ) ; if ( is_array ( $ def ) && isset ( $ def [ 'scope' ] ) ) { $ scope = $ def [ 'scope' ] ; } } ret... | Returns the raw id and the scope base on default or defined |
17,229 | protected function scopedData ( $ data , $ scope ) { if ( is_array ( $ data ) && isset ( $ data [ 'class' ] ) ) { $ data [ 'scope' ] = $ scope ; } else { $ data = [ 'class' => $ data , 'scope' => $ scope ] ; } return $ data ; } | Append scope to data |
17,230 | public function injectIntoMethod ( $ object , $ methodName = "injectDependencies" ) { $ ref = new \ ReflectionClass ( $ object ) ; try { $ refMethod = $ ref -> getMethod ( $ methodName ) ; } catch ( ReflectionException $ e ) { return null ; } $ toInject = [ ] ; foreach ( $ refMethod -> getParameters ( ) as $ p ) { $ cl... | Inject dependencies from or including the Pimple container into a given method on a given object |
17,231 | public function injectIntoConstructor ( $ classToBuildName , array $ toInject = [ ] ) { $ ref = new \ ReflectionClass ( $ classToBuildName ) ; try { $ constr = $ ref -> getConstructor ( ) ; } catch ( ReflectionException $ e ) { return null ; } $ numToSkip = count ( $ toInject ) ; foreach ( $ constr -> getParameters ( )... | Inject dependencies from or including the Pimple container into a a given class s constructor Optionally providing a number of arguments to the constructor to prepend . |
17,232 | public function fib ( $ n ) { if ( $ n < 3 ) return 1 ; $ k = $ n / 2 ; $ a = $ this -> fib ( $ k + 1 ) ; $ b = $ this -> fib ( $ k ) ; if ( $ n % 2 == 1 ) { return $ a * $ a + $ b * $ b ; } else { return $ b * ( 2 * $ a - $ b ) ; } } | Returns n th Fibonacci number |
17,233 | public function select ( \ FreeFW \ Core \ StorageModel & $ p_model , array $ p_conditions = [ ] ) { $ source = $ p_model :: getSource ( ) ; $ properties = $ p_model :: getProperties ( ) ; $ values = [ ] ; $ result = \ FreeFW \ DI \ DI :: get ( 'FreeFW::Model::ResultSet' ) ; $ where = '' ; foreach ( $ p_conditions as $... | Select the model |
17,234 | protected function renderConditionField ( \ FreeFW \ Interfaces \ ConditionInterface $ p_field ) { if ( $ p_field instanceof \ FreeFW \ Model \ ConditionMember ) { $ field = $ p_field -> getField ( ) ; return $ this -> renderModelField ( $ field ) ; } else { if ( $ p_field instanceof \ FreeFW \ Model \ ConditionValue )... | Render a condition |
17,235 | protected function renderCondition ( \ FreeFW \ Model \ Condition $ p_condition ) { $ result = [ ] ; $ left = $ p_condition -> getLeftMember ( ) ; $ right = $ p_condition -> getRightMember ( ) ; $ oper = $ p_condition -> getOperator ( ) ; switch ( $ oper ) { case \ FreeFW \ Storage \ Storage :: COND_LOWER : case \ Free... | Render a full condition |
17,236 | protected function renderModelField ( string $ p_field ) { $ parts = explode ( '.' , $ p_field ) ; $ class = $ parts [ 0 ] ; $ field = $ parts [ 1 ] ; if ( ! array_key_exists ( $ class , self :: $ models ) ) { self :: $ models [ $ class ] = \ FreeFW \ DI \ DI :: get ( $ class ) ; } $ model = self :: $ models [ $ class ... | Render a model field |
17,237 | protected function renderValueField ( $ p_value ) { self :: $ uniqid = self :: $ uniqid + 1 ; return [ 'id' => ':i' . rand ( 10 , 99 ) . '_' . self :: $ uniqid , 'value' => $ p_value , 'type' => false ] ; } | Render a value |
17,238 | public static function load ( $ instance_identifier ) { $ args = func_get_args ( ) ; $ instance_identifier = array_shift ( $ args ) ; $ factory_args = $ args ; $ instance_identifier = explode ( ':' , $ instance_identifier ) ; $ classname = $ instance_identifier [ 0 ] ; if ( $ classname { 0 } != '\\' ) { $ classname = '... | Initializes a class with optionally prepared constructor parameters and returns the instance . |
17,239 | public static function prepare ( $ instance_identifier , $ parameters = null ) { $ args = func_get_args ( ) ; $ params = explode ( ':' , $ instance_identifier ) ; $ classname = $ params [ 0 ] ; if ( $ classname { 0 } !== '\\' ) { $ classname = '\\Morrow\\' . $ classname ; } $ instancename = ( isset ( $ params [ 1 ] ) )... | Handles the preparation of class instantiation by deposit the constructor parameters . That allows the lazy loading functionality . |
17,240 | public static function onload ( $ instance_identifier , $ callback , $ ignore_instancename = false ) { $ args = func_get_args ( ) ; $ params = explode ( ':' , $ instance_identifier ) ; $ classname = $ params [ 0 ] ; if ( $ classname { 0 } !== '\\' ) { $ classname = '\\Morrow\\' . $ classname ; } $ instancename = ( isse... | Registers a callback that is executed when an instance is created . |
17,241 | public function open ( ) { if ( @ ! socket_connect ( $ this -> socket , $ this -> host , $ this -> port ) ) { Logger :: get ( ) -> error ( socket_strerror ( socket_last_error ( ) ) ) ; throw new Exception ( 'Socket connection error: ' . socket_strerror ( socket_last_error ( ) ) ) ; } } | Open the connection to the socket . |
17,242 | public function setStatusCode ( $ statusCode , $ message = null ) { $ this -> statusCode = ( int ) $ statusCode ; $ this -> addMeta ( [ 'status' => [ 'code' => ( int ) $ statusCode ] ] ) ; if ( ! empty ( $ message ) ) { $ this -> setStatusMessage ( $ message ) ; } return $ this ; } | Set status code . |
17,243 | public function setErrors ( MessageBag $ errors ) { $ this -> errors = $ errors ; if ( ! $ errors -> isEmpty ( ) ) { $ this -> addMeta ( [ 'errors' => $ errors -> all ( ) ] ) ; } return $ this ; } | Set a message bag of errors . |
17,244 | public function reload ( ) { if ( $ this -> root !== $ this ) { $ this -> root -> reload ( ) ; return ; } if ( ! isset ( $ this -> store ) ) { return ; } if ( ! $ this -> store -> touch ( ) ) { return ; } try { $ this -> store -> open ( false ) ; $ this -> data = $ this -> store -> read ( ) ; } catch ( AccessException ... | Reload configuration document from store . |
17,245 | public function save ( ) { if ( $ this -> root !== $ this ) { return $ this -> root -> save ( ) ; } if ( ! isset ( $ this -> store ) ) { return false ; } if ( ! $ this -> updated ) { return true ; } $ this -> store -> open ( true ) ; $ this -> store -> write ( $ this -> data ) ; $ this -> store -> close ( ) ; $ this ->... | Save configuration . If this is not the root configuration the root configuration will be saved instead . |
17,246 | public function build ( PackageWrapper $ package , $ isDev ) { $ this -> execute ( 'grunt' , [ ] , $ this -> io , $ package -> getPath ( ) ) ; } | Run this build tool for this package |
17,247 | public function setId ( string $ id ) : NodeInterface { $ this -> _id = $ id ; if ( $ this -> _name === null ) { $ this -> setName ( $ id ) ; } return $ this ; } | Sets the value of field id . |
17,248 | public function getMetadata ( ) : Data { if ( $ this -> _metadata === null ) { $ this -> _metadata = new Data ( ) ; $ this -> setMetadata ( [ ] ) ; } return $ this -> _metadata ; } | Returns the value of field _metadata . |
17,249 | public function setMetadata ( array $ metadata ) { $ this -> getMetadata ( ) -> setData ( array_replace_recursive ( $ this -> getDefaultMetadata ( ) , $ metadata ) ) ; return $ this ; } | Sets the value of field metadata . |
17,250 | public function setMetadataAttr ( string $ attr , $ value , array $ options = [ ] ) { $ this -> getMetadata ( ) -> set ( $ attr , $ value , $ options ) ; return $ this ; } | Sets a metadata attribute . |
17,251 | public function getMetadataAttr ( string $ attr , $ defaultValue = null , array $ options = [ ] ) { return $ this -> getMetadata ( ) -> get ( $ attr , $ defaultValue , $ options ) ; } | Returns a metadata attribute . |
17,252 | public function findParents ( array $ filters = [ ] , array $ options = [ ] ) { $ options = array_replace ( [ 'returnFirstResult' => false , 'indexById' => false ] , $ options ) ; $ parents = $ this -> getAllParents ( $ options ) ; if ( $ parents && $ filters ) { $ result = [ ] ; foreach ( $ parents as $ i => $ parent ... | Finds parent nodes all the way up until we reach the root node . |
17,253 | public function getAllParents ( array $ options = [ ] ) : array { $ options = array_replace ( [ 'indexById' => false , 'skipIds' => [ ] ] , $ options ) ; $ parents = [ ] ; $ ids = [ $ this -> getId ( ) ] ; foreach ( $ this -> getParents ( ) as $ id => $ parent ) { if ( in_array ( $ id , $ options [ 'skipIds' ] ) ) { co... | Returns all parents from this node . |
17,254 | public function getParent ( string $ id = null ) { if ( ! $ this -> _parents || ( $ id !== null && ! isset ( $ this -> _parents [ $ id ] ) ) ) { return null ; } return $ id !== null ? $ this -> _parents [ $ id ] : $ this -> _parents [ array_rand ( $ this -> _parents ) ] ; } | Returns the value of field _parent . |
17,255 | public function addParent ( NodeInterface $ parent , bool $ setParentsChild = true ) : NodeInterface { if ( ! $ this -> supportsParent ( $ parent ) ) { throw ParentTypeNotSupportedException :: create ( $ this , $ parent ) ; } $ this -> _parents [ $ parent -> getId ( ) ] = $ parent ; if ( $ setParentsChild ) { $ parent ... | Sets the value of field parent . |
17,256 | public function removeParent ( string $ parentId , bool $ setParentsChild = true ) : NodeInterface { if ( isset ( $ this -> _parents [ $ parentId ] ) ) { $ parent = $ this -> getParent ( $ parentId ) ; $ this -> notifySubscribers ( self :: EVENT_REMOVE_PARENT , [ 'oldParents' => $ this -> _parents , 'parentToRemove' =>... | Removes a parent from this node . |
17,257 | public function clearParents ( ) : NodeInterface { foreach ( $ this -> getParents ( ) as $ parent ) { $ this -> removeParent ( $ parent -> getId ( ) ) ; } return $ this ; } | Clears all parents of this node . |
17,258 | public function setChildren ( array $ children ) : NodeInterface { foreach ( $ this -> getChildren ( ) as $ node ) { $ this -> removeChild ( $ node -> getId ( ) ) ; } foreach ( $ children as $ child ) { $ this -> addChild ( $ child ) ; } return $ this ; } | Sets the value of field children . |
17,259 | public function addChild ( NodeInterface $ child , bool $ setParent = true ) : NodeInterface { if ( ! $ this -> supportsChild ( $ child ) ) { throw ChildTypeNotSupportedException :: create ( $ this , $ child ) ; } $ this -> _children [ $ child -> getId ( ) ] = $ child ; if ( $ setParent ) { $ child -> addParent ( $ thi... | Adds a child to this node . |
17,260 | public function removeChild ( string $ childId , bool $ setParent = true ) : NodeInterface { if ( $ this -> hasChild ( $ childId ) ) { $ child = $ this -> getChild ( $ childId ) ; if ( $ setParent ) { $ child -> removeParent ( $ this -> getId ( ) , false ) ; } unset ( $ this -> _children [ $ childId ] ) ; $ this -> not... | Removes a child . |
17,261 | public function getChild ( string $ id ) : NodeInterface { if ( ! $ this -> hasChild ( $ id ) ) { throw ChildDoesNotExistException :: create ( $ this -> getId ( ) , $ id ) ; } return $ this -> _children [ $ id ] ; } | Returns a child by ID . |
17,262 | public function findChildren ( array $ filters = [ ] , array $ options = [ ] ) { $ options = array_replace ( [ 'returnFirstResult' => false ] , $ options ) ; if ( empty ( $ filters ) ) { $ result = array_values ( $ this -> _nodes ) ; } else if ( count ( $ filters ) === 1 && isset ( $ filters [ 'id' ] ) ) { $ result = $... | Finds children . |
17,263 | public function addNode ( NodeInterface $ node ) : NodeInterface { $ this -> _nodes [ $ node -> getId ( ) ] = $ node ; if ( $ this -> getParent ( ) ) { $ this -> getParent ( ) -> addNode ( $ node ) ; } return $ this ; } | Adds a node to this graph . |
17,264 | public function removeNode ( NodeInterface $ node ) : NodeInterface { unset ( $ this -> _nodes [ $ node -> getId ( ) ] ) ; if ( $ this -> getParent ( ) ) { $ this -> getParent ( ) -> removeNode ( $ node ) ; } return $ this ; } | Removes a node . |
17,265 | public function validate ( array $ options = [ ] ) { $ options = array_replace ( [ 'validateMinChildren' => true , 'validateMaxChildren' => true , 'validateParentMandatory' => true , 'validateParentMustNotBeSet' => true ] , $ options ) ; $ countChildren = $ this -> countChildren ( ) ; if ( $ options [ 'validateMinChild... | This method is called after initializing the data . |
17,266 | public function setValidationConfig ( string $ name , $ value ) : NodeInterface { $ this -> setMetadataAttr ( 'validations.' . $ name , $ value ) ; return $ this ; } | Sets a validation config . |
17,267 | public function setSubscribers ( array $ subscribers ) : NodeInterface { $ this -> _subscribers = [ ] ; foreach ( $ subscribers as $ subscriber ) { $ this -> addSubscriber ( $ subscriber ) ; } return $ this ; } | Sets the value of field subscribers . |
17,268 | public function addSubscriber ( SubscriberInterface $ subscriber ) : NodeInterface { $ this -> _subscribers [ $ subscriber -> getId ( ) ] = $ subscriber ; return $ this ; } | Adds a subscriber . |
17,269 | public function removeSubscriber ( $ idOrSubscriber ) : NodeInterface { if ( ! is_string ( $ idOrSubscriber ) && ( ! is_object ( $ idOrSubscriber ) || ! ( $ idOrSubscriber instanceof SubscriberInterface ) ) ) { throw new \ InvalidArgumentException ( 'Argument "$idOrSubscriber" must be a string or an instance of ' . 'Ir... | Removes a subscriber . |
17,270 | public function handleEvent ( string $ eventId , array $ eventData ) { switch ( $ eventId ) { case self :: EVENT_ADD_CHILD : $ node = $ eventData [ 'child' ] ; $ this -> addNode ( $ node ) ; break ; case self :: EVENT_REMOVE_CHILD : $ node = $ eventData [ 'child' ] ; $ this -> removeNode ( $ node ) ; break ; case self ... | This method is called when an event is fired . |
17,271 | public function notifySubscribers ( string $ eventId , array $ eventData ) { foreach ( $ this -> getSubscribers ( ) as $ subscriber ) { $ subscriber -> handleEvent ( $ eventId , $ eventData ) ; } } | Fires an event . Subscribers gets notified about this event . |
17,272 | public function toArray ( array $ options = [ ] ) { $ childrenIds = [ ] ; foreach ( $ this -> getChildren ( ) as $ child ) { $ childrenIds [ ] = $ child -> getId ( ) ; } return [ 'id' => $ this -> getId ( ) , 'name' => $ this -> getName ( ) , 'type' => $ this -> getType ( ) , 'metadata' => $ this -> getMetadata ( ) -> ... | Returns an array representation of this node . |
17,273 | public function scan ( ) { $ paths = $ this -> getScanPaths ( ) ; $ components = [ ] ; foreach ( $ paths as $ key => $ path ) { $ manifests = $ this -> app [ 'files' ] -> glob ( "{$path}/component.json" ) ; is_array ( $ manifests ) || $ manifests = [ ] ; foreach ( $ manifests as $ manifest ) { $ name = Json :: make ( $... | Get & scan all components . |
17,274 | protected function formatCached ( $ cached ) { $ components = [ ] ; foreach ( $ cached as $ name => $ component ) { $ path = $ this -> config ( 'paths.components' ) . '/' . $ name ; $ components [ $ name ] = new Component ( $ this -> app , $ name , $ path ) ; } return $ components ; } | Format the cached data as array of components . |
17,275 | public function getByStatus ( $ status ) { $ components = [ ] ; foreach ( $ this -> all ( ) as $ name => $ component ) { if ( $ component -> isStatus ( $ status ) ) { $ components [ $ name ] = $ component ; } } return $ components ; } | Get components by status . |
17,276 | public function getOrdered ( $ direction = 'asc' ) { $ components = $ this -> enabled ( ) ; uasort ( $ components , function ( Component $ a , Component $ b ) use ( $ direction ) { if ( $ a -> order == $ b -> order ) { return 0 ; } if ( $ direction == 'desc' ) { return $ a -> order < $ b -> order ? 1 : - 1 ; } return $... | Get all ordered components . |
17,277 | public function find ( $ name ) { foreach ( $ this -> all ( ) as $ component ) { if ( $ component -> getLowerName ( ) === strtolower ( $ name ) ) { return $ component ; } } return ; } | Find a specific component . |
17,278 | public function findOrFail ( $ name ) { $ component = $ this -> find ( $ name ) ; if ( $ component !== null ) { return $ component ; } throw new ComponentNotFoundException ( "Component [{$name}] does not exist!" ) ; } | Find a specific component if there return that otherwise throw exception . |
17,279 | public function getComponentPath ( $ component ) { try { return $ this -> findOrFail ( $ component ) -> getPath ( ) . '/' ; } catch ( ComponentNotFoundException $ e ) { return $ this -> getPath ( ) . '/' . Str :: studly ( $ component ) . '/' ; } } | Get component path for a specific component . |
17,280 | public function setUsed ( $ name ) { $ component = $ this -> findOrFail ( $ name ) ; $ this -> app [ 'files' ] -> put ( $ this -> getUsedStoragePath ( ) , $ component ) ; } | Set component used for cli session . |
17,281 | public function states ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> subOidWalk ( self :: OID_STATUS , 12 ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ STATES ) ; } | Get an array of device interface states |
17,282 | public function jabberStates ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> subOidWalk ( self :: OID_JABBER_STATE , 12 ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ JABBER_STATES ) ; } | Get an array of device interface jabber states |
17,283 | public function jackTypes ( $ translate = false ) { $ types = $ this -> getSNMP ( ) -> subOidWalk ( self :: OID_JACK_TYPE , 12 ) ; if ( ! $ translate ) return $ types ; return $ this -> getSNMP ( ) -> translate ( $ types , self :: $ JACK_TYPES ) ; } | Get an array of device jack types |
17,284 | protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> input = $ input ; $ this -> output = $ output ; $ repository = $ this -> getContainer ( ) -> get ( 'ezpublish.api.repository' ) ; $ contentService = $ repository -> getContentService ( ) ; $ contentTypeService = $ repository ->... | Execute Content generate command |
17,285 | public function createSessionContainer ( ) { if ( ! isset ( $ this -> config [ 'container' ] ) ) { session_start ( ) ; return ; } $ sessionContainerType = $ this -> config [ 'container' ] ; $ className = '\ntentan\sessions\containers\\' . Text :: ucamelize ( $ sessionContainerType ) . 'SessionContainer' ; $ sessionCont... | Create and return an instance of the custom session container if required . |
17,286 | public function handle ( Entity $ entity ) { if ( in_array ( SoftDeletes :: class , class_uses_recursive ( get_class ( $ entity ) ) ) && ! $ entity -> isForceDeleting ( ) ) { return ; } foreach ( $ entity -> getEntityAttributes ( ) as $ attribute ) { if ( $ entity -> relationLoaded ( $ relation = $ attribute -> getAttr... | Handle the entity deletion . |
17,287 | final protected static function replaceKey ( $ data , $ search , $ replace ) { foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ data [ $ key ] = $ value = self :: replaceKey ( $ data [ $ key ] , $ search , $ replace ) ; } if ( $ key == $ search ) { $ data [ $ replace ] = $ value ; unset ( $ data... | Recursively replace keys of associative arrays |
17,288 | public static function getRegisteredWrappers ( ) { if ( static :: $ wrapperRegistry === null ) { static :: $ wrapperRegistry = [ ] ; if ( extension_loaded ( 'intl' ) ) { static :: $ wrapperRegistry [ ] = 'Zend\Stdlib\StringWrapper\Intl' ; } if ( extension_loaded ( 'mbstring' ) ) { static :: $ wrapperRegistry [ ] = 'Zen... | Get registered wrapper classes |
17,289 | public static function registerWrapper ( $ wrapper ) { $ wrapper = ( string ) $ wrapper ; if ( ! in_array ( $ wrapper , static :: $ wrapperRegistry , true ) ) { static :: $ wrapperRegistry [ ] = $ wrapper ; } } | Register a string wrapper class |
17,290 | public static function unregisterWrapper ( $ wrapper ) { $ index = array_search ( ( string ) $ wrapper , static :: $ wrapperRegistry , true ) ; if ( $ index !== false ) { unset ( static :: $ wrapperRegistry [ $ index ] ) ; } } | Unregister a string wrapper class |
17,291 | public static function getWrapper ( $ encoding = 'UTF-8' , $ convertEncoding = null ) { foreach ( static :: getRegisteredWrappers ( ) as $ wrapperClass ) { if ( $ wrapperClass :: isSupported ( $ encoding , $ convertEncoding ) ) { $ wrapper = new $ wrapperClass ( $ encoding , $ convertEncoding ) ; $ wrapper -> setEncodi... | Get the first string wrapper supporting the given character encoding and supports to convert into the given convert encoding . |
17,292 | public function format ( ) { if ( strlen ( $ this -> phoneNumber ) >= 7 ) { return sprintf ( $ this -> format , $ this -> getCountryCode ( ) , $ this -> getAreaCode ( ) , $ this -> getPrefix ( ) , $ this -> getLineNumber ( ) ) ; } return null ; } | Get formatted phone number for display This assumes a flattened format like 11235551234 |
17,293 | public function getComponent ( $ component = null ) { if ( null === $ this -> components ) { $ pattern = '/ (?<countryCode>(\+?\d{1,2})?\D*) # optional country code (?<areaCode>(\d{3})?\D*) # optional area code (?<prefix>(\d{3})\D*) ... | Get phone number component |
17,294 | public function setDisplayFormat ( $ displayFormat = self :: FORMAT_NA ) { if ( substr_count ( $ displayFormat , '%d' ) !== 4 ) { throw new \ BadFunctionCallException ( 'The format passed must be passed in the sprintf() format, and have exactly 4 digit components' ) ; } $ this -> displayFormat = $ displayFormat ; } | Sets the display format |
17,295 | public function labels ( $ labels = null ) { if ( $ labels === null ) { return $ this -> _labels ; } $ this -> _labels = $ labels ; return $ this ; } | Label definitions for validation |
17,296 | public function param ( $ param , $ value , $ type = null ) { return $ this -> setParameter ( $ param , $ value , $ type ) ; } | Set the value of a parameter in the query . |
17,297 | public function transmute ( InputDescriptor $ input , $ targetFormat ) { if ( ! in_array ( $ targetFormat , array ( 'image' , 'audio' , 'video' , 'flash' , 'text' ) ) ) { return null ; } $ mediaType = $ this -> mediaTypeManager -> find ( $ input -> getMediaType ( ) ) ; return $ this -> extractor -> extract ( $ input , ... | Transmute file to target format . |
17,298 | protected function startBindingsPlugin ( $ app ) { $ this -> requiresPlugins ( Commands :: class , Events :: class ) ; $ this -> onRegister ( 'bindings' , function ( Application $ app ) { $ legacy = ! class_exists ( 'Illuminate\Foundation\Application' ) || version_compare ( \ Illuminate \ Foundation \ Application :: VE... | startBindingsPlugin method . |
17,299 | protected function bindIf ( $ abstract , $ concrete = null , $ shared = true , $ alias = null ) { if ( ! $ this -> app -> bound ( $ abstract ) ) { $ concrete = $ concrete ? : $ abstract ; $ this -> app -> bind ( $ abstract , $ concrete , $ shared ) ; } } | Registers a binding if it hasn t already been registered . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.