idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
51,100 | protected function configureOptions ( array $ optionsArray ) : OptionCollection { $ options = new OptionCollection \ ArrayOptionCollection ( ) ; foreach ( $ optionsArray as $ key => $ option ) { if ( $ key === OptionRepository :: PREFIX ) { continue ; } if ( $ option instanceof Option ) { $ options -> add ( $ option ) ... | Build a collection of options from an array of Config values . |
51,101 | protected function isPrefixable ( $ objectOrClassName ) : bool { if ( is_string ( $ objectOrClassName ) ) { return in_array ( Prefixable :: class , class_implements ( $ objectOrClassName ) , true ) ; } if ( is_object ( $ objectOrClassName ) ) { return $ objectOrClassName instanceof Prefixable ; } return false ; } | Check whether a FQCN or an object implements the Prefixable interface . |
51,102 | public static function get ( $ key ) { $ config = json_decode ( file_get_contents ( PATH . '/app/config.json' ) , true ) ; if ( ! array_key_exists ( $ key , $ config ) ) { throw new ConfigItemNotSetException ( $ key ) ; } return $ config [ $ key ] ; } | Get Config item by key . |
51,103 | public function setSources ( array $ sources ) { $ parameters = $ this -> configuration -> getParameters ( ) ; $ parameters [ 'sources' ] = $ sources ; $ this -> configuration -> setParameters ( $ parameters ) ; } | Define the task new sources . |
51,104 | static private function getDriver ( ) { if ( self :: $ _driver != null ) return self :: $ _driver ; $ driver = Utils :: spare ( Config :: get ( 'session.driver' ) , 'default' ) ; switch ( strtolower ( $ driver ) ) { case 'cookie' : self :: $ _driver = new \ Lollipop \ Session \ Cookie ( ) ; break ; case 'default' : def... | Get session driver |
51,105 | public function addGroup ( $ group ) { if ( $ this -> groups === null ) { $ this -> setGroups ( $ this -> groupRepository -> getAllByRevision ( $ this ) ) ; } $ this -> groups [ ] = $ group ; return $ this ; } | Add a group . |
51,106 | public function getGroups ( ) { if ( $ this -> groups === null ) { $ this -> setGroups ( $ this -> groupRepository -> getAllByRevision ( $ this ) ) ; } return $ this -> groups ; } | Get Groups . |
51,107 | public function setQueueItemData ( array $ data ) { if ( isset ( $ data [ 'queue_id' ] ) ) { $ this -> setQueueId ( $ data [ 'queue_id' ] ) ; } if ( isset ( $ data [ 'processed' ] ) ) { $ this -> setProcessed ( $ data [ 'processed' ] ) ; } if ( isset ( $ data [ 'queued_date' ] ) ) { $ this -> setQueuedDate ( $ data [ '... | Set the queue item s data . |
51,108 | public static function create ( $ value , $ units ) { list ( $ distUnit , $ timeUnit ) = static :: explUnits ( $ units ) ; $ dist = Distance :: m ( 0 ) ; $ time = Time :: sec ( 0 ) ; $ dist -> { $ distUnit } = $ value ; $ time -> { $ timeUnit } = 1 ; $ velocity = new Velocity ( $ dist , $ time ) ; $ velocity -> format ... | Creates a new velocity from a value and velocity unit . |
51,109 | public function units ( $ units , $ string = false ) { list ( $ distUnit , $ timeUnit ) = static :: explUnits ( $ units ) ; $ distVal = $ this -> dist -> unit ( $ distUnit ) ; $ timeVal = $ this -> time -> { $ timeUnit } ; $ distVal = number_format ( $ distVal , 99 , '.' , '' ) ; $ timeVal = number_format ( $ timeVal ,... | Gets the value of this instance at the specified units . |
51,110 | public function format ( $ format ) { $ pattern = '/(%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])([ ]*)(.*)/' ; if ( preg_match_all ( $ pattern , $ format , $ m ) ) { $ sprintf = $ m [ 1 ] [ 0 ] ; $ space = $ m [ 2 ] [ 0 ] ; $ units = $ m [ 3 ] [ 0 ] ; $ velocity = $ this -> units ( $ units ) ; if (... | Formats this instance as a string with the provided format . |
51,111 | public function add ( Velocity $ b ) { $ dist = $ this -> dist -> add ( $ b -> dist ) ; $ velocity = new Velocity ( $ dist , $ this -> time ) ; $ velocity -> format = $ this -> format ; return $ velocity ; } | Adds another velocity to this instance and returns a new instance with the sum . |
51,112 | public function sub ( Velocity $ b ) { $ dist = $ this -> dist -> sub ( $ b -> dist ) ; $ velocity = new Velocity ( $ dist , $ this -> time ) ; $ velocity -> format = $ this -> format ; return $ velocity ; } | Subtracts another velocity from this instance and returns a new instance with the difference . |
51,113 | public function time ( Distance $ dist ) { return Time :: sec ( ( $ dist -> m / $ this -> dist -> m ) * $ this -> time -> sec ) ; } | Calculates the time required to travel the provided distance at the velocity of this instance . |
51,114 | private static function removeTrailingZeros ( $ num ) { if ( strstr ( $ num , '.' ) ) { $ num = rtrim ( $ num , '0' ) ; $ last = substr ( $ num , strlen ( $ num ) - 1 , 1 ) == '.' ; $ num = $ last ? substr ( $ num , 0 , strlen ( $ num ) - 1 ) : $ num ; return $ num ; } else { return $ num ; } } | Removes trailing zeros for a numeric value expressed as a string . |
51,115 | public function set ( string $ key , string $ value ) : ConfigInterface { $ this -> settings [ $ key ] = $ value ; return $ this ; } | Set an ini directive to be used when calling . |
51,116 | public function call ( callable $ callable , ... $ params ) { foreach ( $ this -> settings as $ key => $ value ) { $ this -> ini -> set ( $ key , $ value ) ; } $ result = null ; $ exception = null ; try { $ result = $ callable ( ... $ params ) ; } catch ( \ Throwable $ e ) { $ exception = $ e ; } $ this -> ini -> clean... | Run some code using the previous provided ini settings . |
51,117 | public function withPath ( $ path = __DIR__ ) { $ before = get_declared_classes ( ) ; $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ path ) ) ; foreach ( $ iterator as $ item ) { if ( ! $ item -> isDir ( ) && substr ( $ item -> getPathname ( ) , - 4 ) == '.php' ) { require_once $ it... | Add commands from path recursively |
51,118 | public function withStyles ( array $ styles ) { foreach ( $ styles as $ name => $ args ) { $ this -> formatter ( ) -> setStyle ( $ name , new OutputFormatterStyle ( ... $ args ) ) ; } return $ this ; } | Change output formatting styles |
51,119 | public function indexAction ( ) { $ instance = $ this -> getCurrentInstance ( ) ; if ( $ instance ) { $ worker = $ this -> getWorker ( ) ; if ( $ worker ) { return $ this -> render ( $ this -> getTemplatePath ( ) . 'index.html.twig' , array ( 'instance' => $ worker -> getInstance ( ) , 'infos' => $ worker -> getInfos (... | Render choose action or dashboard action |
51,120 | public function clientAction ( ) { $ worker = $ this -> getWorker ( ) ; if ( ! $ worker ) { return new RedirectResponse ( $ this -> generateUrl ( 'ringo_php_redmon' ) ) ; } return $ this -> render ( $ this -> getTemplatePath ( ) . 'client.html.twig' , array ( 'instance' => $ worker -> getInstance ( ) , 'clients' => $ w... | Render client list for the current instance |
51,121 | public function configurationAction ( ) { $ worker = $ this -> getWorker ( ) ; if ( ! $ worker ) { return new RedirectResponse ( $ this -> generateUrl ( 'ringo_php_redmon' ) ) ; } return $ this -> render ( $ this -> getTemplatePath ( ) . 'configuration.html.twig' , array ( 'instance' => $ worker -> getInstance ( ) , 'c... | Render configuration list for the current instance |
51,122 | public function selectAction ( $ id ) { $ instance = $ this -> getManager ( ) -> find ( $ id ) ; if ( $ instance ) { $ this -> getRequest ( ) -> getSession ( ) -> set ( 'instance' , $ instance ) ; if ( $ this -> getWorker ( ) ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Instance ' . $ instan... | Select action Change the current instance |
51,123 | public static function dir ( ) { $ JSTORE_DIR = str_replace ( DIRECTORY_SEPARATOR , '/' , __DIR__ ) ; $ JSTORE_DOCS_ROOT = str_replace ( DIRECTORY_SEPARATOR , '/' , isset ( $ _SERVER [ 'DOCUMENT_ROOT' ] ) ? realpath ( $ _SERVER [ 'DOCUMENT_ROOT' ] ) : dirname ( __DIR__ ) ) ; return trim ( str_replace ( $ JSTORE_DOCS_RO... | Used to get the directory where this class file is located |
51,124 | public function ArrayToObj ( $ array , $ root = False ) { $ obj = ! $ root ? new jstoreRootObject ( $ this ) : new jstoreObject ( $ this ) ; foreach ( $ array as $ arraykey => $ arrayval ) { if ( is_array ( $ arrayval ) ) { $ obj -> $ arraykey = $ this -> ArrayToObj ( $ arrayval ) ; } else { $ obj -> $ arraykey = $ arr... | Same as JsonToObj except it takes in an array rather than a JSON For both methods this is where the work actually happens |
51,125 | public function getHeadSHA1 ( ) { $ headFile = "{$this->dir}/HEAD" ; if ( ! is_readable ( $ headFile ) ) { return false ; } $ head = file_get_contents ( $ headFile ) ; if ( preg_match ( "/ref: (.*)/" , $ head , $ m ) ) { $ head = rtrim ( $ m [ 1 ] ) ; } else { $ head = rtrim ( $ head ) ; } if ( self :: isSHA1 ( $ head ... | Return the SHA1 for the current HEAD of the Git repository . |
51,126 | public function getList ( ) { $ data = [ ] ; foreach ( $ this -> providers as $ provider ) { $ data = array_merge_recursive ( $ data , $ provider -> getImages ( ) ) ; } return $ data ; } | Returns list of images to merge |
51,127 | public function compile ( ) { $ prefix = $ this -> getNewPrefix ( ) ; $ data = $ this -> getList ( ) ; $ sizes = [ ] ; foreach ( $ this -> providers as $ provider ) { if ( $ provider instanceof SizeProviderInterface ) { $ sizes = array_merge ( $ sizes , $ provider -> getSizes ( ) ) ; } } $ num = 0 ; $ scss = [ ] ; fore... | Compiles all sprites |
51,128 | protected function getNewPrefix ( ) { $ find = new Finder ( ) ; $ fs = new Filesystem ( ) ; $ fs -> remove ( $ find -> in ( $ this -> imgDir ) -> directories ( ) , $ this -> stylePath ) ; $ prefix = substr ( sha1 ( microtime ( true ) . 'sprites' ) , 1 , 10 ) ; $ fs -> mkdir ( $ this -> imgDir . '/' . $ prefix ) ; retur... | Creates new prefix for sprites |
51,129 | protected function insertIntoTree ( & $ node , $ existingNode = null ) { $ treeOriginTagDef = $ node -> getNodeRef ( ) -> getElement ( ) -> getSchema ( ) -> getTreeOriginTagDef ( ) ; if ( empty ( $ treeOriginTagDef ) ) throw new NodeException ( 'Cannot insert a node in tree order mode without a tree origin tag definiti... | This only supports inserting nodes at the end of the tree or at the end of a list of children to a parent which inherently means the 2nd criteria to the tree beyond parent is creation date |
51,130 | public function buildCache ( ) { if ( ! empty ( $ this -> viewDirectories ) || ! empty ( $ this -> configDirectories ) || ! empty ( $ this -> resourceDirectories ) ) { return ; } foreach ( $ this -> orderReference as $ namespace ) { $ bundle = & $ this -> bundleReference [ $ namespace ] ; $ this -> viewDirectories [ ] ... | Build directory cache so we only do it once |
51,131 | protected function sprintf ( string $ format , ... $ args ) { return $ this -> output -> write ( sprintf ( $ format , ... $ args ) , false ) ; } | Identical to write function but provides ability to format message . Does not add new line . |
51,132 | function Save ( ) { $ this -> contentRights -> Save ( ) ; if ( ! $ this -> rights ) { $ this -> rights = new BackendContainerRights ( ) ; } $ this -> rights -> SetEdit ( $ this -> Value ( 'Edit' ) ) ; $ this -> rights -> SetRemove ( $ this -> Value ( 'Remove' ) ) ; $ this -> rights -> SetContentRights ( $ this -> conte... | Saves the container rights |
51,133 | public function unregister ( $ k ) { if ( array_key_exists ( $ k , $ this -> _items ) ) { $ item = $ this -> _items [ $ k ] ; unset ( $ this -> _items [ $ k ] ) ; return $ item ; } else return FALSE ; } | Delete an item from cache |
51,134 | public function get ( $ k ) { if ( array_key_exists ( $ k , $ this -> _items ) ) return $ this -> _items [ $ k ] ; else return FALSE ; } | Fetch an item from cache |
51,135 | protected function counter2 ( ) { if ( $ this -> nodb ) { return ; } $ this -> query ( "select count(*) from information_schema.tables " . "where (table_schema = '$this->masterdb') " . "and (table_name = 'counter2')" ) ; list ( $ ok ) = $ this -> fetchrow ( 'num' ) ; if ( $ ok ) { if ( $ this -> isBot ) { $ sql = "inse... | counter2 count files accessed per day WARNING this may be overriden is a child class |
51,136 | public function makeUp ( $ file ) { if ( Any :: isArray ( $ file ) ) { $ success = true ; foreach ( $ file as $ single ) { $ exec = $ this -> makeUp ( $ single ) ; if ( ! $ exec ) { $ success = false ; } } return $ success ; } if ( ! File :: exist ( $ this -> dir . '/' . $ file ) ) { return false ; } if ( Normalize :: ... | Run migration up |
51,137 | public function makeDown ( $ file ) { if ( Any :: isArray ( $ file ) ) { $ success = true ; foreach ( $ file as $ item ) { $ exec = $ this -> makeDown ( $ file ) ; if ( ! $ exec ) { $ success = false ; } return $ success ; } } if ( ! File :: exist ( $ this -> dir . '/' . $ file ) ) { return false ; } File :: inc ( $ th... | Make migration down |
51,138 | public function onKernelRequest ( GetResponseEvent $ event ) { $ headers = $ event -> getRequest ( ) -> headers ; if ( ! $ headers -> has ( self :: HEADER_NAME ) ) { return ; } $ this -> requestId -> set ( $ headers -> get ( self :: HEADER_NAME , null , true ) , true ) ; } | If present reads the request ID from the appropriate header and sets it on a RequestId instance . |
51,139 | public function onKernelResponse ( FilterResponseEvent $ event ) { $ event -> getResponse ( ) -> headers -> set ( self :: HEADER_NAME , $ this -> requestId -> get ( ) ) ; } | If enabled sets the request ID on the appropriate response header . |
51,140 | public function current ( ) { $ sKey = key ( $ this -> values ) ; return ( true === isset ( $ this -> values [ $ sKey ] ) ) ? $ this -> values [ $ sKey ] : null ; } | returns current value |
51,141 | public function scNext ( ) { $ mValue = $ this -> next ( ) ; return ( false === $ mValue and false === $ this -> valid ( ) ) ? self :: NOT_SET_FLAG : $ mValue ; } | Like next but return Not_Set_Flag if there are no next value instead of false |
51,142 | public function scPrev ( ) { $ mValue = $ this -> prev ( ) ; return ( false === $ mValue and false === $ this -> valid ( ) ) ? self :: NOT_SET_FLAG : $ mValue ; } | rewind the pointer for one position |
51,143 | public function valid ( ) { $ bIsValid = false ; if ( null !== $ this -> values ) { $ sKey = $ this -> key ( ) ; $ bIsValid = isset ( $ sKey ) ; } return $ bIsValid ; } | check if the the current value is set |
51,144 | public function get ( $ mOffset , $ mDefault = null ) { return ( true === isset ( $ this -> values [ $ mOffset ] ) ) ? $ this -> values [ $ mOffset ] : $ mDefault ; } | Return the value with the given offset if is not set return the default |
51,145 | public function offsetSet ( $ mOffset , $ mValue ) { if ( false === is_string ( $ mOffset ) and false === is_integer ( $ mOffset ) ) { throw new \ InvalidArgumentException ( 'Invalid offset given: ' . gettype ( $ mOffset ) ) ; } $ this -> values [ $ mOffset ] = $ mValue ; return $ this ; } | set the value by the given offset |
51,146 | public function seek ( $ iOffset ) { $ this -> rewind ( ) ; $ iPosition = 0 ; while ( $ iPosition < $ iOffset and true === $ this -> valid ( ) ) { $ this -> next ( ) ; $ iPosition ++ ; } if ( false === $ this -> valid ( ) ) { throw new \ OutOfBoundsException ( 'Invalid seek position: ' . $ iOffset ) ; } return $ this -... | seek the pointer to the offset position |
51,147 | public function seekToKey ( $ mKey , $ bStrictMode = true ) { $ this -> rewind ( ) ; if ( $ bStrictMode === true ) { while ( true === $ this -> valid ( ) and $ mKey !== $ this -> key ( ) ) { $ this -> next ( ) ; } } else { while ( true === $ this -> valid ( ) and $ mKey != $ this -> key ( ) ) { $ this -> next ( ) ; } }... | Try to seek to given offset |
51,148 | public function filter ( \ Closure $ cClosure ) { $ sClassName = get_class ( $ this ) ; $ aFilteredValues = array ( ) ; foreach ( $ this -> values as $ sKey => $ mValue ) { if ( true === $ cClosure ( $ mValue , $ sKey ) ) { $ aFilteredValues [ $ sKey ] = $ mValue ; } } return new $ sClassName ( $ aFilteredValues ) ; } | Filters the current values and return a new collection |
51,149 | public function forAll ( \ Closure $ cClosure ) { foreach ( $ this -> values as $ mKey => $ mValue ) { $ this -> offsetSet ( $ mKey , $ cClosure ( $ mValue , $ mKey ) ) ; } return $ this ; } | Use a function on all values of the collection and set the result as new values for the key |
51,150 | public function sliceByKey ( $ mStartKey , $ bStrict = true , $ iLength = PHP_INT_MAX ) { $ aSlice = array ( ) ; try { $ this -> seekToKey ( $ mStartKey , $ bStrict ) ; if ( $ iLength > 0 ) { $ aSlice [ $ this -> key ( ) ] = $ this -> current ( ) ; $ iLength -- ; $ this -> next ( ) ; } while ( $ iLength > 0 and true ==... | Slice elements and create a new instance |
51,151 | public static function XmlToType ( \ SimpleXMLElement $ xmlElement ) { $ type = null ; $ value = null ; if ( false !== ( $ type = XmlAttributeHelper :: GetAttributeValue ( $ xmlElement , 'type' ) ) ) { $ type = ( string ) $ type ; } else if ( isset ( $ xmlElement -> type ) ) { $ type = ( string ) $ xmlElement -> type ;... | Extracts typed data from defined XML element . |
51,152 | public static function WriteTypedXmlValue ( \ XMLWriter $ w , $ value , string $ name , bool $ short = true , bool $ separateElements = false ) { if ( ! ( $ value instanceof Type ) ) { $ value = new Type ( $ value ) ; } $ v = null ; $ t = null ; switch ( $ value -> getType ( ) ) { case Type :: PHP_ARRAY : $ v = \ seria... | Writes all data of the defined Value to the XmlWriter . |
51,153 | public static function IsNativeType ( $ value ) : bool { return ( \ is_bool ( $ value ) || \ is_int ( $ value ) || \ is_string ( $ value ) || \ is_double ( $ value ) || \ is_float ( $ value ) || \ is_array ( $ value ) ) ; } | Returns if the type of defined value is a native PHP type . |
51,154 | public static function GetTypeName ( $ value ) : string { if ( \ is_null ( $ value ) ) { return Type :: PHP_NULL ; } if ( \ is_object ( $ value ) ) { return \ get_class ( $ value ) ; } if ( \ is_string ( $ value ) ) { return Type :: PHP_STRING ; } if ( \ is_int ( $ value ) ) { return Type :: PHP_INTEGER ; } if ( \ is_b... | Returns the type name of the defined value . |
51,155 | protected function clearCachedAccessToken ( ) { $ storage = $ this -> service -> getStorage ( ) ; $ storage -> clearToken ( $ this -> getServiceName ( ) ) ; return $ this ; } | clear Cached Access token |
51,156 | public function getMetadataByResourceName ( $ resourceName ) { $ this -> getAllMetadata ( ) ; if ( ! isset ( $ this -> resourceClassMap [ $ resourceName ] ) ) { throw Exception :: resourceNotFound ( $ resourceName ) ; } return $ this -> loadedMetadata [ $ this -> resourceClassMap [ $ resourceName ] ] ; } | Returns ResourceMetadata for the specified resource . |
51,157 | public function getAllMetadata ( ) { $ resourceClasses = $ this -> driver -> getAllClassNames ( ) ; foreach ( $ resourceClasses as $ class ) { $ this -> getMetadataFor ( $ class ) ; } return $ this -> loadedMetadata ; } | Returns the entire collection of ResourceMetadata objects for all mapped resources . Entities not marked as resources are not included . |
51,158 | protected function loadMetadata ( $ className ) { $ resource = new ResourceMetadata ( $ className ) ; $ this -> driver -> loadMetadataForClass ( $ className , $ resource ) ; $ this -> loadedMetadata [ $ className ] = $ resource ; $ this -> resourceClassMap [ $ resource -> getName ( ) ] = $ className ; } | Loads the ResourceMetadata for the specified class . |
51,159 | public function getMalusToFightNumber ( Tables $ tables , $ shieldRestriction ) : int { return $ this -> getRestrictionWithShield ( $ tables , $ shieldRestriction ) + $ tables -> getMissingWeaponSkillTable ( ) -> getFightNumberMalusForSkillRank ( 0 ) ; } | Only for using shield as a weapon! |
51,160 | public function pluck ( $ key , $ unique = false ) { $ results = [ ] ; foreach ( $ this as $ item ) { $ value = is_object ( $ item ) ? $ item -> $ key : $ item [ $ key ] ; if ( $ unique ) { $ results [ $ value ] = $ value ; } else { $ results [ ] = $ value ; } } $ collection = new static ( $ results ) ; return $ collec... | get a collection of values from property |
51,161 | public function getByPropertyValues ( $ property , $ values , $ strict = false ) { $ results = [ ] ; foreach ( $ this as $ item ) { foreach ( $ values as $ value ) { if ( $ strict ) { if ( $ item -> $ property === $ value ) { $ results [ ] = $ item ; } } else { if ( $ item -> $ property == $ value ) { $ results [ ] = $... | get the models which match the property values loose matching not strict |
51,162 | public function getKeyedByProperty ( $ property ) { $ results = [ ] ; foreach ( $ this as $ item ) { $ results [ $ item -> $ property ] = $ item ; } return new static ( $ results ) ; } | key the iterator by the specified property |
51,163 | public function sort ( callable $ callback = null ) { $ items = $ this -> getArrayCopy ( ) ; $ callback ? uasort ( $ items , $ callback ) : asort ( $ items ) ; return new static ( $ items ) ; } | how to reset array keys here? as when jsonencoded the keys must be reset not sure you would always want to reset as may need to maintain sometimes? |
51,164 | public function offsetAppend ( $ index , $ value ) { $ items = [ ] ; if ( $ this -> offsetExists ( $ index ) ) { $ items = $ this -> offsetGet ( $ index ) ; if ( ! is_array ( $ items ) ) { $ itemsType = gettype ( $ items ) ; throw new \ Exception ( "Offset '$index' is '$itemsType' and must be array to append." ) ; } } ... | adds a value to an offset array if there is an array |
51,165 | public function getRoleDescription ( ) { static $ list = null ; if ( $ list === null ) { $ list = static :: getRoles ( ) ; } return ( isset ( $ list [ $ this -> role ] ) ) ? $ list [ $ this -> role ] : $ this -> role ; } | Role sting representation |
51,166 | public function getStatusDescription ( ) { static $ list = null ; if ( $ list === null ) { $ list = static :: getStatuses ( ) ; } return ( isset ( $ list [ $ this -> status ] ) ) ? $ list [ $ this -> status ] : $ this -> status ; } | Status sting representation |
51,167 | public static function findByEmail ( $ email , $ checkStatus = true ) { return static :: findOne ( $ checkStatus ? [ 'email' => $ email , 'status' => self :: STATUS_ACTIVE ] : [ 'email' => $ email ] ) ; } | Finds user by email |
51,168 | public static function findByUsernameOrEmail ( $ username , $ checkStatus = true ) { $ query = static :: find ( ) ; $ query -> where ( [ 'or' , [ 'username' => $ username ] , [ 'email' => $ username ] ] ) ; if ( $ checkStatus ) { $ query -> andWhere ( [ 'status' => self :: STATUS_ACTIVE ] ) ; } return $ query -> limit ... | Finds user by username or email |
51,169 | public static function updateLastVisit ( $ event ) { if ( $ event -> isValid ) { $ user = $ event -> identity ; $ user -> last_visit_at = time ( ) ; $ user -> updateAttributes ( [ 'last_visit_at' ] ) ; return true ; } return false ; } | Update last visit time event handler |
51,170 | function Generate ( ) { if ( $ this -> cacher -> MustUseCache ( ) ) { $ this -> xml = $ this -> cacher -> GetFromCache ( ) ; return ; } $ this -> AddAllPages ( ) ; $ this -> xml = $ this -> sitemap -> SaveXml ( ) ; if ( $ this -> cacher -> MustStoreToCache ( ) ) { $ this -> cacher -> StoreToCache ( $ this -> xml ) ; } ... | Generates the xml by pulling it from cache or generating it |
51,171 | private function AddAllPages ( ) { $ page = $ this -> pageTree -> TopMost ( ) ; while ( $ page ) { $ this -> AddPageBranch ( $ page ) ; $ page = $ this -> pageTree -> NextOf ( $ page ) ; } } | The entry point for fetching all pages as sitemap |
51,172 | private function AddPageBranch ( Page $ page ) { $ this -> AddPage ( $ page ) ; $ child = $ this -> pageTree -> FirstChildOf ( $ page ) ; while ( $ child ) { $ this -> AddPageBranch ( $ child ) ; $ child = $ this -> pageTree -> NextOf ( $ child ) ; } } | Adds a page and all of its children |
51,173 | private function AddPage ( Page $ page ) { if ( ! $ this -> PageAllowed ( $ page ) ) { return ; } $ params = FrontendRouter :: GatherParams ( $ page -> GetUrl ( ) ) ; if ( count ( $ params ) == 0 ) { $ changeFreq = ChangeFrequency :: ByValue ( $ page -> GetSitemapChangeFrequency ( ) ) ; $ priority = $ page -> GetSitema... | Adds a single page to the sitemap |
51,174 | public function action ( string $ message , string $ link , string $ class = 'btn btn-primary' ) : Mail { $ this -> body .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"{$class}\"><tbody> <tr> <td align=\"left\"> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tbody> ... | Create a action |
51,175 | public function view ( string $ view , array $ data = [ ] ) : Mail { $ this -> viewLocation = $ view ; $ this -> viewArgs = $ data ; return $ this ; } | Set view email view |
51,176 | public function send ( ? string $ message = null , ? string $ subject = null ) { if ( $ message != null ) { $ this -> body = $ message ; } if ( $ subject != null ) { $ this -> subject = $ subject ; } if ( $ this -> viewLocation != null || $ this -> viewLocation !== '' ) { $ this -> render ( $ this -> viewLocation , $ t... | Finally send the email!!! |
51,177 | protected static function xmlToArray ( \ SimpleXMLElement $ xml ) { $ arr = array ( ) ; foreach ( $ xml as $ element ) { $ tag = $ element -> getName ( ) ; $ ele = get_object_vars ( $ element ) ; if ( ! empty ( $ ele ) ) { $ arr [ $ tag ] = $ element instanceof \ SimpleXMLElement ? static :: xmlToArray ( $ element ) : ... | Convert SimpleXML object to array |
51,178 | protected function RenderArea ( $ name ) { $ area = $ this -> areas [ $ name ] ; if ( ! $ area ) { throw new \ InvalidArgumentException ( "Invalid area name $name" ) ; } $ layoutAreaRenderer = new LayoutAreaRenderer ( $ area ) ; $ result = $ layoutAreaRenderer -> Render ( ) ; $ pageAreaRenderer = new PageAreaRenderer (... | Renders the area with the given name |
51,179 | function Render ( ) { self :: $ currentPage = $ this -> page ; self :: $ Title = self :: $ currentPage -> GetTitle ( ) ; self :: $ Description = self :: $ currentPage -> GetDescription ( ) ; self :: $ Keywords = self :: $ currentPage -> GetKeywords ( ) ; if ( $ this -> page -> GetType ( ) == ( string ) PageType :: NotF... | Renders the complete page by requiring the page layout |
51,180 | protected function getRoute ( $ destination ) { $ destinationPieces = explode ( '/' , $ destination ) ; $ mappingNode = $ this -> routeMapping ; $ argValues = array ( ) ; foreach ( $ destinationPieces as $ destinationPiece ) { if ( isset ( $ mappingNode [ $ destinationPiece ] ) ) { $ mappingNode = $ mappingNode [ $ des... | Get Route for given destination |
51,181 | public function addMapping ( $ destinationPattern , $ controllerClass , $ actionName ) { $ mapping = new Route \ Mapping ( $ destinationPattern , $ controllerClass , $ actionName ) ; $ this -> reverseMapping [ $ controllerClass ] [ $ actionName ] = $ mapping ; $ destinationPieces = explode ( '/' , $ destinationPattern ... | Add route mapping |
51,182 | public function outputAction ( $ startTime , $ showProfiler ) { $ data = [ 'showProfiler' => $ showProfiler ] ; if ( $ showProfiler ) { $ data = [ 'showProfiler' => true , 'memory' => \ Shade \ Converter :: formatBytes ( memory_get_usage ( true ) ) , 'memoryPeak' => \ Shade \ Converter :: formatBytes ( memory_get_peak_... | Output profiler information |
51,183 | public function header ( $ name , $ value = null ) { if ( $ value === null ) { $ this -> headers [ ] = $ name ; } else { $ this -> headers [ ] = $ this -> headerString ( $ name , $ value ) ; } return $ this ; } | Header kodu ekler mesaja |
51,184 | public static function ToChar ( $ value , $ provider = null ) { if ( $ value instanceof \ DateTime ) { $ value = Convert :: ToString ( $ value , $ provider ) ; if ( is_null ( $ value ) ) return null ; } if ( is_string ( $ value ) && strlen ( $ value ) ) { return $ value [ 0 ] ; } else if ( is_numeric ( $ value ) ) { $ ... | Converts the value of this instance to an equivalent Unicode character using the specified culture - specific formatting information . |
51,185 | public static function ChangeType ( $ value , $ conversionType , $ provider = null ) { return Convert :: ToType ( $ value , $ conversionType , $ provider ) ; } | ChangeType an alias for ToType |
51,186 | public static function ToDateTime ( $ value , $ provider = null ) { if ( $ value instanceof \ DateTime ) return $ value ; if ( is_string ( $ value ) ) { $ timestamp = strtotime ( $ value ) ; if ( $ timestamp === false ) return null ; $ dt = new \ DateTime ( ) ; $ dt -> setTimestamp ( $ timestamp ) ; return $ dt ; } $ v... | Converts the value of this instance to an equivalent DateTime using the specified culture - specific formatting information . |
51,187 | public static function ToDecimal ( $ value , $ provider = null ) { return is_double ( $ value ) ? DecimalValue :: FromFloat ( $ value ) : new DecimalValue ( $ value ) ; } | Converts the value of this instance to an equivalent System . Decimal number using the specified culture - specific formatting information . |
51,188 | public static function ToDouble ( $ value , $ provider = null ) { if ( $ value instanceof \ DateTime ) { return NAN ; } else if ( ( is_numeric ( $ value ) && $ value == INF ) || ( is_string ( $ value ) && strtoupper ( $ value ) == "INF" ) ) { return INF ; } else if ( ( is_numeric ( $ value ) && $ value == - INF ) || ( ... | Converts the value of this instance to an equivalent double - precision floating - point number using the specified culture - specific formatting information . |
51,189 | public static function ToString ( $ value , $ provider = null ) { if ( $ value instanceof XPath2Item ) { return $ value -> getValue ( ) ; } if ( $ value instanceof \ DateTime ) { $ collator = \ Collator :: create ( null ) ; $ locale = $ collator -> getLocale ( \ Locale :: VALID_LOCALE ) ; $ dateTime = \ IntlDateFormatt... | Converts the value of this instance to an equivalent System . String using the specified culture - specific formatting information . |
51,190 | public static function ToInt ( $ value , $ provider = null ) { if ( $ value instanceof ValueProxy ) { return $ value -> ToInt ( $ provider ) ; } if ( $ value instanceof XPath2Item ) { return Convert :: ToInt ( $ value -> getTypedValue ( ) , $ provider ) ; } if ( is_numeric ( $ value ) ) { if ( $ value > PHP_INT_MAX ) r... | Converts the value of this instance to an equivalent integer using the specified culture - specific formatting information . |
51,191 | public function updateUserSettings ( FilterUserFieldsEvent $ userfields_filter ) { $ settings_manager = $ userfields_filter -> getContainer ( ) -> get ( 'acs.setting_manager' ) ; $ user = $ userfields_filter -> getContainer ( ) -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; $ fields_template = $ userfie... | Create new added fields to user or missing fields |
51,192 | public function toArray ( $ sheet_name , $ ext = false ) { if ( ! $ ext ) { $ ext = pathinfo ( $ sheet_name , PATHINFO_EXTENSION ) ; } switch ( $ ext ) { case 'csv' : $ reader = ReaderFactory :: create ( Type :: CSV ) ; break ; case 'ods' : $ reader = ReaderFactory :: create ( Type :: ODS ) ; break ; case 'xlsx' : $ re... | Converte uma planilha para array |
51,193 | public function toSheet ( $ array , $ sheet_name , $ ext = false ) { if ( ! $ ext ) { $ ext = pathinfo ( $ sheet_name , PATHINFO_EXTENSION ) ; } switch ( $ ext ) { case 'csv' : $ writer = WriterFactory :: create ( Type :: CSV ) ; break ; case 'ods' : $ writer = WriterFactory :: create ( Type :: ODS ) ; break ; case 'xl... | Converte um array de dados para uma planilha |
51,194 | public static function dump ( $ data = null , $ export = false ) { if ( false === is_bool ( $ export ) ) { return trigger_error ( sprintf ( 'Argument 2 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ export ) ) , E_USER_ERROR ) ; } if ( $ data === null || ( true === is_string ( $ data... | Advanced debugging of variables |
51,195 | public static function time ( $ key = null ) { if ( null !== $ key && false === is_string ( $ key ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ key ) ) , E_USER_ERROR ) ; } if ( count ( static :: $ time ) === 0 ) { static :: $ time =... | Calculate process times by adding new times an exporting them |
51,196 | public function has ( string $ key ) : bool { $ key = $ this -> getKey ( $ key , true ) ; return isset ( $ this -> headers [ $ key ] ) ; } | Determine whether a particular header exists |
51,197 | protected function getKey ( string $ key , bool $ register = false ) : string { $ lowercaseKey = strtolower ( $ key ) ; if ( isset ( $ this -> keyMap [ $ lowercaseKey ] ) ) { $ key = $ this -> keyMap [ $ lowercaseKey ] ; } elseif ( $ register ) { $ this -> keyMap [ $ lowercaseKey ] = $ key ; } return $ key ; } | Retrieve a key that can be used in a hashmap to prevent duplicate keys |
51,198 | public function addMultiple ( array $ headers ) : HeaderCollection { foreach ( $ headers as $ key => $ value ) { $ key = $ this -> getKey ( $ key , true ) ; \ sndsgd \ Arr :: addValue ( $ this -> headers , $ key , $ value ) ; } return $ this ; } | Add multiple headers |
51,199 | public function get ( string $ key ) : string { $ key = $ this -> getKey ( $ key ) ; $ value = $ this -> headers [ $ key ] ?? "" ; return is_array ( $ value ) ? implode ( ", " , $ value ) : $ value ; } | Get a header value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.