idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
234,700 | protected function getElementErrorsHelper ( ) { if ( $ this -> elementErrorsHelper ) { return $ this -> elementErrorsHelper ; } if ( method_exists ( $ this -> view , 'plugin' ) ) { $ this -> elementErrorsHelper = $ this -> view -> plugin ( 'bootstrap_form_element_errors' ) ; } if ( ! $ this -> elementErrorsHelper insta... | Retrieve the FormElementErrors helper |
234,701 | function database ( $ params = '' , $ return = TRUE ) { $ O = & get_instance ( ) ; if ( class_exists ( 'O_Db_driver' ) and $ return === FALSE and isset ( $ O -> db ) and is_object ( $ O -> db ) ) { throw new \ Zanda \ Orgasm \ Fatal ( 'Untuk sambungan ke database tambahan, harus menambahkan parameter $return bernilai T... | default kalo ada pangge ini berarti koneksi tambahan |
234,702 | public function map ( callable $ callback ) : Collection { $ result = array_map ( $ callback , array_keys ( $ this -> _data ) , $ this -> _data ) ; return new static ( $ result ) ; } | Maps the array and returns a new object of this class . |
234,703 | public function walk ( callable $ callback ) : void { $ newData = [ ] ; foreach ( $ this -> _data as $ key => $ value ) { $ ret = $ callback ( $ key , $ value ) ; $ newData [ $ ret [ 0 ] ] = $ ret [ 1 ] ; } $ this -> _data = $ newData ; } | Walks through the array . |
234,704 | public function accumulate ( callable $ callback , $ accumulator = "" ) { foreach ( $ this -> _data as $ key => $ value ) { $ accumulator = $ callback ( $ key , $ value , $ accumulator ) ; } return $ accumulator ; } | Performs a array_reduce action with the array . |
234,705 | public function combine ( $ arr ) : Collection { if ( $ arr instanceof Collection ) { $ arr = $ arr -> getAll ( ) ; } if ( ! is_array ( $ arr ) ) { return new static ( [ ] ) ; } return new static ( array_combine ( $ this -> _data , $ arr ) ) ; } | Combines this and another array and returns a new object . |
234,706 | public function append ( $ arr ) : void { if ( $ arr instanceof Collection ) { $ arr = $ arr -> getAll ( ) ; } if ( ! is_array ( $ arr ) ) { return ; } foreach ( $ arr as $ key => $ value ) { $ this -> _data [ $ key ] = $ value ; } } | Appends the contents of an array to this array . |
234,707 | public function valueExists ( $ value , bool $ strict = true ) : bool { foreach ( $ this -> _data as $ data ) { $ ret = ( $ strict ) ? ( $ data === $ value ) : ( $ data == $ value ) ; if ( $ ret ) { return true ; } } return false ; } | Checks that a value exists in the array . |
234,708 | public function deleteByValue ( $ value , bool $ strict = true ) : void { foreach ( $ this -> _data as $ data ) { $ exists = ( $ strict ) ? ( $ data === $ value ) : ( $ data == $ value ) ; if ( $ exists ) { unset ( $ this -> _data [ $ value ] ) ; } } } | Deletes an index in the array by its value . |
234,709 | protected function prepareRequestMediaVersionFromUrl ( ) { $ this -> prepareRequestMediaVersionFromUrlQueryString ( ) ; if ( $ this -> requestMediaSiteVersion === NULL && $ this -> anyRoutesConfigured ) $ this -> prepareRequestMediaVersionFromUrlPath ( ) ; if ( $ this -> requestMediaSiteVersion === NULL ) $ this -> req... | Try to set up into \ MvcCore \ Request object new media site version detected from requested url by url query string param or by url path prefix . If there is caught any valid media site version - set this value into request object . If there is nothing caught set into request object full media site version anyway . |
234,710 | protected function prepareRequestMediaVersionFromUrlPath ( ) { $ requestPath = $ this -> request -> GetPath ( TRUE ) ; $ requestPathExploded = explode ( '/' , trim ( $ requestPath , '/' ) ) ; $ requestPathFirstPart = mb_strtolower ( $ requestPathExploded [ 0 ] ) ; foreach ( $ this -> allowedMediaVersionsAndUrlValues as... | Try to set up media site version from request path as request media site version . If there is any request path detected remove media site version from request path and store detected media site version in local context . |
234,711 | public function getContentsByAttr ( $ attr , $ attr_value ) { $ nodes = $ this -> _dom_x_path -> query ( "//*[contains(@{$attr}, '{$attr_value}')]" ) ; $ contents = [ ] ; foreach ( $ nodes as $ node ) { array_push ( $ contents , $ node -> nodeValue ) ; } return $ contents ; } | Get contents of an element by using attributes |
234,712 | public function getContentsByElem ( $ elem ) { $ nodes = $ this -> _dom_x_path -> query ( "//$elem" ) ; $ contents = [ ] ; foreach ( $ nodes as $ node ) { array_push ( $ contents , $ node -> nodeValue ) ; } return $ contents ; } | Get contents of an element by using element name |
234,713 | public function getAttrByAttr ( $ attr , $ attr_value , $ attr_to_get ) { $ nodes = $ this -> _dom_x_path -> query ( "//*[contains(@{$attr}, '{$attr_value}')]" ) ; $ contents = [ ] ; foreach ( $ nodes as $ node ) { array_push ( $ contents , $ node -> getAttribute ( $ attr_to_get ) ) ; } return $ contents ; } | Get attribute value using other attributes |
234,714 | public function getAttrByElem ( $ element ) { $ nodes = $ this -> _dom_x_path -> query ( "//{$element}" ) ; $ contents = [ ] ; $ attrs = [ ] ; foreach ( $ nodes as $ node ) { $ attrs = [ ] ; foreach ( $ node -> attributes as $ attr ) { $ attrs [ "{$attr->nodeName}" ] = $ attr -> nodeValue ; } array_push ( $ contents , ... | Get attributes of elements |
234,715 | public static function create ( $ id = null , $ level = false , $ forceActiveMenu = null , $ decorator = null , $ renderArgs = null ) { return new static ( $ id , $ level , $ forceActiveMenu , $ decorator , $ renderArgs ) ; } | convenience method to allow chaining |
234,716 | protected function completeMenu ( Menu $ m ) { if ( $ m -> getType ( ) === 'dynamic' ) { Application :: getInstance ( ) -> getService ( $ m -> getServiceId ( ) ) -> appendMenuEntries ( $ m ) ; } foreach ( $ m -> getEntries ( ) as $ entry ) { if ( ( $ m = $ entry -> getSubMenu ( ) ) ) { $ this -> completeMenu ( $ m ) ; ... | walk the menu tree and invoke service to append dynamic menu entries |
234,717 | protected function clearSelectedMenuEntries ( Menu $ menu ) { while ( ( $ e = $ menu -> getSelectedEntry ( ) ) ) { if ( $ menu -> getType ( ) == 'static' ) { $ menu -> clearSelectedEntry ( ) ; } if ( ! ( $ menu = $ e -> getSubMenu ( ) ) ) { break ; } } } | walks menu tree and clears all previously selected entries |
234,718 | protected function authenticateMenu ( Menu $ menu ) { if ( ! self :: $ authenticator ) { self :: $ authenticator = new DefaultMenuAuthenticator ( ) ; } return self :: $ authenticator -> authenticate ( $ menu , Application :: getInstance ( ) -> getCurrentUser ( ) ) ; } | authenticates the complete menu invokes a previously set authenticator class or falls back to a default menu authenticator |
234,719 | final public function curlSetOpt ( $ opt , $ value ) { if ( is_string ( $ opt ) ) { $ opt = 'CURLOPT_' . strtoupper ( $ opt ) ; if ( defined ( $ opt ) ) { $ opt = constant ( $ opt ) ; curl_setopt ( $ this -> curl_handle , $ opt , $ value ) ; } else { throw new \ InvalidArgumentException ( sprintf ( '%s is not a valid c... | Set an option for a cURL transfer |
234,720 | final public function curlSetOptArray ( array $ options = array ( ) ) { $ this -> curlFilterOpts ( $ options ) ; curl_setopt_array ( $ this -> curl_handle , $ options ) ; return $ this ; } | Set multiple options for a cURL transfer |
234,721 | final public function curlFileCreate ( $ filename , $ mimetype = null , $ postname = null ) { $ file = new \ CURLFile ( $ fname , $ mime , $ name ) ; return [ $ file -> getPostFilename ( ) , $ file ] ; } | Can be used to upload a file with CURLOPT_POSTFIELDS . |
234,722 | public function load ( $ className ) { $ name = $ className ; if ( $ this -> _nameSpace ) { $ ns = rtrim ( $ this -> _nameSpace , '\\' ) . '\\' ; $ nameLen = strlen ( $ className ) ; $ nsLen = strlen ( $ ns ) ; if ( $ nameLen < $ nsLen || substr ( $ className , 0 , $ nsLen ) !== $ ns ) return false ; $ name = substr ( ... | Loads a class based on its class name If it s not found it s simply ignored in order to let another loader try to load it If it s the only loader an error will be thrown after a failed loading |
234,723 | public function setVersion ( $ version ) { $ version = strtolower ( strval ( $ version ) ) ; if ( ! self :: isValid ( $ version ) ) { $ version = self :: DEFAULT_UNRESOLVED_VERSION ; } $ this -> numbers = self :: parse ( $ version ) ; $ this -> version = $ version ; return $ this ; } | Set current version |
234,724 | public function compareTo ( $ version ) { $ cmp = self :: parse ( $ version ) ; $ result = $ this -> cmp ( $ cmp , $ this -> numbers ) ; if ( $ result === 0 ) { $ result = $ this -> cmp ( $ this -> numbers , $ cmp ) ; $ result = - $ result ; } else { return $ result ; } return $ result ; } | Compare current version to given version and return - 1 if current is less and + 1 if current version is greater than given version |
234,725 | public static function parse ( $ version ) { $ nums = explode ( self :: DELIMITER , $ version ) ; $ numbers = array ( ) ; foreach ( $ nums as $ num ) { if ( preg_match ( '/^0*([0-9]+)/' , $ num , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { $ numbers [ ] = $ matches [ 1 ] ; } else { $ numbers [ ] = 0 ; } } else {... | Parse array of integers based on version number |
234,726 | public static function isValid ( $ version ) { if ( self :: isDev ( $ version ) ) { return true ; } else { return ( boolean ) preg_match ( '/' . self :: $ validPattern . '/i' , $ version ) ; } } | Test if version is valid |
234,727 | public function getOutputTypeOptions ( $ input_type ) { if ( ! in_array ( $ input_type , $ this -> types ) ) { $ input_type = $ this -> default_type ; } return $ this -> map [ $ input_type ] ; } | Get OutputTypeOptions for given input type |
234,728 | public function setOutputTypeOptions ( $ input_type , OutputTypeOptionsInterface $ options ) { $ this -> map [ $ input_type ] = $ options ; $ this -> types = array_keys ( $ this -> map ) ; return $ this ; } | Set an OutputTypeOptionsInterface object for a given input type |
234,729 | protected function getHelpers ( ) { $ cdnRoot = eden ( 'block' ) -> getAssetRoot ( ) ; $ language = eden ( 'block' ) -> getLanguage ( ) ; return array ( 'cdn' => function ( ) use ( $ cdnRoot ) { echo $ cdnRoot ; } , '_' => function ( $ key ) use ( $ language ) { if ( $ language instanceof Eden \ Language \ Base ) { ech... | Returns helper methods |
234,730 | public static function init ( $ time = null ) { try { $ interval = new self ( $ time ) ; return $ interval ; } catch ( \ Exception $ e ) { return null ; } } | Standard initalise . Useful for array_map |
234,731 | 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? |
234,732 | 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 |
234,733 | 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 . |
234,734 | public function get ( $ name ) { $ this -> toString = isset ( $ _COOKIE [ $ name ] ) ? $ _COOKIE [ $ name ] : "" ; return new InputUtilities ( $ this -> toString ) ; } | Get cookie value . |
234,735 | public function delete ( $ name ) { $ this -> func = function ( ) use ( $ name ) { setcookie ( $ name , null , 0 ) ; return $ name ; } ; return new CookieFlush ( $ this -> func ) ; } | Delete cookie . |
234,736 | 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 . |
234,737 | 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 . |
234,738 | 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 . |
234,739 | 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 . |
234,740 | 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 . |
234,741 | 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 . |
234,742 | 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 . |
234,743 | 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 |
234,744 | 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 . |
234,745 | 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 . |
234,746 | public function getCompiledFilenameFromClassname ( $ fqcn ) { $ filename = $ this -> templateCompileDirectory . '/' . $ fqcn . '.php' ; $ filename = str_replace ( '\\' , '/' , $ filename ) ; return $ filename ; } | Returns the fully pathed filename for a compiled class . |
234,747 | 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 .. |
234,748 | 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 |
234,749 | 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 . |
234,750 | 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 |
234,751 | 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 |
234,752 | 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 |
234,753 | 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 . |
234,754 | 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 . |
234,755 | 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 . |
234,756 | 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 . |
234,757 | 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 . |
234,758 | public function extractRoles ( GroupMembershipInterface $ membership ) { $ roles = [ ] ; foreach ( $ membership -> getRoles ( ) as $ role ) { $ roles [ ] = new Role ( $ role ) ; } return $ roles ; } | Returns the roles for this membership . |
234,759 | 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 . |
234,760 | protected function getTagClassNames ( ) { $ tags = array_map ( function ( $ tag ) { return slugify ( $ tag ) ; } , explode ( '|' , $ this -> get ( 'tags' ) ) ) ; return implode ( ' ' , $ tags ) ; } | Get human readable tags . |
234,761 | 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 ; |
234,762 | 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 . |
234,763 | 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 . |
234,764 | 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 . |
234,765 | 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 . |
234,766 | 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 . |
234,767 | 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 . |
234,768 | 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 . |
234,769 | 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 . |
234,770 | 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 |
234,771 | public function isValid ( ) { return $ this -> getID ( ) != null && $ this -> getURL ( ) != null && $ this -> getLocalPath ( ) != null ; } | Determines if this is a valid file object or not . |
234,772 | 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 . |
234,773 | 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 |
234,774 | 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 |
234,775 | 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 |
234,776 | 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 |
234,777 | public function getLevel ( ) { if ( $ this -> level === null ) { $ this -> level = count ( $ this -> getAncestors ( ) ) ; } return $ this -> level ; } | gets the level of this node |
234,778 | 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 |
234,779 | 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 |
234,780 | 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 |
234,781 | 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 |
234,782 | 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 |
234,783 | 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 . |
234,784 | 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 |
234,785 | 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 |
234,786 | 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 |
234,787 | 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 |
234,788 | 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 |
234,789 | public function write ( ) { if ( $ this -> rotationInterval and $ this -> rotationTimer < time ( ) ) { $ this -> rotate ( ) ; } return $ this -> driver -> write ( ) ; } | Writes the container data to the session store |
234,790 | public function stop ( ) { if ( $ this -> rotationInterval and $ this -> rotationTimer < time ( ) ) { $ this -> rotate ( ) ; } return $ this -> driver -> stop ( ) ; } | Stops a session |
234,791 | 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 |
234,792 | 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 |
234,793 | public function setFlashNamespace ( $ name ) { $ this -> config [ 'flash_namespace' ] = ( string ) $ name ; $ this -> flash -> setNamespace ( $ this -> config [ 'flash_namespace' ] ) ; } | Sets the session flash namespace |
234,794 | 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 |
234,795 | 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 . |
234,796 | 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 . |
234,797 | 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 . |
234,798 | 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 . |
234,799 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.