idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
53,800 | public static function init ( $ time = null ) { try { $ interval = new self ( $ time ) ; return $ interval ; } catch ( \ Exception $ e ) { return null ; } } | Standard initalise . Useful for array_map |
53,801 | public function isEmpty ( ) { return $ this -> y === 0 && $ this -> m === 0 && $ this -> d === 0 && $ this -> h === 0 && $ this -> i === 0 && $ this -> s === 0 ; } | Is this interval empty? |
53,802 | public function toArray ( ) { return array ( 'year' => $ this -> y , 'month' => $ this -> m , 'day' => $ this -> d , 'hour' => $ this -> h , 'minute' => $ this -> i , 'second' => $ this -> s , ) ; } | Return a array representing interval information |
53,803 | final protected function sanitize ( $ data ) { $ sanitized = [ ] ; if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ sanitized [ $ key ] = $ this -> sanitize ( $ value ) ; } } else { $ sanitized = trim ( strip_tags ( $ data ) ) ; } return $ sanitized ; } | Sanitizes an array with data . |
53,804 | public function get ( $ name ) { $ this -> toString = isset ( $ _COOKIE [ $ name ] ) ? $ _COOKIE [ $ name ] : "" ; return new InputUtilities ( $ this -> toString ) ; } | Get cookie value . |
53,805 | public function delete ( $ name ) { $ this -> func = function ( ) use ( $ name ) { setcookie ( $ name , null , 0 ) ; return $ name ; } ; return new CookieFlush ( $ this -> func ) ; } | Delete cookie . |
53,806 | public static function get_all_areas ( ) { global $ sidebars_widgets ; $ widget_areas = [ ] ; foreach ( $ sidebars_widgets as $ widget_area => $ widgets ) { if ( 'wp_inactive_widgets' === $ widget_area ) { continue ; } $ widget_areas [ $ widget_area ] = [ ] ; if ( empty ( $ widgets ) ) { continue ; } foreach ( $ widget... | Returns an array of widget areas with the assigned widgets in each . |
53,807 | protected function iterator ( $ framework , $ source ) { $ source = $ source . DIRECTORY_SEPARATOR . ucfirst ( $ framework ) ; $ directory = new \ RecursiveDirectoryIterator ( $ source , 4096 ) ; return new \ RecursiveIteratorIterator ( $ directory , 1 ) ; } | Returns a \ RecursiveIteratorIterator instance . |
53,808 | protected function migrate ( OutputInterface $ output , $ source , $ path , $ framework ) { foreach ( $ this -> iterator ( $ framework , $ source ) as $ item ) { $ name = strtolower ( str_replace ( $ source , '' , $ item -> getRealpath ( ) ) ) ; if ( ( boolean ) $ item -> isDir ( ) === false ) { $ date = date ( $ this ... | Creates a copy of database files to the specified path . |
53,809 | protected function package ( $ name ) { $ exists = in_array ( $ name , array_keys ( $ this -> packages ) ) ; if ( $ exists === false || ! class_exists ( $ this -> packages [ $ name ] ) ) { $ message = 'Package "' . $ name . '" does not exists!' ; throw new \ InvalidArgumentException ( ( string ) $ message ) ; } $ funct... | Return the value of the required type from the specified package . |
53,810 | public function boot ( ) { foreach ( $ this -> subscribe as $ subscriber ) { Event :: subscribe ( $ subscriber ) ; } $ this -> publishes ( [ __DIR__ . '/../../config/iptraceable.php' => config_path ( 'iptraceable.php' ) , ] , 'config' ) ; } | Register the application s event listeners and publish the config file . |
53,811 | public function fetchAction ( Request $ request ) { $ reference = strtoupper ( $ request -> query -> get ( 'reference' , null ) ) ; $ remote = ( bool ) $ request -> query -> get ( 'remote' , 1 ) ; if ( 0 < strlen ( $ reference ) && $ remote ) { $ remoteEndPoints = $ this -> container -> getParameter ( 'ekyna_setting.he... | Fetches the helper content . |
53,812 | public function addError ( $ error , $ key = null ) { if ( is_string ( $ error ) ) { $ error = new Exception ( $ error ) ; } elseif ( $ error instanceof Exception ) { } else { throw new Exception ( 'only string errors or instances of Exception can be added' ) ; } if ( $ key ) { $ this -> errors [ $ key ] = $ error ; } ... | Add error . |
53,813 | protected static function combineUrl ( $ url , $ params = [ ] ) { $ urlObject = Url :: parse ( $ url ) ; $ queryData = array_merge ( $ urlObject -> query -> getData ( ) , $ params ) ; $ urlObject -> query -> setData ( $ queryData ) ; return $ urlObject -> getUrl ( ) ; } | Manipulate the url & params for GET request |
53,814 | protected function validateServer ( $ server ) { if ( in_array ( $ server , array_keys ( $ this -> servers ) ) ) { $ options = $ this -> config -> get ( $ server ) ; if ( ! $ options || $ options [ 'host' ] === 'yoursite' ) { throw new \ Exception ( "Remote server \"{$server}\" not setup in remote.yml." ) ; } if ( shel... | Check existence of remote server . |
53,815 | protected function publish_ssh ( OutputInterface $ output , $ target ) { $ config = $ this -> config -> get ( 'ssh' ) ; $ remote_dir = ltrim ( $ config [ 'remote_dir' ] , '/' ) ; $ output -> writeln ( shell_exec ( "rsync -avze 'ssh -p {$config['port']}' {$target} {$config['user']}@{$config['host']}:{$remote_dir} --excl... | Publish using SSH . |
53,816 | public function getCompiledFilenameFromClassname ( $ fqcn ) { $ filename = $ this -> templateCompileDirectory . '/' . $ fqcn . '.php' ; $ filename = str_replace ( '\\' , '/' , $ filename ) ; return $ filename ; } | Returns the fully pathed filename for a compiled class . |
53,817 | public function getFQCNFromTemplateName ( $ templateName ) { $ classname = $ this -> compiledNamespace . "\\" . $ templateName ; $ classname = str_replace ( '/' , '\\' , $ classname ) ; $ classname .= "Jig" ; return $ classname ; } | Generate the full class name for the compiled version of a template .. |
53,818 | public function read_file ( $ path , $ archive_filepath = FALSE ) { if ( file_exists ( $ path ) && FALSE !== ( $ data = file_get_contents ( $ path ) ) ) { if ( is_string ( $ archive_filepath ) ) { $ name = str_replace ( '\\' , '/' , $ archive_filepath ) ; } else { $ name = str_replace ( '\\' , '/' , $ path ) ; if ( $ a... | Read the contents of a file and add it to the zip |
53,819 | public function read_dir ( $ path , $ preserve_filepath = TRUE , $ root_path = NULL ) { $ path = rtrim ( $ path , '/\\' ) . DIRECTORY_SEPARATOR ; if ( ! $ fp = @ opendir ( $ path ) ) { return FALSE ; } if ( $ root_path === NULL ) { $ root_path = str_replace ( array ( '\\' , '/' ) , DIRECTORY_SEPARATOR , dirname ( $ pat... | Read a directory and add it to the zip . |
53,820 | public function get_zip ( ) { if ( $ this -> entries === 0 ) { return FALSE ; } return $ this -> zipdata . $ this -> directory . "\x50\x4b\x05\x06\x00\x00\x00\x00" . pack ( 'v' , $ this -> entries ) . pack ( 'v' , $ this -> entries ) . pack ( 'V' , strlen ( $ this -> directory ) ) . pack ( 'V' , strlen ( $ this -> zipd... | Get the Zip file |
53,821 | public function archive ( $ filepath ) { if ( ! ( $ fp = @ fopen ( $ filepath , 'w+b' ) ) ) { return FALSE ; } flock ( $ fp , LOCK_EX ) ; for ( $ result = $ written = 0 , $ data = $ this -> get_zip ( ) , $ length = strlen ( $ data ) ; $ written < $ length ; $ written += $ result ) { if ( ( $ result = fwrite ( $ fp , su... | Write File to the specified directory |
53,822 | public function validateMessage ( $ value ) { if ( is_string ( $ value ) ) { $ result = true ; } elseif ( is_object ( $ value ) && method_exists ( $ value , "__toString" ) ) { $ result = true ; } else { $ result = false ; } return $ result ; } | Validator for message property |
53,823 | public function data ( array $ keys = null ) { if ( $ keys === null ) { $ keys = $ this -> keys ( ) ; } $ data = [ ] ; foreach ( $ keys as $ key ) { if ( strtolower ( $ key ) === 'data' ) { continue ; } if ( isset ( $ this [ $ key ] ) ) { $ data [ $ key ] = $ this [ $ key ] ; } } return $ data ; } | Gets all data or a subset from this entity . |
53,824 | public function offsetExists ( $ key ) { if ( is_numeric ( $ key ) ) { throw new InvalidArgumentException ( 'Entity array access only supports non-numeric keys' ) ; } $ key = $ this -> camelize ( $ key ) ; if ( $ key === '' ) { return false ; } if ( is_callable ( [ $ this , $ key ] ) ) { $ value = $ this -> { $ key } (... | Determines if this entity contains the specified key and if its value is not NULL . |
53,825 | public function offsetSet ( $ key , $ value ) { if ( is_numeric ( $ key ) ) { throw new InvalidArgumentException ( 'Entity array access only supports non-numeric keys' ) ; } $ key = $ this -> camelize ( $ key ) ; if ( $ key === '' ) { return ; } $ setter = 'set' . ucfirst ( $ key ) ; if ( is_callable ( [ $ this , $ set... | Assigns the value to the specified key on this entity . |
53,826 | public function offsetUnset ( $ key ) { if ( is_numeric ( $ key ) ) { throw new InvalidArgumentException ( 'Entity array access only supports non-numeric keys' ) ; } $ key = $ this -> camelize ( $ key ) ; if ( $ key === '' ) { return ; } $ this [ $ key ] = null ; unset ( $ this -> keys [ $ key ] ) ; } | Removes the value from the specified key on this entity . |
53,827 | final protected function camelize ( $ str ) { if ( strstr ( $ str , '_' ) === false ) { return $ str ; } return lcfirst ( implode ( '' , array_map ( 'ucfirst' , explode ( '_' , $ str ) ) ) ) ; } | Transform a string from snake_case to camelCase . |
53,828 | public function extractRoles ( GroupMembershipInterface $ membership ) { $ roles = [ ] ; foreach ( $ membership -> getRoles ( ) as $ role ) { $ roles [ ] = new Role ( $ role ) ; } return $ roles ; } | Returns the roles for this membership . |
53,829 | protected function getExcerpt ( $ content ) { $ pattern = '#(\<\!\-\-\s?excerpt\s?\-\-\>)(.*)(\<\!\-\-\s?endexcerpt\s?\-\-\>)#si' ; if ( preg_match ( $ pattern , $ content , $ matches ) ) { return $ matches [ 2 ] ; } return $ this -> description ; } | Get excerpt from between excerpt tags or first paragraph . |
53,830 | protected function getTagClassNames ( ) { $ tags = array_map ( function ( $ tag ) { return slugify ( $ tag ) ; } , explode ( '|' , $ this -> get ( 'tags' ) ) ) ; return implode ( ' ' , $ tags ) ; } | Get human readable tags . |
53,831 | public function getAttribute ( string $ attribute ) : array { if ( ! array_key_exists ( $ attribute , $ this -> attributes ) ) { return [ ] ; } return $ this -> attributes [ $ attribute ] ; } | Returns the value of the attribute . If the value isn t set it returns the fallback ; |
53,832 | public function setAttributes ( array $ attributesValues ) : self { foreach ( $ attributesValues as $ attribute => $ value ) { $ this -> setAttribute ( $ attribute , $ value ) ; } return $ this ; } | Set the value of multiple attributes at once . |
53,833 | public function setAttribute ( string $ attribute , $ value = [ ] ) : self { $ this -> attributes [ $ attribute ] = $ this -> wrap ( $ value ) ; return $ this ; } | Sets the value of an attribute . If the attribute is already set it overwrites the current value . |
53,834 | public function addAttributeValue ( string $ attribute , string $ value = '' ) : self { $ values = $ this -> getAttribute ( $ attribute ) ; if ( ! in_array ( $ value , $ values ) ) { $ values [ ] = $ value ; } $ this -> setAttribute ( $ attribute , $ values ) ; return $ this ; } | Adds a value to the attribute . |
53,835 | public function removeAttributeValue ( string $ attribute , string $ value ) : self { if ( ! array_key_exists ( $ attribute , $ this -> attributes ) ) { return $ this ; } $ values = array_filter ( $ this -> getAttribute ( $ attribute ) , function ( $ attributeValue ) use ( $ value ) { return $ attributeValue !== $ valu... | Removes a value from the attribute . |
53,836 | private function generateAttribute ( string $ attribute , array $ values = [ ] ) : string { if ( ! is_numeric ( $ attribute ) ) { return sprintf ( '%s="%s"' , $ attribute , htmlentities ( trim ( implode ( ' ' , $ values ) ) ) ) ; } return implode ( ' ' , $ values ) ; } | Generates the HTML for the attribute . |
53,837 | private function generateTagAttributes ( ) : string { if ( count ( $ this -> getAttributes ( ) ) === 0 ) { return '' ; } $ renderedAttributes = [ ] ; foreach ( $ this -> getAttributes ( ) as $ attribute => $ value ) { $ renderedAttributes [ ] = $ this -> generateAttribute ( $ attribute , $ value ) ; } return implode ( ... | Generates the HTML for the attributes of the HTML element . |
53,838 | public function generate ( ) : string { if ( $ this -> getTag ( ) === '' ) { return '' ; } $ tagAttributes = $ this -> generateTagAttributes ( ) ; $ tagSeparator = '' ; if ( $ tagAttributes !== '' ) { $ tagSeparator = ' ' ; } $ openingTag = sprintf ( '<%s%s%s>' , $ this -> getTag ( ) , $ tagSeparator , $ tagAttributes ... | Generates the HTML tag with it s attributes and text . |
53,839 | public function postAction ( Request $ request ) { try { return $ this -> createJsonResponse ( $ this -> get ( 'oauth.server' ) -> grant ( $ this -> getRequestData ( $ request , 'snakelize' ) ) ) ; } catch ( InvalidGrantException $ e ) { return new JsonResponse ( 'Unavailable to create access token : bad credentials.' ... | Create a new access_token from given request throught oAuth server . |
53,840 | public function setID ( $ id ) { if ( $ id !== null && substr ( $ id , 0 , 1 ) !== '/' ) throw new Exception ( "invalid file id, must start with a /" ) ; $ this -> id = $ id ; } | Set the ID for this file |
53,841 | public function isValid ( ) { return $ this -> getID ( ) != null && $ this -> getURL ( ) != null && $ this -> getLocalPath ( ) != null ; } | Determines if this is a valid file object or not . |
53,842 | public static function getCookieValue ( $ value ) { if ( substr ( $ value , 0 , 1 ) !== '"' && substr ( $ value , - 1 , 1 ) !== '"' && strpbrk ( $ value , ';,' ) ) { $ value = '"' . $ value . '"' ; } return $ value ; } | Quote the cookie value if it is not already quoted and it contains problematic characters . |
53,843 | public function getFirstChild ( ) { if ( $ this -> isLeaf ( ) ) { return null ; } if ( $ this -> children !== null ) { $ ary = array_slice ( $ this -> children , 0 , 1 ) ; return $ ary [ 0 ] ; } $ qb = $ this -> getManager ( ) -> getConfiguration ( ) -> getBaseQueryBuilder ( ) ; $ alias = $ this -> getManager ( ) -> ge... | gets first child or null |
53,844 | public function getDescendants ( $ depth = null ) { if ( ! $ this -> hasChildren ( ) ) { return array ( ) ; } if ( $ this -> descendants === null ) { $ qb = $ this -> getManager ( ) -> getConfiguration ( ) -> getBaseQueryBuilder ( ) ; $ alias = $ this -> getManager ( ) -> getConfiguration ( ) -> getQueryBuilderAlias ( ... | gets descendants for this node |
53,845 | public function getParent ( ) { if ( $ this -> isRoot ( ) ) { return null ; } if ( $ this -> parent == null && $ this -> ancestors ) { $ this -> parent = $ this -> ancestors [ count ( $ this -> ancestors ) - 1 ] ; } if ( $ this -> parent == null ) { $ qb = $ this -> getManager ( ) -> getConfiguration ( ) -> getBaseQuer... | gets parent Node or null |
53,846 | public function getAncestors ( ) { if ( $ this -> isRoot ( ) ) { return array ( ) ; } if ( $ this -> ancestors === null ) { $ qb = $ this -> getManager ( ) -> getConfiguration ( ) -> getBaseQueryBuilder ( ) ; $ alias = $ this -> getManager ( ) -> getConfiguration ( ) -> getQueryBuilderAlias ( ) ; $ qb -> andWhere ( "$a... | gets ancestors for node |
53,847 | public function getLevel ( ) { if ( $ this -> level === null ) { $ this -> level = count ( $ this -> getAncestors ( ) ) ; } return $ this -> level ; } | gets the level of this node |
53,848 | public function getSiblings ( $ includeNode = false ) { $ parent = $ this -> getParent ( ) ; $ siblings = array ( ) ; if ( $ parent && $ parent -> isValidNode ( ) ) { $ children = $ parent -> getChildren ( ) ; foreach ( $ children as $ child ) { if ( ! $ includeNode && $ this -> isEqualTo ( $ child ) ) { continue ; } $... | gets siblings for node |
53,849 | public function getPrevSibling ( ) { if ( $ this -> parent !== null && ( $ children = $ this -> parent -> internalGetChildren ( ) ) !== null ) { for ( $ i = 0 ; $ i < count ( $ children ) ; $ i ++ ) { if ( $ children [ $ i ] == $ this ) { return ( $ i - 1 < 0 ) ? null : $ children [ $ i - 1 ] ; } } } $ qb = $ this -> g... | gets prev sibling or null |
53,850 | public function insertAsParentOf ( NodeWrapper $ node ) { if ( $ node == $ this ) { throw new \ InvalidArgumentException ( 'Cannot insert node as a parent of itself' ) ; } if ( $ this -> isValidNode ( ) ) { throw new \ InvalidArgumentException ( 'Cannot insert a node that already has a place within the tree' ) ; } if (... | inserts node as parent of given node |
53,851 | public function insertAsPrevSiblingOf ( NodeWrapper $ node ) { if ( $ node == $ this ) { throw new \ InvalidArgumentException ( 'Cannot insert node as a sibling of itself' ) ; } $ em = $ this -> getManager ( ) -> getEntityManager ( ) ; $ newLeft = $ node -> getLeftValue ( ) ; $ newRight = $ node -> getLeftValue ( ) + 1... | inserts node as previous sibling of given node |
53,852 | public function moveAsLastChildOf ( NodeWrapper $ node ) { if ( $ node == $ this ) { throw new \ InvalidArgumentException ( 'Cannot move node as a child of itself' ) ; } $ em = $ this -> getManager ( ) -> getEntityManager ( ) ; $ em -> getConnection ( ) -> beginTransaction ( ) ; try { if ( $ this -> hasManyRoots ( ) &&... | moves node as last child of the given node |
53,853 | public function makeRoot ( $ newRoot ) { if ( $ this -> isRoot ( ) ) { return ; } if ( ! $ this -> hasManyRoots ( ) ) { throw new \ BadMethodCallException ( sprintf ( '%s::%s is only supported on multiple root trees' , __CLASS__ , __METHOD__ ) ) ; } $ em = $ this -> getManager ( ) -> getEntityManager ( ) ; $ lftField =... | Makes this node a root node . |
53,854 | public function addChild ( Node $ node ) { if ( $ node instanceof NodeWrapper ) { if ( $ node == $ this ) { throw new \ InvalidArgumentException ( 'Cannot insert node as a child of itself' ) ; } $ node -> insertAsLastChildOf ( $ this ) ; return $ node ; } $ node -> setLeftValue ( $ this -> getRightValue ( ) ) ; $ node ... | adds given node as the last child of this entity |
53,855 | public function delete ( ) { $ em = $ this -> getManager ( ) -> getEntityManager ( ) ; $ lftField = $ this -> getLeftFieldName ( ) ; $ rgtField = $ this -> getRightFieldName ( ) ; $ oldLft = $ this -> getLeftValue ( ) ; $ oldRgt = $ this -> getRightValue ( ) ; $ oldRoot = $ this -> hasManyRoots ( ) ? $ this -> getRootV... | deletes this node and it s decendants |
53,856 | protected function insertNode ( $ destLeft , $ destRight , $ destRoot = null ) { $ this -> setLeftValue ( $ destLeft ) ; $ this -> setRightValue ( $ destRight ) ; if ( $ this -> hasManyRoots ( ) ) { $ this -> setRootValue ( $ destRoot ) ; } $ this -> getManager ( ) -> getEntityManager ( ) -> persist ( $ this -> getNode... | sets node s left and right values and persist s it |
53,857 | public function isDescendantOf ( Node $ node ) { return ( ( $ this -> getLeftValue ( ) > $ node -> getLeftValue ( ) ) && ( $ this -> getRightValue ( ) < $ node -> getRightValue ( ) ) && ( ! $ this -> hasManyRoots ( ) || ( $ this -> getRootValue ( ) == $ node -> getRootValue ( ) ) ) ) ; } | determines if this node is a child of the given node |
53,858 | public function isEqualTo ( Node $ node ) { return ( ( $ this -> getLeftValue ( ) == $ node -> getLeftValue ( ) ) && ( $ this -> getRightValue ( ) == $ node -> getRightValue ( ) ) && ( ! $ this -> hasManyRoots ( ) || ( $ this -> getRootValue ( ) == $ node -> getRootValue ( ) ) ) ) ; } | determines if this node is equal to the given node |
53,859 | public function write ( ) { if ( $ this -> rotationInterval and $ this -> rotationTimer < time ( ) ) { $ this -> rotate ( ) ; } return $ this -> driver -> write ( ) ; } | Writes the container data to the session store |
53,860 | public function stop ( ) { if ( $ this -> rotationInterval and $ this -> rotationTimer < time ( ) ) { $ this -> rotate ( ) ; } return $ this -> driver -> stop ( ) ; } | Stops a session |
53,861 | public function rotate ( ) { if ( $ this -> rotationInterval ) { $ this -> rotationTimer = time ( ) + $ this -> rotationInterval ; } $ this -> driver -> regenerate ( $ this ) ; } | Rotates the session id and reset the rotation timer if needed |
53,862 | public function setNamespace ( $ name ) { $ this -> config [ 'namespace' ] = is_bool ( $ name ) ? $ name : ( string ) $ name ; if ( $ this -> config [ 'namespace' ] === true ) { $ this -> config [ 'namespace' ] = $ this -> app ? $ app -> getName ( ) : false ; } $ this -> data -> setNamespace ( $ this -> config [ 'names... | Sets the session namespace |
53,863 | public function setFlashNamespace ( $ name ) { $ this -> config [ 'flash_namespace' ] = ( string ) $ name ; $ this -> flash -> setNamespace ( $ this -> config [ 'flash_namespace' ] ) ; } | Sets the session flash namespace |
53,864 | protected function reset ( ) { $ this -> data = new DataContainer ( ) ; $ this -> flash = new FlashContainer ( ) ; $ this -> flash -> set ( FlashContainer :: EXPIRE_DATA_KEY , array ( ) ) ; } | Resets the data and flash data containers |
53,865 | public function addAddress ( AddressInterface $ address ) { if ( $ this -> addresses -> contains ( $ address ) ) { throw new \ InvalidArgumentException ( 'This contact already owns this address' ) ; } $ this -> addresses -> add ( $ address ) ; if ( ! $ this -> defaultAddress ) { $ this -> setDefaultAddress ( $ address ... | Add an Address to the collection . |
53,866 | public function removeAddress ( AddressInterface $ address ) { if ( ! $ this -> hasAddress ( $ address ) ) { throw new \ InvalidArgumentException ( 'Trying to remove an address that does not belong to this contact' ) ; } $ this -> addresses -> removeElement ( $ address ) ; if ( $ address === $ this -> defaultAddress ) ... | Remove an Address from the collection . |
53,867 | public function addPhone ( PhoneInterface $ phone ) { if ( $ this -> phones -> contains ( $ phone ) ) { throw new \ InvalidArgumentException ( 'This contact already owns this phone' ) ; } $ this -> phones -> add ( $ phone ) ; if ( ! $ this -> defaultPhone ) { $ this -> setDefaultPhone ( $ phone ) ; } } | Add a Phone to the collection . |
53,868 | public function removePhone ( PhoneInterface $ phone ) { if ( ! $ this -> hasPhone ( $ phone ) ) { throw new \ InvalidArgumentException ( 'Trying to remove a phone that does not belong to this contact' ) ; } $ this -> phones -> removeElement ( $ phone ) ; if ( $ phone === $ this -> defaultPhone ) { if ( $ this -> phone... | Remove a Phone from the collection . |
53,869 | public function retrieveDashboardCalendarEventsAction ( ) { $ calendarTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCalendarTable' ) ; $ result = $ calendarTable -> retrieveDashboardCalendarEvents ( ) ; return new JsonModel ( $ result -> toArray ( ) ) ; } | Retrive Calendar Event to initialize calender uifor Dashboard Calendar |
53,870 | public function retrieveCalendarEventsAction ( ) { $ calendarTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCalendarTable' ) ; $ result = $ calendarTable -> retrieveCalendarEvents ( ) ; return new JsonModel ( $ result -> toArray ( ) ) ; } | Retrieve Calendar Event to initialize calender ui |
53,871 | public function saveEventAction ( ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ request = $ this -> getRequest ( ) ; $ status = 0 ; $ textMessage = '' ; $ errors = array ( ) ; $ textTitle = '' ; $ responseData = array ( ) ; $ melisMelisCoreConfig = $ this -> serviceLocator -> get ( 'Mel... | This action will save an event to the calendar |
53,872 | public function searchCalendarEventAction ( ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ textMessage = '' ; $ request = $ this -> getRequest ( ) ; $ id = null ; if ( $ request -> isPost ( ) ) { $ postValues = get_object_vars ( $ request -> getPost ( ) ) ; if ( ! empty ( $ postValues ) ... | Retrieving Calendar searched item event data for updating |
53,873 | public function reschedEventAction ( ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ request = $ this -> getRequest ( ) ; $ id = null ; $ status = 0 ; $ textMessage = '' ; $ errors = array ( ) ; $ textMessage = '' ; $ textTitle = '' ; if ( $ request -> isPost ( ) ) { $ postValues = get_ob... | Updating Calendar Event by resizing Calendar item event |
53,874 | public function deleteEventAction ( ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ request = $ this -> getRequest ( ) ; $ id = null ; $ status = 0 ; $ textMessage = '' ; $ errors = array ( ) ; $ textMessage = '' ; $ textTitle = '' ; if ( $ request -> isPost ( ) ) { $ postValues = get_obj... | Deleting Calendar item event |
53,875 | public function getEventTitleAction ( ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ request = $ this -> getRequest ( ) ; $ status = 0 ; $ textMessage = $ translator -> translate ( 'tr_melistoolcalendar_unable_get_event' ) ; $ errors = array ( ) ; $ textTitle = '' ; $ eventData = array (... | Retrieving Calendar item event data for updating |
53,876 | protected function getRefreshToken ( ) { $ refreshToken = $ this -> getConfig ( ) -> getStorage ( ) -> getRefreshToken ( ) ; if ( null !== $ refreshToken ) { return $ refreshToken ; } $ deviceToken = $ this -> getDeviceToken ( ) ; if ( $ deviceToken !== null && $ deviceToken -> canPoll ( ) ) { $ params = array ( 'clien... | Tries to retrieve RefreshToken . |
53,877 | protected function getAccessTokenWithRefreshToken ( RefreshToken $ refreshToken ) { $ params = array ( 'client_id' => $ this -> getConfig ( ) -> getClientId ( ) , 'refresh_token' => $ refreshToken -> getRefreshToken ( ) , 'grant_type' => 'refresh_token' , ) ; $ response = $ this -> sendPostRequest ( "oauth2waitress/oau... | Get new AccessToken using provided RefreshToken |
53,878 | protected function getDeviceToken ( ) { $ deviceToken = $ this -> getConfig ( ) -> getStorage ( ) -> getDeviceToken ( ) ; if ( null !== $ deviceToken && $ deviceToken -> isExpired ( ) ) { $ this -> getConfig ( ) -> getStorage ( ) -> deleteDeviceToken ( ) ; $ deviceToken = null ; } if ( null === $ deviceToken ) { $ para... | Retrieves DeviceToken contianing the UserCode and DeviceCode |
53,879 | protected function sendPostRequest ( $ path , $ params ) { $ url = $ this -> getConfig ( ) -> getAuthUrl ( ) . $ path ; $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , http_build_query ( $ params ) ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ... | Sends a POST request to the auth server . Returns array with keys output and code . Output contains the response body code contains the response code . |
53,880 | public function add ( $ element ) : BagInterface { array_unshift ( $ this -> elements , $ element ) ; shuffle ( $ this -> elements ) ; return $ this ; } | Adds a new element to the bag . |
53,881 | public function validate ( $ value ) { if ( ! is_array ( $ value ) ) { return Error :: unit ( [ Error :: NON_ARRAY ] ) ; } $ errors = [ ] ; foreach ( $ value as $ pos => $ item ) { $ result = parent :: validate ( $ item ) ; if ( $ result instanceof Error ) { $ errors [ $ pos ] = $ result -> unwrap ( ) ; } } return empt... | Tells if a given array s items adhere to any of the property s allowed types . |
53,882 | protected static function fmtRep ( $ char , & $ string , $ value ) { if ( preg_match_all ( '/([0-9]{0,1})' . $ char . '/' , $ string , $ m ) ) { for ( $ i = 0 ; $ i < count ( $ m [ 0 ] ) ; $ i ++ ) { $ val = round ( $ value , ( int ) $ m [ 1 ] [ $ i ] ) ; $ string = str_replace ( $ m [ 0 ] [ $ i ] , $ val , $ string ) ... | Performs a decimal regular expression string formatter replace that provides value at a specified decimal precision . |
53,883 | protected static function encode ( $ string , $ key ) { for ( $ i = 0 ; $ i < strlen ( $ key ) ; $ i ++ ) { $ char = $ key [ $ i ] ; $ string = str_replace ( "\\{$char}" , "%{$i}" , $ string ) ; } return $ string ; } | Encodes reserved characters for formatter strings . |
53,884 | protected static function decode ( $ string , $ key ) { for ( $ i = 0 ; $ i < strlen ( $ key ) ; $ i ++ ) { $ char = $ key [ $ i ] ; $ string = str_replace ( "%{$i}" , "{$char}" , $ string ) ; } return $ string ; } | Decodes reserved characters for formatter strings . |
53,885 | protected static function hmsf2sec ( $ h , $ m , $ s , $ f ) { return static :: dmsf2asec ( $ h , $ m , $ s , $ f ) ; } | Composes h m s into seconds . |
53,886 | protected function merge ( array & $ base , array $ overwrite ) { foreach ( $ overwrite as $ key => $ value ) { if ( is_int ( $ key ) ) { if ( ! in_array ( $ overwrite [ $ key ] , $ base ) ) { $ base [ ] = $ overwrite [ $ key ] ; } } else if ( is_array ( $ value ) ) { if ( isset ( $ base [ $ key ] ) && is_array ( $ bas... | Merge configuration arrays . |
53,887 | public function getType ( $ key , $ type ) { if ( is_array ( $ key ) ) { $ args = $ key ; } else { $ args = func_get_args ( ) ; $ type = array_pop ( $ args ) ; } $ val = $ this -> dget ( $ args ) ; if ( $ val === null ) throw new \ OutOfRangeException ( "Key " . implode ( '.' , $ args ) . " does not exist" ) ; $ checke... | Get a value cast to a specific type . |
53,888 | public function getSection ( $ key ) { $ val = $ this -> dget ( func_get_args ( ) ) ; if ( $ val instanceof Dictionary ) return $ val ; $ val = WF :: cast_array ( $ val ) ; return Dictionary :: wrap ( $ val ) ; } | Get the parameter as a Dictionary . |
53,889 | public function set ( $ key , $ value ) { if ( is_array ( $ key ) && $ value === null ) $ args = $ key ; else $ args = func_get_args ( ) ; $ value = array_pop ( $ args ) ; $ parent = null ; $ key = null ; $ ref = & $ this -> values ; foreach ( $ args as $ arg ) { if ( ! is_scalar ( $ arg ) ) throw new \ InvalidArgument... | Set a value in the dictionary |
53,890 | public function addAll ( $ values ) { if ( ! WF :: is_array_like ( $ values ) ) throw new \ DomainException ( "Invalid value to merge: " . WF :: str ( $ values ) ) ; $ this -> addAllRecursive ( $ values , $ this ) ; return $ this ; } | Add all elements in the provided array - like object to the dictionary . |
53,891 | private function addAllRecursive ( $ source , $ target , array $ path = [ ] ) { foreach ( $ source as $ key => $ value ) { if ( ! isset ( $ target [ $ key ] ) ) { $ target [ $ key ] = $ value ; } else { $ tgt = $ target [ $ key ] ; if ( is_array ( $ source ) || $ source instanceof Dictionary ) { if ( $ tgt instanceof D... | Recursive function to merge all values from a source dictionary or array into a target dictionary . |
53,892 | public function clear ( ) { $ keys = array_keys ( $ this -> values ) ; foreach ( $ keys as $ key ) unset ( $ this -> values [ $ key ] ) ; return $ this ; } | Remove all elements from the dictionary |
53,893 | protected function registerServiceProviders ( ) { $ this -> app -> register ( 'Congraph\Core\Bus\BusServiceProvider' ) ; $ this -> app -> register ( 'Congraph\Core\Events\EventsServiceProvider' ) ; $ this -> app -> register ( 'Congraph\Core\Repositories\RepositoriesServiceProvider' ) ; } | Register Service Providers for this package |
53,894 | public function getRaw ( ) { $ url = $ this -> _gravatar -> generateUrl ( 'profile' , $ this -> _gravatar -> getEmail ( ) ) . '.php' ; if ( is_null ( $ this -> _data ) ) { $ h = get_headers ( $ url , 1 ) [ 0 ] ; $ code = substr ( $ h , strrpos ( $ h , '404' ) , strlen ( $ h ) ) ; if ( $ code == '404 Not Found' ) { thro... | Returns raw serialized profile data . |
53,895 | public function convert ( $ type , $ data ) { foreach ( $ data as $ k => $ v ) { if ( is_array ( $ v ) ) { $ data [ $ k ] = $ this -> convert ( $ type , $ v ) ; } } switch ( strtolower ( $ type ) ) { case 'array' : return ( array ) $ data ; break ; case 'object' : return ( object ) $ data ; break ; default : throw new ... | Converts the data into whichever type specified . |
53,896 | public function addSubscriber ( SubscriberInterface $ subscriber ) { foreach ( $ subscriber -> getSubscriberEvents ( ) as $ subscriberEvent => $ params ) { if ( is_string ( $ params ) ) { $ this -> addListener ( $ subscriberEvent , array ( $ subscriber , $ params ) ) ; } if ( is_array ( $ params ) ) { foreach ( $ param... | Added subscriber from event configuration This subscriber allow notified for event |
53,897 | public function removeSubscriber ( SubscriberInterface $ subscriber ) { if ( is_array ( $ subscriber -> getSubscriberEvents ( ) ) ) { foreach ( $ subscriber -> getSubscriberEvents ( ) as $ subscriberEvent => $ params ) { $ this -> removeListener ( $ subscriberEvent , array ( $ subscriber , $ params ) ) ; } } } | Remove all subscriber from event configuration |
53,898 | public static function v3 ( $ namespace , $ name ) { if ( ! self :: is_valid ( $ namespace ) ) return false ; $ nhex = str_replace ( array ( '-' , '{' , '}' ) , '' , $ namespace ) ; $ nstr = '' ; for ( $ i = 0 ; $ i < strlen ( $ nhex ) ; $ i += 2 ) { $ nstr .= chr ( hexdec ( $ nhex [ $ i ] . $ nhex [ $ i + 1 ] ) ) ; } ... | Generate v3 UUID |
53,899 | public static function create ( $ length = 6 , $ numbers = true , $ letters = false , $ capitals = false , $ symbols = false ) { if ( false === ( '-' . intval ( $ length ) == '-' . $ length ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ... | Create random token |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.