idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
44,600 | public function getSection ( $ section , $ default = - 1 ) { if ( isset ( $ this -> config [ $ section ] ) ) { return $ this -> config [ $ section ] ; } if ( $ default !== - 1 ) { return $ default ; } $ defaultClass = new \ ReflectionClass ( DefaultConfiguration :: class ) ; return $ defaultClass -> getStaticPropertyValue ( $ section , null ) ; } | Get the whole set of the configuration section . |
44,601 | public function add ( $ section , $ config = array ( ) ) { if ( ! isset ( $ this -> config [ $ section ] ) ) { $ this -> config [ $ section ] = array ( ) ; } $ this -> config [ $ section ] = array_merge ( $ this -> config [ $ section ] , $ config ) ; } | Add section data to the configuration . |
44,602 | private function doGetSection ( $ section ) { return isset ( $ this -> config [ $ section ] ) ? $ this -> config [ $ section ] : null ; } | Get section configuration data . |
44,603 | protected function prepare ( ) { $ request = & $ this -> request ; $ request -> SetOriginalPath ( $ request -> GetPath ( TRUE ) ) ; $ this -> isGet = $ request -> GetMethod ( ) == \ MvcCore \ IRequest :: METHOD_GET ; $ this -> requestGlobalGet = array_merge ( [ ] , $ request -> GetGlobalCollection ( 'get' ) ) ; $ this -> setUpSession ( ) ; if ( isset ( $ this -> requestGlobalGet [ static :: $ adminRequestQueryParamName ] ) ) { $ authClass = static :: $ baseAuthClass ; if ( class_exists ( $ authClass ) ) { $ user = $ authClass :: GetInstance ( ) -> GetUser ( ) ; if ( $ user !== NULL ) $ this -> adminRequest = TRUE ; } } } | Prepare extended router media site version or localization processing . |
44,604 | protected function setUpSession ( ) { if ( $ this -> session === NULL ) { $ sessionClass = $ this -> application -> GetSessionClass ( ) ; $ selfClass = version_compare ( PHP_VERSION , '5.5' , '>' ) ? self :: class : __CLASS__ ; $ this -> session = $ sessionClass :: GetNamespace ( $ selfClass ) ; $ this -> session -> SetExpirationSeconds ( $ this -> sessionExpirationSeconds ) ; } } | If session namespace by this class is not initialized initialize session namespace under this class name and move expiration to configured value . |
44,605 | private function register ( Entity $ meta , Repository $ repository ) : self { $ this -> repositories = $ this -> repositories -> put ( $ meta , $ repository ) ; return $ this ; } | Register a new repository instance |
44,606 | public function addParser ( SymbolParserInterface $ parser ) { if ( $ parser instanceof self ) { $ this -> addParsers ( $ parser -> parsers ) ; } else { $ this -> parsers [ ] = $ parser ; } return $ this ; } | Adds a Parser to the chain . |
44,607 | public static function set ( $ var , $ value ) { Session :: init ( true ) ; if ( ! Session :: check_checksum ( ) ) return false ; $ _SESSION [ $ var ] = $ value ; $ _SESSION [ __SESSION_checksum_var ] = Session :: make_checksum ( ) ; return $ value ; } | Nastavi session premennu |
44,608 | public static function _unset ( $ var ) { Session :: init ( true ) ; if ( ! Session :: check_checksum ( ) ) return false ; unset ( $ _SESSION [ $ var ] ) ; $ _SESSION [ __SESSION_checksum_var ] = Session :: make_checksum ( ) ; return true ; } | Odstrani session premennu |
44,609 | private static function make_checksum ( ) { $ ret = "" ; $ _SESSION [ __SESSION_time_var ] = \ AsyncWeb \ Date \ Time :: get ( ) ; if ( isset ( $ _SESSION ) && is_array ( $ _SESSION ) ) foreach ( $ _SESSION as $ s => $ v ) { if ( $ s != __SESSION_checksum_var ) { $ ret = md5 ( $ ret . $ s ) ; } } Session :: $ checksum = $ ret ; return $ ret ; } | Vytvori md5 session checksum |
44,610 | private function validateIsbn10 ( ) : bool { $ value = \ str_replace ( [ '-' , ' ' ] , '' , $ this -> value ) ; if ( ! \ preg_match ( $ this -> patterns [ 'isbn10-basic' ] , $ value ) ) { $ this -> setError ( self :: VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT ) ; return false ; } $ sum = 0 ; for ( $ i = 0 ; $ i < 9 ; $ i ++ ) { $ sum += ( 10 - $ i ) * $ value { $ i } ; } $ checksum = 11 - ( $ sum % 11 ) ; if ( $ checksum == 11 ) { $ checksum = '0' ; } elseif ( $ checksum == 10 ) { $ checksum = 'X' ; } $ isValid = \ substr ( $ value , - 1 ) == $ checksum ? true : false ; if ( ! $ isValid ) { $ this -> setError ( self :: VALIDATOR_ERROR_ISBN_INVALID_NUMBER ) ; } return $ isValid ; } | Validates ISBN - 10 number |
44,611 | private function validateAuto ( ) : bool { if ( \ preg_match ( $ this -> patterns [ 'isbn13-basic' ] , $ this -> value ) ) { return $ this -> validateIsbn13 ( ) ; } if ( \ preg_match ( $ this -> patterns [ 'isbn13-separated' ] , $ this -> value ) && \ strlen ( $ this -> value ) == 17 ) { return $ this -> validateIsbn13 ( ) ; } if ( \ preg_match ( $ this -> patterns [ 'isbn10-basic' ] , $ this -> value ) ) { return $ this -> validateIsbn10 ( ) ; } if ( \ preg_match ( $ this -> patterns [ 'isbn10-separated' ] , $ this -> value ) && \ strlen ( $ this -> value ) == 13 ) { return $ this -> validateIsbn10 ( ) ; } $ this -> setError ( self :: VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT ) ; return false ; } | Validates ISBN number with auto format detection |
44,612 | public function logException ( \ Exception $ e ) { $ error = $ e -> getMessage ( ) . $ e -> getTraceAsString ( ) ; return $ this -> logEmergency ( $ error ) ; } | Logs an exeption |
44,613 | public static function Utcut1 ( $ utc1 , $ utc2 , $ dut1 , & $ ut11 , & $ ut12 ) { $ iy ; $ im ; $ id ; $ js ; $ jw ; $ w ; $ dat ; $ dta ; $ tai1 ; $ tai2 ; if ( IAU :: Jd2cal ( $ utc1 , $ utc2 , $ iy , $ im , $ id , $ w ) ) return - 1 ; $ js = IAU :: Dat ( $ iy , $ im , $ id , 0.0 , $ dat ) ; if ( $ js < 0 ) return - 1 ; $ dta = $ dut1 - $ dat ; $ jw = IAU :: Utctai ( $ utc1 , $ utc2 , $ tai1 , $ tai2 ) ; if ( $ jw < 0 ) { return - 1 ; } else if ( $ jw > 0 ) { $ js = $ jw ; } if ( IAU :: Taiut1 ( $ tai1 , $ tai2 , $ dta , $ ut11 , $ ut12 ) ) return - 1 ; return $ js ; } | - - - - - - - - - - i a u U t c u t 1 - - - - - - - - - - |
44,614 | public function validateByOnlyOne ( $ nodeType , TreeInterface $ tree ) { if ( ! $ nodeType ) { return true ; } $ config = $ this -> getNodeTypeConfig ( $ nodeType ) ; if ( null === $ config ) { return false ; } if ( $ config -> isOnlyOne ( ) ) { return ! in_array ( $ nodeType , $ this -> nodeManager -> findExistingNodeTypes ( $ tree ) ) ; } return true ; } | Validate by only one . |
44,615 | public function validateByParent ( $ nodeType , NodeInterface $ parent = null ) { if ( ! $ nodeType ) { return true ; } $ config = $ this -> getNodeTypeConfig ( $ nodeType ) ; if ( null === $ config ) { return false ; } if ( ( null !== $ parent ) && $ parent -> getType ( ) ) { return in_array ( $ parent -> getType ( ) , $ config -> getParentTypes ( ) ) ; } return false ; } | Validate by parent . |
44,616 | public function filterEmptyLines ( array $ lines ) { return array_filter ( $ lines , function ( $ line ) { $ line = trim ( $ line ) ; return $ line !== '*' ? $ line : false ; } ) ; } | filter lines if they empty |
44,617 | public function createForClasses ( array $ classNameToFiles ) : array { $ definitionCollection = [ ] ; foreach ( $ classNameToFiles as $ className => $ file ) { $ definitionCollection [ $ className ] = $ this -> collectDefinitionsForClass ( $ className , $ file ) ; } return $ definitionCollection ; } | Create the test definitions for the given classes |
44,618 | public function createForDocumentation ( array $ files ) : array { if ( in_array ( Constants :: TEST_TYPE_DOCUMENTATION , $ this -> types ) ) { $ definitions = [ ] ; foreach ( $ files as $ file ) { $ key = $ this -> getTestGroupNameForDocumentationFile ( $ file ) ; $ definitions [ $ key ] = $ this -> collectDefinitionsForFile ( $ file ) ; } return $ definitions ; } return [ ] ; } | Create the test definitions for the given documentation files |
44,619 | protected function nodeToString ( string $ indent = '' ) : string { $ str = $ indent . "--{$this->getName()}--\n" ; foreach ( $ this -> getChildren ( ) as $ child ) { $ str .= $ child -> nodeToString ( $ indent . ' ' ) ; } return $ str ; } | Transforms the instance and its children into a string representation . |
44,620 | public function renderTable ( \ Twig_Environment $ env , $ args = array ( ) ) { $ array = array ( ) ; $ config = $ this -> fillModel ( $ array ) ; $ array [ 'deleteUrl' ] = $ this -> fetchUrl ( $ args , 'delete' , $ config -> getDeleteRoute ( ) ) ; $ array [ 'tableId' ] = $ config -> getId ( ) ; $ array [ 'transScope' ] = $ config -> getTransScope ( ) ; $ array [ 'views' ] = $ config -> getViews ( ) ; $ array [ 'frontendFramework' ] = $ config -> getFrontendFramework ( ) ; $ array [ 'frontendFrameworkName' ] = FrontendFramework :: toString ( $ config -> getFrontendFramework ( ) ) ; return $ this -> render ( $ env , 'twentystepsAutoTablesBundle:AutoTablesExtension:autoTable.html.twig' , $ array ) ; } | Prints a table with the given entities . |
44,621 | public function renderTableJs ( \ Twig_Environment $ env , $ args = array ( ) ) { $ array = array ( ) ; $ config = $ this -> fillModel ( $ array ) ; $ array [ 'updateUrl' ] = $ this -> fetchUrl ( $ args , 'update' , $ config -> getUpdateRoute ( ) ) ; $ array [ 'deleteUrl' ] = $ this -> fetchUrl ( $ args , 'delete' , $ config -> getDeleteRoute ( ) ) ; $ array [ 'addUrl' ] = $ this -> fetchUrl ( $ args , 'add' , $ config -> getAddRoute ( ) ) ; $ array [ 'dtDefaultOpts' ] = $ this -> container -> getParameter ( 'twentysteps_auto_tables.default_datatables_options' ) ; $ array [ 'dtOpts' ] = $ config -> getDataTablesOptions ( ) ; $ array [ 'dtTagOpts' ] = $ this -> getParameter ( $ args , 'dtOptions' , array ( ) ) ; $ array [ 'tableId' ] = $ config -> getId ( ) ; $ array [ 'transScope' ] = $ config -> getTransScope ( ) ; $ array [ 'reloadAfterAdd' ] = $ this -> getParameter ( $ args , 'reloadAfterAdd' , true ) ; $ array [ 'reloadAfterUpdate' ] = $ this -> getParameter ( $ args , 'reloadAfterUpdate' , false ) ; $ array [ 'includeJavascript' ] = $ this -> checkIncludeJavascript ( ) ; $ array [ 'includeBootstrap3' ] = $ this -> getParameter ( $ args , 'includeBootstrap3' , false ) ; $ array [ 'includeJquery' ] = $ this -> getParameter ( $ args , 'includeJquery' , FALSE ) ; $ array [ 'includeJqueryUi' ] = $ this -> getParameter ( $ args , 'includeJqueryUi' , $ config -> getFrontendFramework ( ) == FrontendFramework :: JQUERY_UI ) ; $ array [ 'includeJqueryEditable' ] = $ this -> getParameter ( $ args , 'includeJqueryEditable' , TRUE ) ; $ array [ 'includeJqueryEditableDatePicker' ] = $ this -> getParameter ( $ args , 'includeJqueryEditableDatePicker' , $ config -> getFrontendFramework ( ) == FrontendFramework :: JQUERY_UI ) ; $ array [ 'includeJqueryEditableBootstrapDatePicker' ] = $ this -> getParameter ( $ args , 'includeJqueryEditableBootstrapDatePicker' , $ config -> getFrontendFramework ( ) == FrontendFramework :: BOOTSTRAP3 ) ; $ array [ 'includeJqueryDataTables' ] = $ this -> getParameter ( $ args , 'includeJqueryDataTables' , TRUE ) ; $ array [ 'includeJqueryValidate' ] = $ this -> getParameter ( $ args , 'includeJqueryValidate' , TRUE ) ; $ array [ 'useJqueryUi' ] = $ config -> getFrontendFramework ( ) == FrontendFramework :: JQUERY_UI ; $ array [ 'useBootstrap' ] = $ config -> getFrontendFramework ( ) == FrontendFramework :: BOOTSTRAP3 ; return $ this -> render ( $ env , 'twentystepsAutoTablesBundle:AutoTablesExtension:autoTableJs.html.twig' , $ array ) ; } | Prints the JavaScript code needed for the datatables of the given entities . |
44,622 | public function renderStylesheets ( \ Twig_Environment $ env , $ args = array ( ) ) { $ frontendFramework = $ this -> fetchAutoTablesGlobalConfiguration ( ) -> getFrontendFramework ( ) ; return $ this -> render ( $ env , 'twentystepsAutoTablesBundle:AutoTablesExtension:autoTableStylesheets.html.twig' , array ( 'includeJqueryUi' => $ this -> getParameter ( $ args , 'includeJqueryUi' , $ frontendFramework == FrontendFramework :: JQUERY_UI ) , 'includeBootstrap3' => $ this -> getParameter ( $ args , 'includeBootstrap3' , false ) ) ) ; } | Renders the needed JavaScript and stylesheet includes . |
44,623 | public function defineOptions ( \ Twig_Environment $ env , $ args ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( $ request ) { $ config = $ this -> fetchAutoTablesConfiguration ( $ args ) ; $ entities = $ this -> entityInspectionService -> parseEntities ( $ this -> getParameter ( $ args , 'entities' , array ( ) ) , $ config ) ; $ request -> attributes -> set ( 'tsAutoTablesConfig' , $ config ) ; $ request -> attributes -> set ( 'tsAutoTablesEntities' , $ entities ) ; $ request -> attributes -> set ( 'tsAutoTablesEntityDescriptor' , $ this -> entityInspectionService -> fetchEntityDescriptor ( $ config ) ) ; } return '' ; } | Define options to be used for ts_auto_table and ts_auto_table_js . |
44,624 | private function checkIncludeJavascript ( ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ rtn = ! $ request -> attributes -> has ( $ this :: JS_INCLUDE_KEY ) ; if ( ! $ rtn ) { $ request -> attributes -> set ( $ this :: JS_INCLUDE_KEY , true ) ; } return $ rtn ; } | Determines whether we have to include the javascript files . |
44,625 | public function getCategoriesPlain ( ) : Collection { static $ categories ; if ( $ categories ) { return $ categories ; } $ categories = [ ] ; $ languages = TransHelper :: getAllLanguages ( ) ; foreach ( Category :: all ( ) as $ category ) { $ categoryData = [ 'id' => $ category -> id , 'parent_id' => $ category -> parent_id , 'slugs' => [ ] , ] ; foreach ( $ languages as $ language ) { $ translation = $ category -> translations -> where ( 'locale' , $ language -> iso_code ) -> first ( ) ; $ slug = object_get ( $ translation , 'slug' ) ; $ categoryData [ 'slugs' ] [ $ language -> iso_code ] = $ slug ; } $ categories [ ] = $ categoryData ; } $ categories = collect ( $ categories ) ; return $ categories ; } | Get plain categories Used to build full slugs without querying the database |
44,626 | public function replaceElementUsingLink ( $ execMethod , $ args = [ ] , $ targetDiv , $ linkText , $ anchorAttrs = [ ] ) { $ url = $ this -> url ( $ execMethod , $ args , true ) ; $ attrs = [ ] ; foreach ( $ anchorAttrs as $ k => $ v ) { $ attrs [ ] = "{$k}='{$v}'" ; } $ attrsStr = implode ( ' ' , $ attrs ) ; return <<<EOS <script type="application/javascript"> if( typeof(execLink) != "function" ){ var execLink = function( url, targetDiv ){ // Send the data using post var posting = $.get( url, $( form ).serialize() ); // Put the results in a div posting.done(function( data ) { $( "#"+targetDiv ).replaceWith( data ); $("body").css("cursor", "default"); }); // Show optional progress $("body").css("cursor", "progress"); } } </script> <a href="#" onclick="execLink( '{$url}', '{$targetDiv}' ); return false;" {$attrsStr}>{$linkText}</a>EOS ; } | Generate a link which replaces the content of a DOM element with the output of an exec method |
44,627 | public function send ( $ to ) { $ message = Swift_Message :: newInstance ( $ this -> subject ) -> setFrom ( array ( MAIL_USERNAME => 'View Tuber' ) ) -> setTo ( $ to ) -> setBody ( $ this -> body ) ; if ( $ this -> mailer -> send ( $ message ) ) { echo 'Sent' ; } else { echo 'Failed' ; } } | Sends mail . |
44,628 | public function loadYmlFile ( $ fileName , $ path ) { $ configDirectories = array ( ( $ path != null ) ? $ path : $ this -> rootDir ) ; $ locator = new FileLocator ( $ configDirectories ) ; $ ymlFile = $ locator -> locate ( $ fileName , null , true ) ; $ ymlDatas = Yaml :: parse ( $ ymlFile ) ; $ dataArray = array ( ) ; foreach ( $ ymlDatas as $ key => $ data ) { $ dataArray [ $ key ] = array_merge ( $ data ) ; } return $ dataArray ; } | Load a yml file and return an array of the data ordered by keys |
44,629 | public function beforeSelect ( Select $ event ) { if ( $ this -> isLazyLoaded ( ) ) { return ; } $ fields = $ this -> getFieldsPrefixed ( ) ; $ table = $ this -> entityDescriptor -> getTableName ( ) ; $ relateTable = $ this -> getParentTableName ( ) ; $ pmk = $ this -> getParentPrimaryKey ( ) ; $ onClause = "{$table}.{$this->getForeignKey()} = " . "{$relateTable}.{$pmk}" ; $ query = $ event -> getQuery ( ) ; $ query -> join ( $ relateTable , $ onClause , $ fields , $ relateTable ) ; } | Handles the before select callback |
44,630 | public function afterSelect ( Select $ event ) { if ( $ this -> isLazyLoaded ( ) ) { return ; } foreach ( $ event -> getEntityCollection ( ) as $ index => $ entity ) { $ row = $ event -> getData ( ) [ $ index ] ; $ entity -> { $ this -> propertyName } = $ this -> getFromMap ( $ row ) ; } } | Handles the after select callback |
44,631 | protected function getFieldsPrefixed ( ) { $ table = $ this -> getParentTableName ( ) ; $ data = [ ] ; foreach ( $ this -> getParentFields ( ) as $ field ) { $ data [ ] = "{$field->getField()} AS " . "{$table}_{$field->getField()}" ; } return $ data ; } | Prefixed fields for join |
44,632 | protected function map ( $ dataRow ) { $ data = $ this -> getData ( $ dataRow ) ; $ pmk = $ this -> getParentPrimaryKey ( ) ; $ entity = ( isset ( $ data [ $ pmk ] ) && $ data [ $ pmk ] ) ? $ this -> getParentEntityMapper ( ) -> createFrom ( $ data ) : null ; return null == $ entity ? null : $ this -> registerEntity ( $ entity ) ; } | Creates and maps related entity |
44,633 | protected function getData ( $ dataRow ) { $ data = [ ] ; $ relateTable = $ this -> getParentTableName ( ) ; $ regexp = "/{$relateTable}_(?P<name>.+)/i" ; foreach ( $ dataRow as $ field => $ value ) { if ( preg_match ( $ regexp , $ field , $ matched ) ) { $ data [ $ matched [ 'name' ] ] = $ value ; } } return $ data ; } | Gets a data array with fields and values for parent entity creation |
44,634 | public function setUser ( $ user ) { $ regex = '`^' . self :: $ _regexUser . '$`i' ; if ( preg_match_all ( $ regex , $ user , $ matches ) !== 1 ) { throw new InvalidArgumentException ( 'User must match ' . $ regex ) ; } $ this -> _user = $ user ; } | Set the user for this URL . |
44,635 | public function setHost ( $ host ) { if ( ! ( self :: _isHostname ( $ host ) || self :: _isIpAddress ( $ host ) ) ) { throw new InvalidArgumentException ( "Invalid host ($host)" ) ; } $ this -> _host = strtolower ( trim ( $ host ) ) ; } | Sets the host for this URL . |
44,636 | public function setQueryVariables ( $ array ) { if ( ! is_array ( $ array ) ) { throw new InvalidArgumentException ( 'Must pass an array to setQueryVariables()' ) ; } $ parts = array ( ) ; foreach ( $ array as $ name => $ value ) { $ name = urlencode ( $ name ) ; if ( ! is_null ( $ value ) ) { $ parts [ ] = $ name . '=' . urlencode ( $ value ) ; } else { $ parts [ ] = $ name ; } } $ this -> setQuery ( implode ( '&' , $ parts ) ) ; } | Sets the query string to the specified variable in the query stsring . |
44,637 | protected function _compareData ( $ dataToCheck , $ key , $ originalData , $ comparator ) { if ( is_callable ( $ dataToCheck ) ) { return call_user_func_array ( $ dataToCheck , [ $ key , $ originalData , $ this ] ) ; } return $ this -> _comparator ( $ originalData , $ dataToCheck , $ comparator ) ; } | compare given data with possibility to use callable functions to check data |
44,638 | public function removeObjectError ( $ key = null ) { $ this -> _genericDestroy ( $ key , 'error_list' ) ; $ this -> _hasErrors = false ; return $ this ; } | remove single error or all object errors |
44,639 | public function serialize ( $ skipObjects = false ) { $ this -> _prepareData ( ) ; $ temporaryData = $ this -> toArray ( ) ; $ data = '' ; if ( $ skipObjects ) { $ temporaryData = $ this -> traveler ( 'self::_skipObject' , null , $ temporaryData , true ) ; } try { $ data = Serializer :: serialize ( $ temporaryData ) ; } catch ( ExceptionInterface $ exception ) { $ this -> _addException ( $ exception ) ; } return $ data ; } | return serialized object data |
44,640 | public function get ( $ key = null ) { $ this -> _prepareData ( $ key ) ; $ data = null ; if ( is_null ( $ key ) ) { $ data = $ this -> _DATA ; } elseif ( array_key_exists ( $ key , $ this -> _DATA ) ) { $ data = $ this -> _DATA [ $ key ] ; } if ( $ this -> _getPreparationOn ) { return $ this -> _dataPreparation ( $ key , $ data , $ this -> _dataRetrieveCallbacks ) ; } return $ data ; } | return data for given key if exist in object or null if key was not found |
44,641 | public function set ( $ key , $ data = null ) { if ( is_array ( $ key ) ) { $ this -> appendArray ( $ key ) ; } else { $ this -> appendData ( $ key , $ data ) ; } return $ this ; } | set some data in object can give pair key = > value or array of keys |
44,642 | public function returnOriginalData ( $ key = null ) { $ this -> _prepareData ( $ key ) ; $ mergedData = array_merge ( $ this -> _DATA , $ this -> _originalDATA ) ; $ data = $ this -> _removeNewKeys ( $ mergedData ) ; if ( array_key_exists ( $ key , $ data ) ) { return $ data [ $ key ] ; } return null ; } | return original data for key before it was changed that method don t handle return data preparation |
44,643 | protected function _comparator ( $ dataOrigin , $ dataCheck , $ operator ) { switch ( $ operator ) { case '===' : return $ dataOrigin === $ dataCheck ; case '!==' : return $ dataOrigin !== $ dataCheck ; case '==' : return $ dataOrigin == $ dataCheck ; case '!=' : case '<>' : return $ dataOrigin != $ dataCheck ; case '<' : return $ dataOrigin < $ dataCheck ; case '>' : return $ dataOrigin > $ dataCheck ; case '<=' : return $ dataOrigin <= $ dataCheck ; case '>=' : return $ dataOrigin >= $ dataCheck ; default : return null ; } } | allow to compare data with given operator |
44,644 | public function destroy ( $ key = null ) { if ( is_null ( $ key ) ) { $ this -> _dataChanged = true ; $ mergedData = array_merge ( $ this -> _DATA , $ this -> _originalDATA ) ; $ this -> _originalDATA = $ this -> _removeNewKeys ( $ mergedData ) ; $ this -> _DATA = [ ] ; } elseif ( array_key_exists ( $ key , $ this -> _DATA ) ) { $ this -> _dataChanged = true ; if ( ! array_key_exists ( $ key , $ this -> _originalDATA ) && ! array_key_exists ( $ key , $ this -> _newKeys ) ) { $ this -> _originalDATA [ $ key ] = $ this -> _DATA [ $ key ] ; } unset ( $ this -> _DATA [ $ key ] ) ; } return $ this ; } | destroy key entry in object data or whole keys automatically set data to original array |
44,645 | public function restore ( $ key = null ) { if ( is_null ( $ key ) ) { $ mergedData = array_merge ( $ this -> _DATA , $ this -> _originalDATA ) ; $ this -> _DATA = $ this -> _removeNewKeys ( $ mergedData ) ; $ this -> _dataChanged = false ; $ this -> _newKeys = [ ] ; } else { if ( array_key_exists ( $ key , $ this -> _originalDATA ) ) { $ this -> _DATA [ $ key ] = $ this -> _originalDATA [ $ key ] ; } } return $ this ; } | replace changed data by original data set data changed to false only if restore whole data |
44,646 | public function toString ( $ separator = null ) { if ( ! is_null ( $ separator ) ) { $ this -> _separator = $ separator ; } $ this -> _prepareData ( ) ; return $ this -> __toString ( ) ; } | return object as string each data value separated by coma |
44,647 | public function toXml ( $ addCdata = true , $ dtd = false , $ version = '1.0' ) { $ this -> _prepareData ( ) ; $ xml = new Xml ( [ 'version' => $ version ] ) ; $ root = $ xml -> createElement ( 'root' ) ; $ xml = $ this -> _arrayToXml ( $ this -> toArray ( ) , $ xml , $ addCdata , $ root ) ; $ xml -> appendChild ( $ root ) ; if ( $ dtd ) { $ dtd = "<!DOCTYPE root SYSTEM '$dtd'>" ; } $ xml -> formatOutput = true ; $ xmlData = $ xml -> saveXmlFile ( false , true ) ; if ( $ xml -> hasErrors ( ) ) { $ this -> _hasErrors = true ; $ this -> _errorsList [ ] = $ xml -> getError ( ) ; return false ; } return $ dtd . $ xmlData ; } | return object data as xml representation |
44,648 | public function toStdClass ( ) { $ this -> _prepareData ( ) ; $ data = new stdClass ( ) ; foreach ( $ this -> toArray ( ) as $ key => $ val ) { $ data -> $ key = $ val ; } return $ data ; } | return object as stdClass |
44,649 | public function keyDataChanged ( $ key ) { $ data = $ this -> toArray ( $ key ) ; $ originalData = $ this -> returnOriginalData ( $ key ) ; return $ data !== $ originalData ; } | check that data for given key was changed |
44,650 | public function traveler ( $ function , $ methodAttributes = null , $ data = null , $ recursive = false ) { if ( ! $ data ) { $ data = & $ this -> _DATA ; } foreach ( $ data as $ key => $ value ) { $ isRecursive = is_array ( $ value ) && $ recursive ; if ( $ isRecursive ) { $ data [ $ key ] = $ this -> _recursiveTraveler ( $ function , $ methodAttributes , $ value ) ; } else { $ data [ $ key ] = $ this -> _callUserFunction ( $ function , $ key , $ value , $ methodAttributes ) ; } } return $ data ; } | allow to use given method or function for all data inside of object |
44,651 | protected function _recursiveTraveler ( $ function , $ methodAttributes , $ data ) { foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ data [ $ key ] = $ this -> _recursiveTraveler ( $ function , $ methodAttributes , $ value ) ; } else { $ data [ $ key ] = $ this -> _callUserFunction ( $ function , $ key , $ value , $ methodAttributes ) ; } } return $ data ; } | allow to change some data in multi level arrays |
44,652 | protected function _callUserFunction ( $ function , $ key , $ value , $ attributes ) { if ( is_callable ( $ function ) ) { return call_user_func_array ( $ function , [ $ key , $ value , $ this , $ attributes ] ) ; } return $ value ; } | run given function method or closure on given data |
44,653 | public function mergeBlueObject ( Container $ object ) { $ newData = $ object -> toArray ( ) ; foreach ( $ newData as $ key => $ value ) { $ this -> appendData ( $ key , $ value ) ; } $ this -> _dataChanged = true ; return $ this ; } | allow to join two blue objects into one |
44,654 | public function appendJson ( $ data ) { $ jsonData = json_decode ( $ data , true ) ; if ( is_null ( $ jsonData ) ) { $ this -> _errorsList [ 'json_decode' ] = 'Json cannot be decoded.' ; $ this -> _hasErrors = true ; return $ this ; } $ this -> appendArray ( $ jsonData ) ; if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | apply given json data as object data |
44,655 | public function appendSimpleXml ( $ data ) { $ loadedXml = simplexml_load_string ( $ data ) ; $ jsonXml = json_encode ( $ loadedXml ) ; $ jsonData = json_decode ( $ jsonXml , true ) ; $ this -> appendArray ( $ jsonData ) ; if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | apply given xml data as object data |
44,656 | public function appendXml ( $ data ) { $ xml = new Xml ( ) ; $ xml -> preserveWhiteSpace = false ; $ bool = @ $ xml -> loadXML ( $ data ) ; if ( ! $ bool ) { $ this -> _errorsList [ 'xml_load_error' ] = $ data ; $ this -> _hasErrors = true ; return $ this ; } try { $ temp = $ this -> _xmlToArray ( $ xml -> documentElement ) ; $ this -> appendArray ( $ temp ) ; } catch ( DOMException $ exception ) { $ this -> _addException ( $ exception ) ; } if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | apply given xml data as object data also handling attributes |
44,657 | protected function _xmlToArray ( DOMElement $ data ) { $ temporaryData = [ ] ; foreach ( $ data -> childNodes as $ node ) { $ nodeName = $ this -> _stringToIntegerKey ( $ node -> nodeName ) ; $ nodeData = [ ] ; $ unSerializedData = [ ] ; if ( $ node -> hasAttributes ( ) && $ node -> getAttribute ( 'serialized_object' ) ) { try { $ unSerializedData = Serializer :: unserialize ( $ node -> nodeValue ) ; } catch ( ExceptionInterface $ exception ) { $ this -> _addException ( $ exception ) ; } $ temporaryData [ $ nodeName ] = $ unSerializedData ; continue ; } if ( $ node -> hasAttributes ( ) ) { foreach ( $ node -> attributes as $ key => $ value ) { $ nodeData [ '@attributes' ] [ $ key ] = $ value -> nodeValue ; } } if ( $ node -> hasChildNodes ( ) ) { $ childNodesData = [ ] ; foreach ( $ node -> childNodes as $ childNode ) { if ( $ childNode -> nodeType === 1 ) { $ childNodesData = $ this -> _xmlToArray ( $ node ) ; } } if ( ! empty ( $ childNodesData ) ) { $ temporaryData [ $ nodeName ] = $ childNodesData ; continue ; } } if ( ! empty ( $ nodeData ) ) { $ temporaryData [ $ nodeName ] = array_merge ( [ $ node -> nodeValue ] , $ nodeData ) ; } else { $ temporaryData [ $ nodeName ] = $ node -> nodeValue ; } } return $ temporaryData ; } | recurrent function to travel on xml nodes and set their data as object data |
44,658 | public function appendArray ( array $ arrayData ) { foreach ( $ arrayData as $ dataKey => $ data ) { $ this -> _putData ( $ dataKey , $ data ) ; } if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | allow to set array in object or some other value |
44,659 | public function appendData ( $ key , $ data ) { $ this -> _putData ( $ key , $ data ) ; if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | allow to set some mixed data type as given key |
44,660 | public function appendStdClass ( stdClass $ class ) { $ this -> appendArray ( get_object_vars ( $ class ) ) ; if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | get class variables and set them as data |
44,661 | public function appendSerialized ( $ data ) { try { $ data = Serializer :: unserialize ( $ data ) ; } catch ( ExceptionInterface $ exception ) { $ this -> _addException ( $ exception ) ; } if ( is_object ( $ data ) ) { $ name = $ this -> _convertKeyNames ( get_class ( $ data ) ) ; $ this -> appendData ( $ name , $ data ) ; } elseif ( is_array ( $ data ) ) { $ this -> appendArray ( $ data ) ; } else { $ this -> appendData ( $ this -> _defaultDataName , $ data ) ; } if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | set data from serialized string as object data if data is an object set one variable where key is an object class name |
44,662 | public function appendIni ( $ data ) { $ array = parse_ini_string ( $ data , $ this -> _processIniSection , INI_SCANNER_RAW ) ; if ( $ array === false ) { $ this -> _hasErrors = true ; $ this -> _errorsList [ ] = 'parse_ini_string' ; return $ this ; } $ this -> appendArray ( $ array ) ; return $ this ; } | allow to set ini data into object |
44,663 | public function toIni ( ) { $ ini = '' ; foreach ( $ this -> toArray ( ) as $ key => $ iniRow ) { $ this -> _appendIniData ( $ ini , $ key , $ iniRow ) ; } return $ ini ; } | export object as ini string |
44,664 | protected function _appendIniData ( & $ ini , $ key , $ iniRow ) { if ( $ this -> _processIniSection && is_array ( $ iniRow ) ) { $ ini .= '[' . $ key . ']' . "\n" ; foreach ( $ iniRow as $ rowKey => $ rowData ) { $ ini .= $ rowKey . ' = ' . $ rowData . "\n" ; } } else { $ ini .= $ key . ' = ' . $ iniRow . "\n" ; } } | append ini data to string |
44,665 | public function appendCsv ( $ data ) { $ counter = 0 ; $ rows = str_getcsv ( $ data , $ this -> _csvLineDelimiter ) ; foreach ( $ rows as $ row ) { $ rowData = str_getcsv ( $ row , $ this -> _csvDelimiter , $ this -> _csvEnclosure , $ this -> _csvEscape ) ; $ this -> _putData ( $ this -> _integerKeyPrefix . $ counter , $ rowData ) ; $ counter ++ ; } if ( $ this -> _objectCreation ) { return $ this -> _afterAppendDataToNewObject ( ) ; } return $ this ; } | allow to set csv data into object |
44,666 | public function toCsv ( ) { $ csv = '' ; foreach ( $ this -> toArray ( ) as $ csvRow ) { if ( is_array ( $ csvRow ) ) { $ data = implode ( $ this -> _csvDelimiter , $ csvRow ) ; } else { $ data = $ csvRow ; } $ csv .= $ data . $ this -> _csvLineDelimiter ; } return rtrim ( $ csv , $ this -> _csvLineDelimiter ) ; } | export object as csv data |
44,667 | protected function _putData ( $ key , $ data ) { $ bool = $ this -> _validateDataKey ( $ key , $ data ) ; if ( ! $ bool ) { return $ this ; } $ hasData = $ this -> has ( $ key ) ; if ( $ this -> _setPreparationOn ) { $ data = $ this -> _dataPreparation ( $ key , $ data , $ this -> _dataPreparationCallbacks ) ; } if ( ! $ hasData || ( $ hasData && $ this -> _comparator ( $ this -> _DATA [ $ key ] , $ data , '!==' ) ) ) { $ this -> _changeData ( $ key , $ data , $ hasData ) ; } return $ this ; } | check that given data for key is valid and set in object if don t exist or is different |
44,668 | protected function _validateDataKey ( $ key , $ data ) { $ dataOkFlag = true ; if ( ! $ this -> _validationOn ) { return $ dataOkFlag ; } foreach ( $ this -> _validationRules as $ ruleKey => $ ruleValue ) { if ( ! preg_match ( $ ruleKey , $ key ) ) { continue ; } $ bool = $ this -> _validateData ( $ ruleValue , $ key , $ data ) ; if ( ! $ bool ) { $ dataOkFlag = false ; } } return $ dataOkFlag ; } | search validation rule for given key and check data |
44,669 | protected function _arrayToXml ( $ data , Xml $ xml , $ addCdata , $ parent ) { foreach ( $ data as $ key => $ value ) { $ key = str_replace ( ' ' , '_' , $ key ) ; $ attributes = [ ] ; $ data = '' ; if ( is_object ( $ value ) ) { try { $ data = Serializer :: serialize ( $ value ) ; } catch ( ExceptionInterface $ exception ) { $ this -> _addException ( $ exception ) ; } $ value = [ '@attributes' => [ 'serialized_object' => true ] , $ data ] ; } try { $ isArray = is_array ( $ value ) ; if ( $ isArray && array_key_exists ( '@attributes' , $ value ) ) { $ attributes = $ value [ '@attributes' ] ; unset ( $ value [ '@attributes' ] ) ; } if ( $ isArray ) { $ parent = $ this -> _convertArrayDataToXml ( $ value , $ addCdata , $ xml , $ key , $ parent , $ attributes ) ; continue ; } $ element = $ this -> _appendDataToNode ( $ addCdata , $ xml , $ key , $ value ) ; $ parent -> appendChild ( $ element ) ; } catch ( DOMException $ exception ) { $ this -> _addException ( $ exception ) ; } } return $ xml ; } | recursive method to create structure xml structure of object DATA |
44,670 | protected function _convertArrayDataToXml ( $ value , $ addCdata , Xml $ xml , $ key , $ parent , array $ attributes ) { $ count = count ( $ value ) === 1 ; $ isNotEmpty = ! empty ( $ attributes ) ; $ exist = array_key_exists ( 0 , $ value ) ; if ( $ count && $ isNotEmpty && $ exist ) { $ children = $ this -> _appendDataToNode ( $ addCdata , $ xml , $ key , $ value [ 0 ] ) ; } else { $ children = $ xml -> createElement ( $ this -> _integerToStringKey ( $ key ) ) ; $ this -> _arrayToXml ( $ value , $ xml , $ addCdata , $ children ) ; } $ parent -> appendChild ( $ children ) ; foreach ( $ attributes as $ attributeKey => $ attributeValue ) { $ children -> setAttribute ( $ attributeKey , $ attributeValue ) ; } return $ parent ; } | convert array DATA value to xml format and return as xml object |
44,671 | protected function _appendDataToNode ( $ addCdata , Xml $ xml , $ key , $ value ) { if ( $ addCdata ) { $ cdata = $ xml -> createCDATASection ( $ value ) ; $ element = $ xml -> createElement ( $ this -> _integerToStringKey ( $ key ) ) ; $ element -> appendChild ( $ cdata ) ; } else { $ element = $ xml -> createElement ( $ this -> _integerToStringKey ( $ key ) , $ value ) ; } return $ element ; } | append data to node |
44,672 | protected function _genericPut ( $ key , $ value , $ type ) { $ listName = $ this -> _getCorrectList ( $ type ) ; if ( is_array ( $ key ) ) { $ this -> $ listName = array_merge ( $ this -> $ listName , $ key ) ; } else { $ list = & $ this -> $ listName ; $ list [ $ key ] = $ value ; } return $ this ; } | common put data method for class data lists |
44,673 | protected function _genericDestroy ( $ key , $ type ) { $ listName = $ this -> _getCorrectList ( $ type ) ; if ( $ key ) { $ list = & $ this -> $ listName ; unset ( $ list [ $ key ] ) ; } $ this -> $ listName = [ ] ; return $ this ; } | common destroy data method for class data lists |
44,674 | protected function _genericReturn ( $ key , $ type ) { $ listName = $ this -> _getCorrectList ( $ type ) ; switch ( true ) { case ! $ key : return $ this -> $ listName ; case array_key_exists ( $ key , $ this -> $ listName ) : $ list = & $ this -> $ listName ; return $ list [ $ key ] ; default : return null ; } } | common return data method for class data lists |
44,675 | protected function _dataPreparation ( $ key , $ data , array $ rulesList ) { foreach ( $ rulesList as $ ruleKey => $ function ) { switch ( true ) { case is_null ( $ key ) : $ data = $ this -> _prepareWholeData ( $ ruleKey , $ data , $ function ) ; break ; case preg_match ( $ ruleKey , $ key ) && ! is_null ( $ key ) : $ data = $ this -> _callUserFunction ( $ function , $ key , $ data , null ) ; break ; default : break ; } } return $ data ; } | return data formatted by given function |
44,676 | protected function _prepareWholeData ( $ ruleKey , array $ data , $ function ) { foreach ( $ data as $ key => $ value ) { if ( preg_match ( $ ruleKey , $ key ) ) { $ data [ $ key ] = $ this -> _callUserFunction ( $ function , $ key , $ value , null ) ; } } return $ data ; } | allow to use return preparation on all data in object |
44,677 | public function offsetSet ( $ offset , $ value ) { if ( is_null ( $ offset ) ) { $ offset = $ this -> _integerToStringKey ( $ this -> _integerKeysCounter ++ ) ; } $ this -> _putData ( $ offset , $ value ) ; return $ this ; } | set data for given key |
44,678 | protected function _addException ( Exception $ exception ) { $ this -> _hasErrors = true ; $ this -> _errorsList [ $ exception -> getCode ( ) ] = [ 'message' => $ exception -> getMessage ( ) , 'line' => $ exception -> getLine ( ) , 'file' => $ exception -> getFile ( ) , 'trace' => $ exception -> getTraceAsString ( ) , ] ; return $ this ; } | create exception message and set it in object |
44,679 | function setTemplateFile ( $ file ) { $ this -> _template -> setTemplateFile ( ROOT . DS . 'application' . DS . 'views' . DS . $ file ) ; } | Override the default template |
44,680 | protected function getConfig ( $ key = null ) { if ( $ this -> config === null ) { $ this -> setConfig ( ) ; } if ( null === $ key ) { return $ this -> config ; } if ( ! array_key_exists ( $ key , $ this -> config ) ) { throw new InvalidArgumentException ( "key: '" . $ key . "' is not set in configuration options." ) ; } return $ this -> config [ $ key ] ; } | Gets the config options as an array if a key is supplied then that keys options is returned . |
44,681 | public static function Aper13 ( $ ut11 , $ ut12 , iauASTROM & $ astrom ) { IAU :: Aper ( IAU :: Era00 ( $ ut11 , $ ut12 ) , $ astrom ) ; } | - - - - - - - - - - i a u A p e r 1 3 - - - - - - - - - - |
44,682 | private static function autoResolve ( $ arsUrlValueList ) { $ sController = 'Index' ; $ sAction = 'index' ; $ arsParamList = array ( ) ; foreach ( $ arsUrlValueList as $ nIndexValue => $ sUrlValue ) { if ( $ nIndexValue == 0 ) { $ sController = $ sUrlValue ; } elseif ( $ nIndexValue == 1 ) { $ sAction = $ sUrlValue ; } else { if ( isset ( $ arsUrlValueList [ $ nIndexValue ] ) && $ nIndexValue % 2 == 0 ) { $ sParamName = $ arsUrlValueList [ $ nIndexValue ] ; $ sParamValue = null ; if ( isset ( $ arsUrlValueList [ $ nIndexValue + 1 ] ) ) { $ sParamValue = $ arsUrlValueList [ $ nIndexValue + 1 ] ; } $ arsParamList [ $ sParamName ] = $ sParamValue ; } } } self :: setController ( $ sController ) ; self :: setAction ( $ sAction ) ; self :: setParameter ( $ arsParamList ) ; } | Auto resolve a Route from URL by separator |
44,683 | private static function checkRoute ( $ arcUrlSeparator , $ arsUrlValue ) { $ aroRouteList = RouteCollection :: getAll ( ) ; if ( empty ( $ aroRouteList ) ) { return false ; } foreach ( $ aroRouteList as $ oRoute ) { $ sRoute = $ oRoute -> getRoute ( ) ; $ sRoute = self :: removeLastSeparator ( $ sRoute ) ; $ arcRouteSeparator = self :: listSeparator ( $ sRoute ) ; if ( $ arcUrlSeparator == $ arcRouteSeparator ) { $ arsRouteValueList = self :: listValue ( $ sRoute ) ; $ bGoodRoute = true ; $ arsParamList = array ( ) ; foreach ( $ arsRouteValueList as $ nParamIndex => $ sRouteValue ) { if ( isset ( $ arsUrlValue [ $ nParamIndex ] ) ) { $ cFirstCharValue = substr ( $ sRouteValue , 0 , 1 ) ; if ( $ cFirstCharValue == ':' ) { $ arsParamList [ substr ( $ sRouteValue , 1 ) ] = $ arsUrlValue [ $ nParamIndex ] ; } elseif ( $ sRouteValue != $ arsUrlValue [ $ nParamIndex ] && $ cFirstCharValue != '*' ) { $ bGoodRoute = false ; } } else { $ bGoodRoute = false ; } } if ( $ bGoodRoute ) { self :: setController ( $ oRoute -> getController ( ) ) ; self :: setAction ( $ oRoute -> getAction ( ) ) ; if ( is_array ( $ oRoute -> getParamList ( ) ) ) { $ arsParamList = $ arsParamList + $ oRoute -> getParamList ( ) ; } self :: setParameter ( $ arsParamList ) ; return true ; } } } return false ; } | Check if Route exist in RouterCollection who can match to current url |
44,684 | private static function checkController ( ) { $ bSetFallback = false ; $ sControllerNamespace = Configuration :: read ( 'application.namespace' ) . '\Controller\\' . self :: getController ( ) ; if ( class_exists ( $ sControllerNamespace ) === false ) { $ bSetFallback = true ; } if ( method_exists ( $ sControllerNamespace , self :: getAction ( ) ) === false ) { $ bSetFallback = true ; } if ( $ bSetFallback === true ) { $ sFallbackController = RouteCollection :: getFallbackController ( ) ; self :: setController ( $ sFallbackController ) ; $ sFallbackAction = RouteCollection :: getFallbackAction ( ) ; self :: setAction ( $ sFallbackAction ) ; $ arsFallbackParameter = array ( 'code' => 404 ) ; self :: setParameter ( $ arsFallbackParameter ) ; } } | Check if controller and action exist else change to fallback controller and action |
44,685 | private static function listSeparator ( $ sUrl ) { $ armSeparatorPosition = array ( ) ; foreach ( RouteCollection :: getSeparator ( ) as $ cSeparator ) { $ sUrlSearch = $ sUrl ; while ( $ nSeparatorPosition = strrpos ( $ sUrlSearch , $ cSeparator ) ) { $ armSeparatorPosition [ $ nSeparatorPosition ] = $ cSeparator ; $ sUrlSearch = substr ( $ sUrlSearch , 0 , $ nSeparatorPosition ) ; } } ksort ( $ armSeparatorPosition ) ; return array_values ( $ armSeparatorPosition ) ; } | List of separator defined in URL . |
44,686 | private static function listValue ( $ sUrl ) { $ sRegexSeparator = implode ( '' , RouteCollection :: getSeparator ( ) ) ; $ sRegexSeparator = preg_quote ( $ sRegexSeparator ) ; $ arsListValue = preg_split ( "{[" . $ sRegexSeparator . "]}" , $ sUrl ) ; array_shift ( $ arsListValue ) ; return $ arsListValue ; } | List of value defined in URL . |
44,687 | private static function removeLastSeparator ( $ sUrl ) { $ cLastChar = substr ( $ sUrl , - 1 ) ; if ( in_array ( $ cLastChar , RouteCollection :: getSeparator ( ) ) ) { $ sUrl = substr ( $ sUrl , 0 , - 1 ) ; } return $ sUrl ; } | Remove last separtor in URL . |
44,688 | public static function resolve ( ) { $ oRequest = new Request ( ) ; $ sUrl = $ oRequest -> url ( ) ; if ( Configuration :: check ( 'routing.default_separator' ) === true ) { $ cDefaultSeparator = Configuration :: read ( 'routing.default_separator' ) ; RouteCollection :: setDefaultSeparator ( $ cDefaultSeparator ) ; } $ sUrl = self :: removeLastSeparator ( $ sUrl ) ; $ arcUrlSeparator = self :: listSeparator ( $ sUrl ) ; $ arsUrlValue = self :: listValue ( $ sUrl ) ; $ bCheckResult = self :: checkRoute ( $ arcUrlSeparator , $ arsUrlValue ) ; if ( $ bCheckResult === false && Configuration :: read ( 'routing.auto' ) === true ) { self :: autoResolve ( $ arsUrlValue ) ; } self :: checkController ( ) ; self :: setParameterInGlobal ( ) ; } | Call differnant action in Router to resolve road from URL . |
44,689 | public static function showRoutes ( $ moduleUid = '' , $ app = null , $ echo = false ) { if ( empty ( $ app ) ) { $ app = Yii :: $ app ; } $ urlMan = $ app -> urlManager ; $ result = '' ; foreach ( $ urlMan -> rules as $ rule ) { if ( empty ( $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; } else { switch ( $ rule :: className ( ) ) { case GroupUrlRule :: className ( ) : foreach ( $ rule -> rules as $ singleRule ) { if ( 0 === strpos ( $ singleRule -> route , $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; break ; } } break ; case RestUrlRule :: className ( ) : if ( is_array ( $ rule -> controller ) ) { $ urlPrefix = array_keys ( $ rule -> controller ) [ 0 ] ; $ controller = $ rule -> controller [ $ urlPrefix ] ; } else { $ controller = $ rule -> controller ; } if ( 0 === strpos ( $ controller , $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; } break ; default : if ( 0 === strpos ( $ rule -> route , $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; } break ; } } } if ( $ echo ) { echo $ result ; } else { return $ result ; } } | Show all application routes . |
44,690 | public static function showRoute ( $ rule , $ echo = false , $ showPattern = false ) { $ result = '' ; switch ( $ rule :: className ( ) ) { case WebUrlRule :: className ( ) : $ result .= '' . "'" . htmlspecialchars ( $ rule -> name ) . "'" . ( $ showPattern ? " (" . htmlspecialchars ( $ rule -> pattern ) . ")" : '' ) . " => '" . htmlspecialchars ( $ rule -> route ) . "'" . " ({$rule::className()})" . "\n" ; break ; case GroupUrlRule :: className ( ) : $ result .= "'{$rule->prefix}/...' ({$rule::className()}): <br>" ; foreach ( $ rule -> rules as $ singleRule ) { $ result .= static :: $ ruleShift . "'" . htmlspecialchars ( $ singleRule -> name ) . "'" . ( $ showPattern ? " (" . htmlspecialchars ( $ singleRule -> pattern ) . ")" : '' ) . ' => ' . "'" . htmlspecialchars ( $ singleRule -> route ) . "'" . "\n" ; } break ; case RestUrlRule :: className ( ) : if ( is_array ( $ rule -> controller ) ) { $ urlPrefix = array_keys ( $ rule -> controller ) [ 0 ] ; $ controller = $ rule -> controller [ $ urlPrefix ] ; } else { $ controller = $ rule -> controller ; $ urlPrefix = '' ; } $ result .= "'{$rule->prefix}/{$urlPrefix}/...' ({$rule::className()}): <br>" ; foreach ( $ rule -> patterns as $ template => $ action ) { $ result .= static :: $ ruleShift . "'" . $ rule -> prefix . '/' . $ urlPrefix . '/' . htmlspecialchars ( $ template ) . htmlspecialchars ( $ rule -> suffix ) . "'" . " => '" . $ controller . '/' . htmlspecialchars ( $ action ) . "'" . "\n" ; } break ; default : $ result .= "{$rule::className()}:<br>" ; if ( method_exists ( $ rule , 'showRouteInfo' ) ) { $ info = $ rule -> showRouteInfo ( $ showPattern ) ; $ strings = explode ( "\n" , trim ( $ info ) ) ; foreach ( $ strings as $ str ) $ result .= static :: $ ruleShift . trim ( $ str ) . "\n" ; } else { ob_start ( ) ; ob_implicit_flush ( false ) ; var_dump ( $ rule ) ; $ result .= ob_get_clean ( ) ; } break ; } if ( $ echo ) { echo $ result ; } else { return $ result ; } } | Show route . |
44,691 | public function marshall ( $ usePreamble = true ) { $ out = "" ; $ attributes = $ this -> getAttributes ( ) ; if ( $ usePreamble ) { $ out .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ; } $ out .= "<object classname=\"" . static :: $ m__sClassName . "\">\n" ; foreach ( $ attributes as $ attribute ) { $ attributeName = $ attribute -> getName ( ) ; if ( MWebfile :: isSimpleDatatype ( $ attributeName ) ) { $ attribute -> setAccessible ( true ) ; $ attributeFieldName = static :: getSimplifiedAttributeName ( $ attributeName ) ; $ out .= "\t<" . $ attributeFieldName . "><![CDATA[" . $ attribute -> getValue ( $ this ) . "]]></" . $ attributeFieldName . ">\n" ; } } $ out .= "</object>" ; return $ out ; } | Converts the current webfile into its xml representation . |
44,692 | public static function getAttributes ( $ onlyAttributesOfSimpleDatatypes = false ) { $ oSelfReflection = new \ ReflectionClass ( static :: $ m__sClassName ) ; $ oPropertyArray = $ oSelfReflection -> getProperties ( \ ReflectionProperty :: IS_PUBLIC | \ ReflectionProperty :: IS_PROTECTED | \ ReflectionProperty :: IS_PRIVATE ) ; $ count = 0 ; while ( $ count < count ( $ oPropertyArray ) ) { $ sAttributeName = $ oPropertyArray [ $ count ] -> getName ( ) ; if ( substr ( $ sAttributeName , 1 , 1 ) != "_" || substr ( $ sAttributeName , 2 , 1 ) == "_" || ( $ onlyAttributesOfSimpleDatatypes && substr ( $ sAttributeName , 2 , 1 ) == "o" ) ) { unset ( $ oPropertyArray [ $ count ] ) ; } $ count ++ ; } return $ oPropertyArray ; } | Returns the attributes of the actual class which are relevant for the webfile definition . |
44,693 | public static function getClassInformation ( ) { $ returnValue = "<classinformation>\n" ; $ returnValue .= "\t<author>simpleserv.de</author>\n" ; $ returnValue .= "\t<classname>" . static :: $ m__sClassName . "</classname>\n" ; $ returnValue .= "\t<attributes>\n" ; $ attributes = static :: getAttributes ( ) ; foreach ( $ attributes as $ attribute ) { $ attributeName = $ attribute -> getName ( ) ; if ( MWebfile :: isSimpleDatatype ( $ attributeName ) ) { $ attributeFieldName = static :: getSimplifiedAttributeName ( $ attributeName ) ; $ attributeFieldType = MWebfile :: getDatatypeFromAttributeName ( $ attributeName ) ; $ returnValue .= "\t\t<attribute name=\"" . $ attributeFieldName . "\" type=\"" . $ attributeFieldType . "\" />\n" ; } } $ returnValue .= "\t</attributes>\n" ; $ returnValue .= "</classinformation>" ; return $ returnValue ; } | Returns a xml defined class information . It contains the classname and the given attributes . |
44,694 | public function getDataset ( ) { $ dataset = array ( ) ; $ attributes = $ this -> getAttributes ( ) ; foreach ( $ attributes as $ attribute ) { $ attributeName = $ attribute -> getName ( ) ; $ attribute -> setAccessible ( true ) ; $ attributeValue = $ attribute -> getValue ( $ this ) ; if ( MWebfile :: isSimpleDatatype ( $ attributeName ) ) { $ attributeFieldName = static :: getSimplifiedAttributeName ( $ attributeName ) ; $ dataset [ $ attributeFieldName ] = $ attributeValue ; } } return $ dataset ; } | Transforms the actual webfile into an dataset . A dataset is represented by a key value array . The key is the attributes name . The value is the attributes value . |
44,695 | public function set ( string $ variableName = null , $ variableValue = null ) : Session { if ( $ variableName === null ) { throw new BadMethodCallException ( 'Variable name must be specified' ) ; } if ( $ variableName === '_MFREG_' ) { throw new InvalidArgumentException ( '_MFREG_ variable name is not allowed' ) ; } $ _SESSION [ $ variableName ] = \ base64_encode ( \ serialize ( $ variableValue ) ) ; $ this -> variables [ $ variableName ] = \ base64_encode ( \ serialize ( $ variableValue ) ) ; return static :: $ instance ; } | Sets SESSION variable . |
44,696 | public static function setConfiguration ( $ config ) { if ( ! is_array ( $ config ) ) throw new ConfigurationException ( 'Configuration needs to be an array' ) ; if ( array_key_exists ( 'primaryGSLSNode' ) ) self :: $ primaryGSLSNode = $ config [ 'primaryGSLSNode' ] ; if ( array_key_exists ( 'secondaryGSLSNode' ) ) self :: $ secondaryGSLSNode = $ config [ 'secondaryGSLSNode' ] ; if ( array_key_exists ( 'apiPath' ) ) self :: $ apiPath = $ config [ 'apiPath' ] ; if ( array_key_exists ( 'timezone' ) ) self :: $ timezone = $ config [ 'timezone' ] ; if ( array_key_exists ( 'verbose' ) ) self :: $ verbose = $ config [ 'verbose' ] ; if ( array_key_exists ( 'curlVerbose' ) ) self :: $ curlVerbose = $ config [ 'curlVerbose' ] ; if ( array_key_exists ( 'requestTimeout' ) ) self :: $ requestTimeout = $ config [ 'requestTimeout' ] ; if ( array_key_exists ( 'gslsTimeout' ) ) self :: $ gslsTimeout = $ config [ 'gslsTimeout' ] ; if ( array_key_exists ( 'logfile' ) ) self :: $ logfile = $ config [ 'logfile' ] ; } | Sets configuration values |
44,697 | public function ExtractDistinctValues ( $ array ) { foreach ( $ array as $ key => $ value ) { $ valueIsArray = is_array ( $ value ) ; $ valueIsAlreadyExtracted = in_array ( $ value , $ this -> List ) ; $ keyIsExtracted = in_array ( $ key , $ this -> List ) ; if ( ! $ valueIsArray && ! $ valueIsAlreadyExtracted && ! RegexHelper :: Init ( $ value ) -> StringContainsWhiteSpace ( ) ) { array_push ( $ this -> List , $ value ) ; } if ( ! $ keyIsExtracted && is_string ( $ key ) && ! RegexHelper :: Init ( $ key ) -> StringContainsWhiteSpace ( ) ) { array_push ( $ this -> List , $ key ) ; } if ( $ valueIsArray ) { $ this -> ExtractDistinctValues ( $ value ) ; } } return $ this ; } | Extracts distinct values from the array that don t contain whitespace . |
44,698 | public function run ( ) { $ config = $ this -> config ; try { $ this -> getFluent ( ) -> getPdo ( ) -> beginTransaction ( ) ; $ this -> tree -> getFluent ( ) -> getPdo ( ) -> exec ( "LOCK TABLES $config[table] WRITE;" ) ; $ return = $ this -> doRun ( ) ; $ this -> getFluent ( ) -> getPdo ( ) -> commit ( ) ; $ this -> tree -> getFluent ( ) -> getPdo ( ) -> query ( "UNLOCK TABLES;" ) ; return $ return ; } catch ( Exception $ ex ) { $ this -> getFluent ( ) -> getPdo ( ) -> rollBack ( ) ; $ this -> tree -> getFluent ( ) -> getPdo ( ) -> query ( "UNLOCK TABLES;" ) ; throw $ ex ; } } | Run the operation in transaction . |
44,699 | protected function getNodesBetween ( $ min , $ max ) { $ config = $ this -> config ; $ query = $ this -> tree -> table ( ) -> select ( NULL ) -> select ( "$config[id] AS id" ) -> where ( "($config[lft] >= :min AND $config[lft] <= :max) OR ($config[rgt] >= :min AND $config[rgt] <= :max)" , [ ':min' => $ min , ':max' => $ max , ] ) -> fetchAll ( ) ; $ ids = array_map ( function ( $ key ) { return $ key [ 'id' ] ; } , $ query ) ; return $ ids ; } | Get IDs of nodes between indexes including parent . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.