idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
48,600 | private function getWatermark ( ImagineInterface $ imagine ) : ? ImageInterface { $ resource = null ; if ( $ this -> getMarkFilepath ( ) !== null ) { $ resource = fopen ( $ this -> getMarkFilepath ( ) , 'rb' ) ; } elseif ( \ is_string ( $ this -> markContent ) ) { $ resource = 'a' ; } elseif ( \ is_resource ( $ this ->... | Get watermark image |
48,601 | public static function getAppliedFilters ( ) { $ classMethods = get_class_methods ( get_class ( ) ) ; $ calledClassMethods = get_class_methods ( get_called_class ( ) ) ; $ filteredMethods = array_filter ( $ calledClassMethods , function ( $ calledClassMethod ) use ( $ classMethods ) { return ! in_array ( $ calledClassM... | Get applied filters from request . |
48,602 | function add_field ( $ name , $ title = null , \ Closure $ display_callback = null , Setting \ Section $ section = null , $ default = null ) { if ( is_array ( $ name ) ) { $ field = $ name + [ $ display_callback = null , $ section = null , $ default = null , $ type = 'text' ] ; } else { $ field = compact ( 'name' , 'ti... | Just pass name which is an assoc array - what you see here are legacy params |
48,603 | public function format ( array $ response ) { $ car = '<br />' ; $ format = '' ; foreach ( $ response as $ page ) { $ format .= '<div class="page"><span class="title">' . ApiTools :: safeString ( $ page -> getTitle ( ) ) . '</span>' . $ car . 'pageid: <span class="pageid">' . $ page -> getPageid ( ) . '</span>' . $ car... | format a page response as an HTML string |
48,604 | public function setCommand ( string $ args ) : self { if ( $ this -> mailer instanceof SendmailMailer ) { $ this -> mailer -> commandArgs = $ args ; } return $ this ; } | Nastavi argumenty pro mailer |
48,605 | public static function explode ( $ string , $ delimiter = ',' , $ trim = true , $ skipEmpty = false ) { $ result = explode ( $ delimiter , $ string ) ; if ( $ trim ) { if ( $ trim === true ) { $ trim = 'trim' ; } elseif ( ! is_callable ( $ trim ) ) { $ trim = function ( $ v ) use ( $ trim ) { return trim ( $ v , $ trim... | Explodes string into array optionally trims values and skips empty ones |
48,606 | function & mock_mount ( array $ fs , $ mountpoint = '~/approot' ) { $ mountpoint = str_replace ( '~' , $ this -> mock_homedir , trim ( $ mountpoint , '/' ) ) ; $ normalizedfs = $ this -> mock_normalize ( $ fs ) ; $ path = & $ this -> mock_ensurepath ( $ mountpoint ) ; $ this -> mock_fsmerge ( $ path , $ normalizedfs ) ... | Mount virtual filesystem at specified location . |
48,607 | function mock_fsmerge ( & $ fs , & $ comp ) { if ( isset ( $ comp [ '%type' ] ) && $ comp [ '%type' ] == 'file' ) { throw new \ Exception ( '[Mock] Tried to copy file as directory.' ) ; } $ existing_files = [ ] ; foreach ( $ fs as $ node => $ file ) { if ( is_integer ( $ node ) ) { $ existing_files [ ] = $ file [ 'file... | Merges two file system definitions togheter . |
48,608 | protected function getModuleMigrations ( $ downloadPath , $ moduleMigrationPath = 'asset/data' ) { $ moduleMigrationPath = trim ( $ moduleMigrationPath , '/' ) ; $ moduleMigrations = glob ( $ downloadPath . '/' . $ moduleMigrationPath . '/*.php' ) ; sort ( $ moduleMigrations ) ; return $ moduleMigrations ; } | Check if module have migrations files |
48,609 | protected function copyModuleMigrations ( array $ config , array $ moduleMigrations ) { $ migrationPath = $ this -> checkMigrationsPath ( $ config ) ; if ( $ migrationPath === false ) { return false ; } $ migrations = glob ( $ migrationPath . '*.php' ) ; $ old_migration_names = array ( ) ; $ copied = 0 ; sort ( $ migra... | Copy all module migration files to application migration directory |
48,610 | protected function checkMigrationsPath ( array $ config ) { $ migrationPath = isset ( $ config [ 'migration_path' ] ) ? $ config [ 'migration_path' ] : false ; $ migrationPath = str_replace ( 'FCPATH' , '' , $ migrationPath ) ; if ( $ migrationPath !== false && ! is_dir ( $ migrationPath ) ) { mkdir ( $ migrationPath ,... | Check Application Migrations path if not available it will create new one |
48,611 | protected function getMigrationConfig ( $ downloadPath ) { $ extra = ( $ pkg = $ this -> composer -> getPackage ( ) ) ? $ pkg -> getExtra ( ) : array ( ) ; $ appPath = defined ( 'APPPATH' ) ? APPPATH : $ extra [ 'codeigniter-application-dir' ] ; @ include $ appPath . '/config/migration.php' ; return isset ( $ config ) ... | Get migration configurations |
48,612 | public function tag ( $ name , Array $ options = array ( ) , $ content = null , $ open = false ) { if ( ! $ name ) { return '' ; } $ htmlOptions = '' ; foreach ( $ options as $ key => $ value ) { $ htmlOptions .= ' ' . $ key . '="' . \ htmlspecialchars ( $ value , \ ENT_COMPAT ) . '"' ; } if ( $ content !== null ) { re... | Constructs an html tag |
48,613 | public function translate ( $ locale = null , $ create = false ) { $ locale = $ locale ? : $ this -> currentLocale ; if ( null === $ locale ) { throw new \ RuntimeException ( 'No locale has been set and current locale is undefined.' ) ; } if ( $ this -> currentTranslation && $ locale === $ this -> currentTranslation ->... | Returns the translation regarding to the current or fallback locale . |
48,614 | public function addTranslation ( TranslationInterface $ translation ) { if ( ! $ this -> translations -> containsKey ( $ translation -> getLocale ( ) ) ) { $ this -> translations -> set ( $ translation -> getLocale ( ) , $ translation ) ; $ translation -> setTranslatable ( $ this ) ; } return $ this ; } | Adds the translation . |
48,615 | public function reference ( $ useCaseName , $ resourcePart = null , Request $ request = null ) { if ( null === $ request ) { $ request = $ this -> getRequest ( ) ; } return $ this -> getUseCaseFactoryInstance ( ) -> setUseCaseName ( $ useCaseName ) -> setRequest ( $ request ) -> getResource ( $ resourcePart ) ; } | Factory method for use of a new UseCase class Returns whole resource or just one part |
48,616 | private function prepareRatios ( Collection $ categories ) { $ ratios = $ categories -> filter ( function ( Category $ category ) { return $ category -> hasPosts ( ) ; } ) -> transform ( function ( Category $ category ) { return [ 'label' => $ category -> name , 'posts' => $ category -> posts -> count ( ) , ] ; } ) -> ... | Prepare the categories ratios . |
48,617 | public function BeforeDelete ( $ item ) { $ contContainers = ContentContainer :: Schema ( ) -> FetchByContainer ( true , $ item ) ; $ logger = new Logger ( BackendModule :: Guard ( ) -> GetUser ( ) ) ; foreach ( $ contContainers as $ contContainer ) { $ content = $ contContainer -> GetContent ( ) ; $ provider = Content... | Deletes the container contents related to the container |
48,618 | public static function toSelectCallable ( $ mixed = null ) { if ( self :: isClosure ( $ mixed ) || self :: isInstanceCallable ( $ mixed ) ) { return $ mixed ; } elseif ( is_null ( $ mixed ) || $ mixed === "" ) { return function ( $ v ) { return $ v ; } ; } elseif ( is_int ( $ mixed ) || is_float ( $ mixed ) || is_strin... | Converts strings empty strings and NULL into a callable |
48,619 | public static function toConditionCallable ( $ mixed = null ) { if ( self :: isClosure ( $ mixed ) || self :: isInstanceCallable ( $ mixed ) ) { return $ mixed ; } elseif ( is_bool ( $ mixed ) || is_string ( $ mixed ) || is_numeric ( $ mixed ) ) { return function ( $ v ) use ( $ mixed ) { return $ v === $ mixed ; } ; }... | Convert strings numbers booleans and arrays into a callable |
48,620 | public function scopeFilter ( $ query ) { if ( ! $ this -> filters ) { $ message = 'Please set the $filters property.' ; throw new FilterableSortableException ( $ message ) ; } $ this -> filters = app ( ) -> make ( $ this -> filters ) ; if ( ! $ this -> filters instanceof QueryFilters ) { $ message = '$filters property... | Filter a result set . |
48,621 | public function scopeSort ( $ query ) { if ( ! $ this -> sorters ) { $ message = 'Please set the $sorters property.' ; throw new FilterableSortableException ( $ message ) ; } $ this -> sorters = app ( ) -> make ( $ this -> sorters ) ; if ( ! $ this -> sorters instanceof QuerySorters ) { $ message = '$sorters property m... | Sort a result set . |
48,622 | public function makeAliasKey ( $ table , $ increment = true ) { return strtr ( '{table}_{count}' , [ '{table}' => TableNameResolver :: getTableName ( $ table ) , '{count}' => $ this -> _aliasesCount + 1 , ] ) ; } | Makes alias for joined table . |
48,623 | public static function setup ( string $ connection = 'Default' ) { $ capsule = new Capsule ( ) ; $ capsule -> addConnection ( self :: getConnection ( $ connection ) ) ; $ capsule -> setAsGlobal ( ) ; $ capsule -> bootEloquent ( ) ; } | Setup the Eloquent ORM . |
48,624 | protected static function getConnection ( string $ connection = 'Default' ) : array { $ configuration = [ ] ; if ( is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] ) ) { $ extensionConfiguration = $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXT' ] [ 'extConf' ] [ 't3v_datamapper' ] ; if ( i... | Returns the connection configuration from the Global TYPO3 configuration options . |
48,625 | public static function get ( $ country ) { switch ( strtoupper ( $ country ) ) { case "DE" : return KlarnaEncoding :: PNO_DE ; case "DK" : return KlarnaEncoding :: PNO_DK ; case "FI" : return KlarnaEncoding :: PNO_FI ; case "NL" : return KlarnaEncoding :: PNO_NL ; case "NO" : return KlarnaEncoding :: PNO_NO ; case "SE"... | Returns the constant for the wanted country . |
48,626 | public static function getRegexp ( $ enc ) { switch ( $ enc ) { case self :: PNO_SE : return '/^[0-9]{6,6}(([0-9]{2,2}[-\+]{1,1}[0-9]{4,4})|([-\+]' . '{1,1}[0-9]{4,4})|([0-9]{4,6}))$/' ; case self :: PNO_NO : return '/^[0-9]{6,6}((-[0-9]{5,5})|([0-9]{2,2}((-[0-9]' . '{5,5})|([0-9]{1,1})|([0-9]{3,3})|([0-9]{5,5))))$/' ;... | Returns a regexp string for the specified encoding constant . |
48,627 | public function getSection ( string $ key ) : ConfigurationBagInterface { return new ConfigurationBag ( isset ( $ this -> parameters [ $ key ] ) ? $ this -> parameters [ $ key ] : [ ] ) ; } | Returns a new ConfigurationBag with parameters If the section does not exists an empty ConfigurationBag is returned |
48,628 | public static function getNest ( $ input , $ open = "(" , $ close = ")" ) { $ pattern = '#\\' . $ open . '((?>[^\\' . $ open . '[\\' . $ close . ']+)|(?R))*\\' . $ close . '#' ; $ count = preg_match_all ( $ pattern , $ input , $ matches ) ; if ( $ count > 0 ) return $ matches [ 0 ] [ 0 ] ; return false ; } | return anything within specified balanced brackets including any nested brackets |
48,629 | private function addFilterCriteria ( ) { $ filters = $ this -> dm -> getFilterCollection ( ) -> getFilterCriteria ( $ this -> class ) ; foreach ( $ filters as $ filter ) { $ this -> addCriteria ( $ filter ) ; } } | Add any filters to the query criteria . |
48,630 | private function checkIndexIsEligible ( ) { $ index = $ this -> getIndex ( ) ; if ( $ index -> isSecondaryGlobal ( ) && ! $ index -> hasAttributes ( $ this -> expr -> getAttributes ( ) ) ) { throw ODMException :: queryIndexProjectionIncompatible ( ) ; } return ( bool ) $ this -> getKeyCondition ( ) ; } | Indicates if the selected index is eligible for the assembled query . |
48,631 | public function delete ( $ hashValue = null , $ rangeValue = null ) { $ this -> setQueryClass ( DeleteItem :: class ) ; if ( $ hashValue !== null ) { $ this -> setPrimaryKey ( $ hashValue , $ rangeValue ) ; } return $ this ; } | Sets the query operation to delete and optionally specifies the primary key . |
48,632 | public function get ( $ hashValue = null , $ rangeValue = null ) { if ( $ this -> expr -> condition -> count ( ) > 0 ) { throw ODMException :: queryGetOperationConditionsNotSupported ( ) ; } $ this -> setQueryClass ( GetItem :: class ) ; if ( $ hashValue !== null ) { $ this -> setPrimaryKey ( $ hashValue , $ rangeValue... | Sets the query operation to get and optionally specifies the primary key . |
48,633 | private function getFilter ( $ keyCondition ) { $ filter = clone $ this -> expr -> condition ; $ conditions = $ keyCondition instanceof Composite ? $ keyCondition -> getParts ( ) : [ $ keyCondition ] ; foreach ( $ conditions as $ condition ) { $ filter -> remove ( $ condition ) ; } return $ filter ; } | Return a expression containing only the subexpression parts which are not part of specified key condition . |
48,634 | public function getQuery ( ) { switch ( $ this -> queryClass ) { case DeleteItem :: class : return $ this -> makeDelete ( ) ; case GetItem :: class : return $ this -> makeGet ( ) ; case PutItem :: class : return $ this -> makePut ( ) ; case Scan :: class : return $ this -> makeScan ( ) ; case UpdateItem :: class : retu... | Build and return the query object . |
48,635 | public function requireIndexes ( $ bool = true ) { if ( ! $ this -> isQueryOrScan ( ) ) { } if ( $ bool ) { $ this -> queryClass = Query :: class ; } else { $ this -> queryClass = Scan :: class ; } return $ this ; } | Set whether or not to require indexes . |
48,636 | public function update ( $ hashValue = null , $ rangeValue = null ) { $ this -> setQueryClass ( UpdateItem :: class ) ; if ( $ hashValue !== null ) { $ this -> setPrimaryKey ( $ hashValue , $ rangeValue ) ; } return $ this ; } | Sets the query operation to update and optionally specifies the primary key . |
48,637 | public function beforeAction ( $ action ) { if ( Cii :: getConfig ( 'useDisqusComments' ) ) throw new CHttpException ( 403 , Yii :: t ( 'Api.comment' , 'The comment API is not available while Disqus comments are enabled.' ) ) ; if ( Cii :: getConfig ( 'useDiscourceComments' ) ) throw new CHttpException ( 403 , Yii :: t... | If Disqus comments are enabled disable the entire API |
48,638 | private function getCommentModel ( $ id = NULL ) { if ( $ id === NULL ) throw new CHttpException ( 400 , Yii :: t ( 'Api.comment' , 'Missing id' ) ) ; $ model = Comments :: model ( ) -> findByPk ( $ id ) ; if ( $ model === NULL ) throw new CHttpException ( 404 , Yii :: t ( 'Api.comment' , 'Comment #{{id}} was not found... | Retrieves the Comment model |
48,639 | public function toArray ( ) { $ ary = [ ] ; foreach ( $ this as $ key => $ value ) { $ ary [ $ key ] = $ value ; } return $ ary ; } | Converts the object to an array |
48,640 | public function addHandlerDefinition ( $ commandClassName , $ handlerServiceId ) { if ( isset ( $ this -> handlerDefinitions [ $ commandClassName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( "Handler with service id '%s' already configured for command %s'" , $ this -> handlerDefinitions [ $ commandClassName... | Add handler definition |
48,641 | public function onKernelRequest ( ) { if ( $ this -> executed ) return ; $ installerScript = $ this -> scriptFactory -> createScript ( 'PostBootInstaller' ) ; $ installerScript -> setContainer ( $ this -> container ) -> executeActionsFromFile ( $ this -> basePath . '/.PostInstall' ) ; $ installerScript = $ this -> scri... | Executes the action when the onKernelRequest event is dispatched |
48,642 | public function getTranslation ( string $ key , string $ locale = null ) { $ this -> throwExceptionIfAttributeIsNotTranslatable ( $ key ) ; $ translations = $ this -> getTranslations ( $ key ) ; if ( count ( $ translations ) ) { $ locale = $ locale ? : config ( 'app.locale' ) ; if ( isset ( $ translations [ $ locale ] ... | Get attribute translation . |
48,643 | public function setTranslation ( string $ key , string $ value = null , string $ locale = null ) { $ this -> throwExceptionIfAttributeIsNotTranslatable ( $ key ) ; $ locale = $ locale ? : config ( 'app.locale' ) ; $ translations = $ this -> getTranslations ( $ key ) ; if ( $ this -> hasSetMutator ( $ key ) ) { $ value ... | Set attribute translation . |
48,644 | private function runMigrationTool ( array $ dsn ) { $ runner = new CConsoleCommandRunner ( ) ; $ runner -> commands = array ( 'migrate' => array ( 'class' => 'application.commands.CiiMigrateCommand' , 'dsn' => $ dsn , 'interactive' => 0 , ) , 'db' => array ( 'class' => 'CDbConnection' , 'connectionString' => "mysql:hos... | Runs the migration tool effectivly installing the database an all appliciable default settings |
48,645 | final public function getDefaultPort ( $ name ) { $ this -> _getPortKey ( $ name ) ; if ( $ this -> isNamedPort ( $ name ) ) { return constant ( $ this -> _port_class . $ name ) ; } else { throw new \ InvalidArgumentException ( "Unknown name or scheme: {$name}" ) ; } } | Get the port number from its name or scheme |
48,646 | final public function isDefaultPort ( $ scheme , $ port ) { $ this -> _getPortKey ( $ scheme ) ; try { return $ this -> isNamedPort ( $ scheme ) and ( $ this -> getDefaultPort ( $ scheme ) === ( int ) $ port ) ; } catch ( \ Exception $ e ) { echo $ e . PHP_EOL ; } } | Checks that the given scheme and port match according to defaults |
48,647 | public function onFlush ( OnFlushEventArgs $ args ) : void { $ em = $ args -> getEntityManager ( ) ; $ uow = $ em -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { foreach ( $ this -> getInvitations ( $ entity ) as $ invitation ) { $ em -> persist ( $ invitation ) ; $ uow -> com... | Listens for the onFlush event . |
48,648 | private function getInvitations ( $ object ) { if ( ! $ object instanceof Event || ! $ object -> getFullCompany ( ) ) { return [ ] ; } $ existing = [ ] ; foreach ( $ object -> getInvitations ( ) as $ existing_invitation ) { $ existing [ ] = $ existing_invitation -> getInvitee ( ) ; } $ invitations = [ ] ; foreach ( $ o... | Helper function that generates new invitations as needed . |
48,649 | public static function register ( ) { foreach ( [ 'post' , 'user' ] as $ type ) { \ register_rest_field ( 'post' === $ type ? get_post_types ( ) : $ type , self :: FIELD_NAME , [ 'get_callback' => [ __CLASS__ , 'get_' . $ type . '_fields' ] ] ) ; } } | Register the field for all post types and users . |
48,650 | static function render ( $ view , array $ data = [ ] ) { if ( file_exists ( $ view ) ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ _data => $ _value ) { if ( Config :: get ( 'security.anti_xss' ) && is_string ( $ _value ) ) { $ _value = Text :: entities ( $ _value ) ; } $ $ _data = $ _value ; } } else { throw ... | Alias read file |
48,651 | private function addServiceInstance ( $ id , Definition $ definition , $ isSimpleInstance ) { $ class = $ this -> dumpValue ( $ definition -> getClass ( ) ) ; if ( 0 === strpos ( $ class , "'" ) && false === strpos ( $ class , '$' ) && ! preg_match ( '/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-z... | Generates the service instance . |
48,652 | private function isTrivialInstance ( Definition $ definition ) { if ( $ definition -> isSynthetic ( ) || $ definition -> getFile ( ) || $ definition -> getMethodCalls ( ) || $ definition -> getProperties ( ) || $ definition -> getConfigurator ( ) ) { return false ; } if ( $ definition -> isDeprecated ( ) || $ definitio... | Checks if the definition is a trivial instance . |
48,653 | private function addServiceMethodCalls ( Definition $ definition , $ variableName = 'instance' ) { $ calls = '' ; foreach ( $ definition -> getMethodCalls ( ) as $ call ) { $ arguments = array ( ) ; foreach ( $ call [ 1 ] as $ value ) { $ arguments [ ] = $ this -> dumpValue ( $ value ) ; } $ calls .= $ this -> wrapServ... | Adds method calls to a service definition . |
48,654 | private function addServiceConfigurator ( Definition $ definition , $ variableName = 'instance' ) { if ( ! $ callable = $ definition -> getConfigurator ( ) ) { return '' ; } if ( is_array ( $ callable ) ) { if ( $ callable [ 0 ] instanceof Reference || ( $ callable [ 0 ] instanceof Definition && $ this -> definitionVar... | Adds configurator definition . |
48,655 | private function addNormalizedIds ( ) { $ code = '' ; $ normalizedIds = $ this -> container -> getNormalizedIds ( ) ; ksort ( $ normalizedIds ) ; foreach ( $ normalizedIds as $ id => $ normalizedId ) { if ( $ this -> container -> has ( $ normalizedId ) ) { $ code .= ' ' . $ this -> doExport ( $ id ) . ' => '... | Adds the normalizedIds property definition . |
48,656 | private function addRemovedIds ( ) { if ( ! $ ids = $ this -> container -> getRemovedIds ( ) ) { return '' ; } if ( $ this -> asFiles ) { $ code = "require \$this->containerDir.\\DIRECTORY_SEPARATOR.'removed-ids.php'" ; } else { $ code = '' ; $ ids = array_keys ( $ ids ) ; sort ( $ ids ) ; foreach ( $ ids as $ id ) { $... | Adds the removedIds definition . |
48,657 | private function addFileMap ( ) { $ code = '' ; $ definitions = $ this -> container -> getDefinitions ( ) ; ksort ( $ definitions ) ; foreach ( $ definitions as $ id => $ definition ) { if ( ! $ definition -> isSynthetic ( ) && $ definition -> isShared ( ) && ! $ this -> isHotPath ( $ definition ) ) { $ code .= sprintf... | Adds the fileMap property definition . |
48,658 | private function getServiceConditionals ( $ value ) { $ conditions = array ( ) ; foreach ( ContainerBuilder :: getInitializedConditionals ( $ value ) as $ service ) { if ( ! $ this -> container -> hasDefinition ( $ service ) ) { return 'false' ; } $ conditions [ ] = sprintf ( "isset(\$this->services['%s'])" , $ service... | Get the conditions to execute for conditional services . |
48,659 | private function getNextVariableName ( ) { $ firstChars = self :: FIRST_CHARS ; $ firstCharsLength = strlen ( $ firstChars ) ; $ nonFirstChars = self :: NON_FIRST_CHARS ; $ nonFirstCharsLength = strlen ( $ nonFirstChars ) ; while ( true ) { $ name = '' ; $ i = $ this -> variableCount ; if ( '' === $ name ) { $ name .= ... | Returns the next name to use . |
48,660 | protected function fieldfillers ( ) { $ fieldrender = $ this -> fieldrender ( ) ; if ( $ this -> hintrenderer !== null ) { $ callable = & $ this -> hintrenderer ; $ hintsrender = $ callable ( $ this -> hints ( ) ) ; } else { $ hintsrender = null ; } if ( $ this -> showerrors && $ this -> errorrenderer ) { $ callable = ... | Hook for adding additional fillers for hotwiring funcitonality . |
48,661 | public static function castFrom ( $ value , string $ name = 'Date' ) : self { if ( is_int ( $ value ) || is_string ( $ value ) || $ value instanceof \ DateTime ) { return new self ( $ value ) ; } if ( ! ( $ value instanceof Date ) ) { throw new \ InvalidArgumentException ( $ name . ' must be a timestamp, a string conta... | casts given value to an instance of Date |
48,662 | public function writeDirectory ( ) { $ toDirectory = dirname ( $ this -> path ) ; if ( ! file_exists ( $ toDirectory ) ) { mkdir ( $ toDirectory , 0770 , true ) ; } if ( ! is_dir ( $ toDirectory ) ) { throw new Concentrate_FileException ( "Could not write to directory {$toDirectory} because it " . "exists and is not a ... | Creates a directory for this path if such a directory does not already exist |
48,663 | public function evaluate ( ) { $ postPath = array ( ) ; $ prePath = array ( ) ; $ path = rtrim ( $ this -> path , '/' ) ; $ pathSegments = explode ( '/' , $ path ) ; foreach ( $ pathSegments as $ segment ) { if ( $ segment == '..' ) { if ( count ( $ postPath ) > 0 ) { array_pop ( $ postPath ) ; } else { array_push ( $ ... | Evaluates a path that contains relative references and removes superfluous current directory references |
48,664 | public function attach ( ObserverInterface $ observer ) { if ( $ this -> isAttached ( $ observer ) ) { return false ; } $ this -> observers [ ] = $ observer ; return true ; } | Returns true if the observer is attached successfully . |
48,665 | public function detach ( ObserverInterface $ observer ) { foreach ( $ this -> observers as $ key => $ value ) { if ( $ value === $ observer ) { unset ( $ this -> observers [ $ key ] ) ; return true ; } } return false ; } | Returns true if the observer is detached successfully . |
48,666 | public function notify ( $ arguments = null ) { foreach ( $ this -> observers as $ observer ) { $ observer -> update ( $ this , $ arguments ) ; } } | Notify all the attached observers . |
48,667 | public function clean ( $ path ) { $ tokens = [ ] ; $ path = $ this -> cleanPath ( $ path ) ; $ prefix = $ this -> prefix ( $ path ) ; $ path = substr ( $ path , strlen ( $ prefix ) ) ; $ parts = array_filter ( explode ( '/' , $ path ) , 'strlen' ) ; foreach ( $ parts as $ part ) { if ( '..' === $ part ) { array_pop ( ... | Normalize and clean path . |
48,668 | public function getPaths ( $ source ) { $ source = $ this -> cleanSource ( $ source ) ; list ( , $ paths ) = $ this -> parse ( $ source ) ; return $ paths ; } | Get all absolute path to a file or a directory . |
48,669 | public function isVirtual ( $ path ) : bool { $ parts = explode ( ':' , $ path , 2 ) ; list ( $ alias ) = $ parts ; $ alias = $ this -> cleanAlias ( $ alias ) ; if ( ! array_key_exists ( $ alias , $ this -> paths ) && $ this -> prefix ( $ path ) !== null ) { return false ; } return count ( $ parts ) === 2 ; } | Check virtual or real path . |
48,670 | public function prefix ( $ path ) { $ path = $ this -> cleanPath ( $ path ) ; return preg_match ( '|^(?P<prefix>([a-zA-Z]+:)?//?)|' , $ path , $ matches ) ? $ matches [ 'prefix' ] : null ; } | Get path prefix . |
48,671 | public function remove ( $ fromSource , $ paths ) : bool { $ paths = ( array ) $ paths ; $ fromSource = $ this -> cleanSource ( $ fromSource ) ; list ( $ alias ) = $ this -> parse ( $ fromSource ) ; $ return = false ; foreach ( $ paths as $ origPath ) { $ path = $ this -> cleanPathInternal ( $ this -> cleanPath ( $ ori... | Remove path from registered paths for source |
48,672 | public function setRoot ( $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new Exception ( sprintf ( 'Not found directory: %s' , $ dir ) ) ; } $ this -> root = $ this -> cleanPath ( $ dir ) ; } | Setup root directory . |
48,673 | public function rel ( $ source ) { $ fullpath = ( string ) $ this -> get ( $ source ) ; return FS :: getRelative ( $ fullpath , $ this -> root , '/' ) ; } | Get relative path to file or directory |
48,674 | public function relGlob ( $ source ) { $ list = ( array ) $ this -> glob ( $ source ) ; foreach ( $ list as $ key => $ item ) { $ list [ $ key ] = FS :: getRelative ( $ item , $ this -> root , '/' ) ; } return $ list ; } | Get list of relative path to file or directory |
48,675 | protected function addNewPath ( $ path , $ alias , $ mode ) { if ( $ cleanPath = $ this -> cleanPathInternal ( $ path ) ) { if ( $ mode === self :: MOD_PREPEND ) { array_unshift ( $ this -> paths [ $ alias ] , $ cleanPath ) ; } if ( $ mode === self :: MOD_APPEND ) { $ this -> paths [ $ alias ] [ ] = $ cleanPath ; } } } | Add path to hold . |
48,676 | protected function find ( $ paths , $ file , $ isGlob = false ) { $ paths = ( array ) $ paths ; $ file = ltrim ( $ file , "\\/" ) ; foreach ( $ paths as $ path ) { $ fullPath = $ this -> clean ( $ path . '/' . $ file ) ; if ( $ isGlob ) { $ paths = glob ( $ fullPath , GLOB_BRACE ) ; $ paths = array_filter ( ( array ) $... | Find actual file or directory in the paths . |
48,677 | protected function cleanPathInternal ( $ path ) { if ( $ this -> isVirtual ( $ path ) ) { return $ this -> cleanPath ( $ path ) ; } if ( $ this -> hasCDBack ( $ path ) ) { $ realpath = $ this -> cleanPath ( realpath ( $ path ) ) ; return $ realpath ? : null ; } return $ this -> cleanPath ( $ path ) ; } | Get add path . |
48,678 | protected function getUrlPath ( $ path , $ exitsFile = false ) : string { $ this -> checkRoot ( ) ; $ path = $ this -> cleanPathInternal ( $ path ) ; if ( $ this -> isVirtual ( $ path ) ) { $ path = $ this -> get ( $ path ) ; } $ subject = $ path ; $ pattern = '/^' . preg_quote ( $ this -> root , '/' ) . '/i' ; if ( $ ... | Get url path . |
48,679 | protected function parse ( $ source ) : array { $ path = null ; list ( $ alias , $ path ) = explode ( ':' , $ source , 2 ) ; $ path = ltrim ( $ path , "\\/" ) ; $ paths = $ this -> resolvePaths ( $ alias ) ; return [ $ alias , $ paths , $ path ] ; } | Parse source string . |
48,680 | protected function Init ( ) { $ this -> container = new Container ( Request :: GetData ( 'container' ) ) ; $ this -> containerRights = new ContainerRights ( $ this -> container -> GetUserGroupRights ( ) ) ; $ this -> AddNameField ( ) ; $ this -> AddUserGroupField ( ) ; $ this -> AddSubmit ( ) ; return parent :: Init ( ... | Initializes the container form |
48,681 | protected function OnSuccess ( ) { $ action = Action :: Update ( ) ; if ( ! $ this -> container -> Exists ( ) ) { $ action = Action :: Create ( ) ; $ this -> container -> SetUser ( self :: Guard ( ) -> GetUser ( ) ) ; } $ this -> container -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> container -> Save ( ) ; $ ... | Saves the container |
48,682 | private function SaveRights ( ) { $ groupID = $ this -> Value ( 'UserGroup' ) ; $ userGroup = Usergroup :: Schema ( ) -> ByID ( $ groupID ) ; $ this -> container -> SetUserGroup ( $ userGroup ) ; if ( ! $ userGroup ) { $ oldRights = $ this -> container -> GetUserGroupRights ( ) ; if ( $ oldRights ) { $ oldRights -> Get... | Saves group and rights |
48,683 | public function mergeCopyWith ( $ other , $ notNull = true ) { $ copy = clone $ this ; if ( $ other === $ this ) { return $ copy ; } if ( $ other instanceof self ) { foreach ( $ other -> toArray ( $ notNull ) as $ key => $ value ) { if ( property_exists ( $ copy , $ key ) ) { $ copy -> $ key = $ value ; } } } elseif ( ... | Create copy of this configuration with merged other data . |
48,684 | public final function setWidth ( int $ width ) : Size { $ this -> triggerFixedErrorByNeed ( 'width-change' ) ; $ this -> _width = \ max ( $ width , 0 ) ; return $ this ; } | Sets the width . |
48,685 | public final function setHeight ( int $ height ) : Size { $ this -> triggerFixedErrorByNeed ( 'height-change' ) ; $ this -> _height = \ max ( $ height , 0 ) ; return $ this ; } | Sets the height . |
48,686 | public final function contains ( Size $ size ) : bool { return ( ( $ size -> _width <= $ this -> _width ) && ( $ size -> _height <= $ this -> _height ) ) ; } | Returns if the current size can contain the size dimensions of the defined size . |
48,687 | public final function isNearQuadratic ( float $ maxDifference = 0.15 ) : bool { if ( $ this -> isQuadratic ( ) ) { return true ; } if ( $ maxDifference >= 0.01 && $ maxDifference <= 0.3 ) { $ diff = 1.0 + $ maxDifference ; } else { $ diff = 1.15 ; } if ( $ this -> isPortrait ( ) ) { return ( ( 0.0 + $ this -> _height )... | Returns if the current size uses a near quadratic format . It means if width and height difference is lower or equal to ?? percent . |
48,688 | public final function reduceToMaxSize ( Size $ maxSize ) : bool { $ this -> triggerFixedErrorByNeed ( 'reduceToMaxSize' ) ; if ( ( $ this -> _width < $ maxSize -> _width ) && ( $ this -> _height < $ maxSize -> _height ) ) { return false ; } if ( ( $ this -> _width === $ maxSize -> _width ) && ( $ this -> _height === $ ... | Decrease the current size to fit the defined Size by holding its proportions . |
48,689 | public final function reduceMinSideTo ( int $ newShortSideLength ) : bool { $ this -> triggerFixedErrorByNeed ( 'reduceMinSideTo' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newShortSideLength >= $ this -> _width ) { return false ; } $ resultPercent = ( 100 * $ newShortSideLength ) / $ this -> _width ; $ this -> _heig... | Decrease the shortest side to the defined length and also contracts the longer side to hold the proportion of this size . If the current size defines a quadratic size it is also decreased but with searching the longer side . |
48,690 | public final function reduceMinSideTo2 ( int $ newLandscapeMaxHeight , int $ newPortraitMaxWidth ) : bool { $ this -> triggerFixedErrorByNeed ( 'reduceMinSideTo2' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newPortraitMaxWidth >= $ this -> _width ) { return false ; } $ resultPercent = ( 100 * $ newPortraitMaxWidth ) /... | Decrease the shortest side to the defined length and also contracts the longer side to hold the proportion of this size . The value used as max side length is depending to the current size format . |
48,691 | public final function expandMaxSideTo ( int $ newMaxSideLength ) : bool { $ this -> triggerFixedErrorByNeed ( 'expandMaxSideTo' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newMaxSideLength < $ this -> _height ) { return false ; } $ resultPercent = ( 100 * $ newMaxSideLength ) / $ this -> _height ; $ this -> _width = \... | Expands the longest side to the defined length and also expands the shorter side to hold the proportion of this size . If the current size defines a quadratic size its also expanded but without searching the longer side . |
48,692 | public final function expandMaxSideTo2 ( int $ newLandscapeMaxWidth , int $ newPortraitMaxHeight ) : bool { $ this -> triggerFixedErrorByNeed ( 'expandMaxSideTo2' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newPortraitMaxHeight <= $ this -> _height ) { return false ; } $ resultPercent = ( 100 * $ newPortraitMaxHeight ... | Expands the longest side to the defined length and also expands the shorter side to hold the proportion of this size . The value used as max side length is depending to the current size format . |
48,693 | public final function resizeMaxSideTo2 ( int $ newLandscapeWidth , int $ newPortraitHeight ) : bool { if ( $ this -> isPortrait ( ) ) { if ( $ newPortraitHeight == $ this -> _height ) { return false ; } if ( $ newPortraitHeight < $ this -> _height ) { return $ this -> reduceMaxSideTo2 ( $ newLandscapeWidth , $ newPortr... | Resize the longest side to the defined length and also resize the shorter side to hold the proportion of this size . The value used as max side length is depending to the current size format . |
48,694 | public static function TryParse ( $ value , & $ size , bool $ fixed = false ) : bool { $ size = null ; if ( \ is_int ( $ value ) ) { $ size = new Size ( $ value , $ value , $ fixed ) ; return true ; } if ( \ is_double ( $ value ) ) { $ size = new Size ( ( int ) $ value , ( int ) $ value , $ fixed ) ; return true ; } if... | Tries to parse the the defined values as a size and returns the success state . |
48,695 | public static function Empty ( bool $ fixed = false ) : Size { if ( $ fixed ) { return \ is_null ( static :: $ emptyFixed ) ? ( static :: $ emptyFixed = new Size ( 0 , 0 , true ) ) : static :: $ emptyFixed ; } return new Size ( 0 , 0 , $ fixed ) ; } | Gets a empty Size instance . |
48,696 | public function getAllSections ( ) { $ sections = array ( ) ; $ section = $ this -> section ; do { $ sections [ ] = $ section ; } while ( $ section = $ section -> getSectionConfig ( ) -> getParentSection ( ) ) ; return array_reverse ( $ sections ) ; } | Recursively gets all the sections |
48,697 | public function xml2array ( ) : void { $ this -> xml2json ( ) ; $ this -> arrayData = json_decode ( $ this -> jsonData , TRUE ) ; } | Convert XML to Array |
48,698 | public function array2xml ( string $ xmlField = '' , ? string $ dataField = null ) : void { $ xml = new SimpleXMLElement ( '<?xml version="1.0" encoding="UTF-8"?><' . $ xmlField . '/>' ) ; $ this -> createXml ( $ xml , $ this -> arrayData , $ dataField ) ; $ this -> xmlData = $ xml -> asXML ( ) ; } | Convert Array to XML |
48,699 | private function createXml ( SimpleXMLElement $ obj , array $ array , ? string $ prevKey = 'data' ) : void { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( is_numeric ( $ key ) ) { $ node = $ obj -> addChild ( $ prevKey ) ; $ this -> createXml ( $ node , $ value ) ; } elseif ( $ key == '@a... | Private method to create XML output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.