idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
48,100
public function watchOutput ( ) { $ arguments = $ _SERVER [ 'argv' ] ; unset ( $ arguments [ 0 ] ) ; $ argumentsCount = $ _SERVER [ 'argc' ] - 1 ; $ arguments = array_values ( $ arguments ) ; if ( $ argumentsCount > 0 ) { $ commandId = $ arguments [ 0 ] ; if ( ! Command :: hasCommand ( $ commandId ) ) { return $ this -...
Processes called command and returns it s output .
48,101
public function question ( String $ question ) { $ this -> env -> sendOutput ( $ question ) ; return $ this -> env -> getOutputOption ( ) ; }
Sends output to user as a question and returns response .
48,102
public function sort ( ) { parent :: sort ( ) ; Helper :: mapMethod ( $ this -> _records , 'sort' ) ; usort ( $ this -> _records , array ( $ this , 'compareRecords' ) ) ; }
Sort fields and contained records .
48,103
public function isEmpty ( ) { return parent :: isEmpty ( ) && Helper :: every ( $ this -> _records , function ( Record $ record ) { return $ record -> isEmpty ( ) ; } ) ; }
Return true if the record is empty .
48,104
protected function addRecord ( Record $ record ) { if ( $ this -> containsRecord ( $ record ) ) { throw new InvalidArgumentException ( "{$this} already contains {$record}" ) ; } $ this -> _records [ ] = $ record ; }
Add a record as a contained record .
48,105
protected function removeRecord ( Record $ record ) { $ index = array_search ( $ record , $ this -> _records , true ) ; if ( $ index === false ) { throw new InvalidArgumentException ( "{$this} does not contain {$record}" ) ; } unset ( $ this -> _records [ $ index ] ) ; }
Remove a contained record .
48,106
public function alwaysShowAuthorMetabox ( $ hidden , $ screen ) { if ( $ screen -> post_type != 'page' ) { return $ hidden ; } $ hidden = array_filter ( $ hidden , function ( $ item ) { return $ item != 'authordiv' ; } ) ; return $ hidden ; }
Display the author metabox by default
48,107
public function getIndexUrl ( array $ params = array ( ) , array $ options = array ( ) ) { return $ this -> url ( ) -> fromRoute ( $ this -> getEvent ( ) -> getRouteMatch ( ) -> getMatchedRouteName ( ) , array_merge ( array ( 'action' => 'index' ) , $ params ) , $ options ) ; }
Default implementation of this method returns entity index URL using matched route name and setting action = index If you have different routes set overwrite this method in your concrete controller
48,108
public function setEventManager ( EventManagerInterface $ events ) { $ events -> setIdentifiers ( array ( 'Zend\Stdlib\DispatchableInterface' , 'Zend\Mvc\Controller\AbstractController' , 'Zend\Mvc\Controller\AbstractActionController' , __CLASS__ , get_called_class ( ) , $ this -> eventIdentifier , substr ( get_called_c...
Adds all subclass identifiers
48,109
public function queue ( $ event ) { $ connection = $ event instanceof ShouldBroadcastNow ? 'sync' : null ; if ( is_null ( $ connection ) && isset ( $ event -> connection ) ) { $ connection = $ event -> connection ; } $ queue = null ; if ( method_exists ( $ event , 'broadcastQueue' ) ) { $ queue = $ event -> broadcastQu...
Queue the given event for broadcast .
48,110
public static function safe ( string $ string , string $ regex = self :: SAFE ) { if ( preg_match ( $ regex , $ string ) ) : return $ string ; else : return false ; endif ; }
Determine if a string contains any bad characters .
48,111
public static function clean ( string $ string , string $ replace = "" , string $ regex = self :: CLEAN ) { if ( $ replace === null ) : $ replace = "" ; endif ; if ( $ regex === null ) : $ regex = self :: CLEAN ; endif ; return preg_replace ( $ regex , $ replace , $ string ) ; }
Clean a string by removing any characters we don t want .
48,112
public static function replaceFirst ( string $ search , string $ replace , string $ subject ) { $ pos = strpos ( $ subject , $ search ) ; if ( $ pos !== false ) { return substr_replace ( $ subject , $ replace , $ pos , strlen ( $ search ) ) ; } return $ subject ; }
Replace the first instance of a string in another string if it exists .
48,113
public static function addNew ( string $ add , string $ existing , string $ concatenateWith = ' ' ) { if ( ! strpos ( $ existing , $ add ) ) : return sprintf ( "%s%s%s" , $ existing , $ concatenateWith , $ add ) ; endif ; return $ existing ; }
Concatenates a string to another string if it isn t already a substring of it .
48,114
public function toSQL ( Parameters $ params , bool $ inner_clause ) { return "LIMIT " . $ params -> getDriver ( ) -> toSQL ( $ params , $ this -> getLimit ( ) ) ; }
Write a LIMIT clause to SQL query syntax
48,115
public function add ( PatternInterface $ pattern ) { $ this -> collection [ $ this -> length ] = $ pattern ; $ this -> length ++ ; return $ this ; }
Add pattern object to the collection .
48,116
static public function conversionFailedInvalidType ( $ value , $ toType , array $ possibleTypes ) { $ actualType = is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ; if ( is_scalar ( $ value ) ) { return new self ( sprintf ( "Could not convert PHP value '%s' of type '%s' to type '%s'. Expected one of...
Thrown when the PHP value passed to the type converter was not of the expected type .
48,117
public function toAttr ( $ prefix = '' , $ suffix = '' ) { $ attrs = array ( ) ; if ( $ this -> width !== FALSE ) { $ attrs [ ] = 'width="' . addslashes ( $ this -> width ) . '"' ; } if ( $ this -> height !== FALSE ) { $ attrs [ ] = 'height="' . addslashes ( $ this -> height ) . '"' ; } return $ prefix . implode ( ' ' ...
translate the current dimension data to attribute width = xxx height = yyy
48,118
public function init ( $ configArrayOrPathToConfig ) { $ config = include ( dirname ( __DIR__ ) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'default.php' ) ; if ( is_array ( $ configArrayOrPathToConfig ) ) { $ config = array_replace_recursive ( $ config , $ configArrayOrPathToConfig ) ; } if ( is_string ( ...
Init application with config
48,119
public function getAllowedMethods ( $ token ) { $ token = ( string ) $ token ; $ array = ( isset ( $ this -> config [ 'tokens' ] [ $ token ] ) ) ? $ this -> config [ 'tokens' ] [ $ token ] : array ( ) ; $ allowed = array_merge_recursive ( $ this -> config [ 'tokens' ] [ '*' ] , $ array ) ; $ allowed = array_change_key_...
Return Allowed methods for token
48,120
public function isAllow ( $ object , $ method , $ token ) { $ allowed = $ this -> getAllowedMethods ( $ token ) ; $ object = mb_strtolower ( $ object ) ; $ method = mb_strtolower ( $ method ) ; $ allow = false ; if ( ( isset ( $ allowed [ $ object ] ) && in_array ( $ method , $ allowed [ $ object ] ) ) || ( isset ( $ a...
Check for method allow
48,121
public function getRepository ( $ repositoryName ) { $ repositoryName = ( string ) $ repositoryName ; if ( ! isset ( $ this -> config [ 'repositories' ] [ $ repositoryName ] [ 'class' ] ) ) return false ; $ className = $ this -> config [ 'repositories' ] [ $ repositoryName ] [ 'class' ] ; if ( ! class_exists ( $ classN...
Return repository object
48,122
public static function startsWith ( $ haystack , $ needle ) { if ( $ needle === null && $ haystack === null ) return false ; if ( $ needle === null && $ haystack !== null ) return true ; return $ needle === "" || strrpos ( $ haystack , $ needle , - strlen ( $ haystack ) ) !== false ; }
Checks if the haystack starts with needle
48,123
public static function endsWith ( $ haystack , $ needle ) { if ( $ needle === null && $ haystack === null ) return true ; if ( $ needle === null && $ haystack !== null ) return true ; return $ needle === "" || ( ( $ temp = strlen ( $ haystack ) - strlen ( $ needle ) ) >= 0 && strpos ( $ haystack , $ needle , $ temp ) !...
Checks if the haystack ends with needle
48,124
public static function excerpt ( $ text , $ phrase , $ radius = 100 , $ ending = "..." ) { $ phrases = is_array ( $ phrase ) ? $ phrase : array ( $ phrase ) ; $ phraseLen = strlen ( implode ( ' ' , $ phrases ) ) ; if ( $ radius < $ phraseLen ) { $ radius = $ phraseLen ; } foreach ( $ phrases as $ phrase ) { $ pos = str...
Creates an excerpt from the given text based on the passed phrase
48,125
public static function hashCode ( $ string ) { $ hash = 0 ; if ( ! is_string ( $ string ) ) { return $ hash ; } $ len = mb_strlen ( $ string , 'UTF-8' ) ; if ( $ len === 0 ) { return $ hash ; } for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ c = mb_substr ( $ string , $ i , 1 , 'UTF-8' ) ; $ cc = unpack ( 'V' , iconv ( 'UTF...
Get an integer based hash code of the given string .
48,126
static function removeHtmlTag ( $ text ) { $ text = htmlspecialchars_decode ( $ text ) ; $ text = html_entity_decode ( $ text ) ; $ text = strip_tags ( $ text ) ; return $ text ; }
Entfernt Html Tags und Umlaute
48,127
public function serialize ( $ data ) { if ( is_string ( $ data ) === true ) { return $ data ; } else { $ data = json_encode ( $ data ) ; if ( $ data === '[]' ) { return '{}' ; } else { return $ data ; } } }
Serialize assoc array into JSON string
48,128
public function deserialize ( $ data ) { $ result = json_decode ( $ data , true ) ; if ( $ result === null ) { return $ data ; } return $ result ; }
Deserialize JSON into an assoc array
48,129
public function process ( DatabaseLayer \ VirtualQuery $ thing ) { switch ( $ thing -> getOperation ( ) ) { case 'Insert' : return $ this -> processInsert ( $ thing ) ; case 'Select' : return $ this -> processSelect ( $ thing ) ; case 'Update' : return $ this -> processUpdate ( $ thing ) ; case 'Delete' : return $ this...
Turn a VirtualQuery into a SQL statement
48,130
public function findLastCreatedOnline ( $ qt ) { $ query_builder = $ this -> getBaseBuilder ( ) ; $ this -> FilterByTranslationStatus ( $ query_builder , PostTranslation :: STATUS_PUBLISHED ) ; $ query_builder -> setMaxResults ( $ qt ) ; return $ query_builder ; }
Return a query for last crated post .
48,131
public function addFileTypeSetsToCategory ( \ Category $ category , $ dbResultCategory ) { $ arrFileTypesOfSets = array ( ) ; $ arrFileTypeSetIds = deserialize ( $ dbResultCategory -> file_type_sets ) ; if ( ! empty ( $ arrFileTypeSetIds ) ) { foreach ( $ arrFileTypeSetIds as $ arrFileTypeSetId ) { $ arrFileTypesOfSets...
Modify loaded categories .
48,132
public function setMethod ( $ method = null ) { if ( $ method === null ) { $ method = isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) ? $ _SERVER [ 'REQUEST_METHOD' ] : null ; } $ this -> method = $ method ; }
Sets the HTTP method of the request . If the provided value is null it is automatically detected from the environment .
48,133
public function getParameter ( $ parameter , $ default = null ) { if ( ! isset ( $ this -> parameters [ $ parameter ] ) ) { return $ default ; } return $ this -> parameters [ $ parameter ] ; }
Returns the value of a single query string parameter .
48,134
public function setContentType ( $ contentType = null ) { if ( $ contentType === null ) { $ contentType = isset ( $ _SERVER [ 'CONTENT_TYPE' ] ) ? $ _SERVER [ 'CONTENT_TYPE' ] : null ; } $ this -> contentType = $ contentType ; }
Sets the content type of the request content . If the provided value is null it is automatically detected from the environment .
48,135
public function getVarForDisplay ( ) { if ( is_object ( $ this -> var ) ) { $ output = "object " . get_class ( $ this -> var ) ; } elseif ( is_string ( $ this -> var ) or is_array ( $ this -> var ) ) { $ type = is_string ( $ this -> var ) ? 'string' : 'array' ; $ working = json_encode ( $ this -> var ) ; $ length = str...
Get a human readable representation of the passed varibale
48,136
final public function addFilters ( $ elementName , array $ filters ) { $ this -> elements [ $ elementName ] -> filters -> add ( $ filters ) ; return $ this ; }
Add filters to specified element
48,137
private function validate ( ) { $ filterer = new Filterer ( ) ; $ valid = true ; foreach ( $ this -> elements as $ element ) { if ( ! $ element -> validate ( $ filterer , $ this -> data ) ) $ valid = false ; $ this -> data [ $ element -> name ] = ( $ element -> type === 'fieldset' ) ? $ element -> options -> value -> g...
Validates the data
48,138
public function group ( string $ logical = ValuesGroup :: GROUP_LOGICAL_AND ) : self { $ builder = new self ( $ logical , $ this -> fieldSet , $ this ) ; $ this -> valuesGroup -> addGroup ( $ builder -> getGroup ( ) ) ; return $ builder ; }
Create a new ValuesGroup and returns the object instance .
48,139
public function getSearchCondition ( ) : SearchCondition { if ( $ this -> parent ) { return $ this -> parent -> getSearchCondition ( ) ; } $ rootValuesGroup = new ValuesGroup ( $ this -> valuesGroup -> getGroupLogical ( ) ) ; $ this -> normalizeValueGroup ( $ this -> valuesGroup , $ rootValuesGroup ) ; return new Searc...
Build the SearchCondition object using the groups and fields .
48,140
public function create ( ) { $ entityClass = $ this -> getEntityName ( ) ; $ reflection = new \ ReflectionClass ( $ entityClass ) ; if ( $ reflection -> isAbstract ( ) ) { throw RuntimeException :: createAbstract ( $ entityClass ) ; } return new $ entityClass ( ) ; }
Creates an instance of the entity .
48,141
protected function singleEntity ( $ entity ) { if ( empty ( $ entity ) ) { return null ; } $ singleEntity = $ entity ; if ( is_array ( $ entity ) ) { if ( count ( $ entity ) > 1 ) { throw RuntimeException :: multipleResultsFound ( ) ; } $ singleEntity = reset ( $ entity ) ; } $ entityClass = $ this -> getEntityName ( )...
Makes sure a result contains a single result .
48,142
public function checkIsEntity ( $ object ) { if ( ! $ object instanceof $ this -> entityName ) { throw InvalidArgumentException :: invalidEntityType ( $ this -> getEntityName ( ) , $ object ) ; } }
Checks the given entity is an instance of the entity this mapper works with .
48,143
protected function setPrototype ( $ prototype ) { if ( $ this -> entityName ) { throw RuntimeException :: setPrototypeCalledAgain ( ) ; } $ this -> entityName = is_object ( $ prototype ) ? get_class ( $ prototype ) : $ prototype ; }
Setup the prototype of the entity this mapper works with .
48,144
public static function havingComplete ( $ array ) { $ c = 0 ; $ r = "" ; if ( is_array ( $ array ) ) foreach ( $ array as $ k => $ v ) { if ( $ c ) $ r .= " AND " ; if ( strpos ( $ v , ":" ) !== false ) { $ vArray = explode ( ":" , $ v ) ; if ( $ vArray [ 0 ] <= $ vArray [ 1 ] ) $ r .= "(" . $ k . " BETWEEN " . $ vArra...
not in use needs improves and tests
48,145
public static function parseDate ( $ date , $ format ) { if ( $ format == "d/m/Y" ) return self :: parseDate1 ( $ date , $ format ) ; if ( $ format == "Y-m-d" ) return self :: parseDate2 ( $ date , $ format ) ; return null ; }
Helps for data manipulation
48,146
protected function Bundles ( ) { $ bundles = PathUtil :: Bundles ( ) ; $ result = array ( ) ; foreach ( $ bundles as $ bundle ) { if ( count ( $ this -> Modules ( $ bundle ) ) > 0 ) { $ result [ ] = $ bundle ; } } return $ result ; }
Gets all bundles containing backend modules
48,147
protected function Modules ( $ bundle ) { $ modules = PathUtil :: BackendModules ( $ bundle ) ; $ result = array ( ) ; foreach ( $ modules as $ module ) { $ instance = ClassFinder :: CreateBackendModule ( ClassFinder :: CalcModuleType ( $ bundle , $ module ) ) ; if ( $ instance instanceof BackendModule ) { $ result [ ]...
Gets all backend module names for a bundle
48,148
private function HasLock ( $ bundle , $ module = '' ) { $ sql = Access :: SqlBuilder ( ) ; $ tblModLock = ModuleLock :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblModLock -> Field ( 'Bundle' ) , $ sql -> Value ( $ bundle ) ) -> And_ ( $ sql -> Equals ( $ tblModLock -> Field ( 'Module' ) , $ sql -> Value...
True if a lock with given bundle and module are set
48,149
public function initView ( $ path = null , $ prefix = null , array $ options = array ( ) ) { $ this -> setView ( $ this -> getServiceLocator ( ) -> get ( 'View' ) ) ; parent :: initView ( $ path , $ prefix , $ options ) ; }
Initialize the view object
48,150
private function getSQL ( ) { $ sql = $ this -> getTypeSQL ( ) . $ this -> getWhereSQL ( ) . $ this -> getOrderSQL ( ) . $ this -> getLimitSQL ( ) . $ this -> getOffsetSQL ( ) ; return $ sql ; }
Private functions to help build the SQL statement named parameter bindings
48,151
public function commit ( ) { if ( ! is_null ( $ this -> _changes ) ) { $ this -> _commit ( $ this -> _changes ) ; $ this -> _changes = null ; } }
Commit changes to real FS
48,152
private function _commit ( Wrapper_FS_Changes $ changes , $ path = "" ) { $ root = $ this -> getRoot ( ) ; $ rootpath = $ root -> path ( ) ; if ( $ path ) { $ path .= "/" ; } $ own = $ changes -> own ( ) ; foreach ( $ own as $ filename => $ vEntity ) { $ filepath = $ path . $ filename ; $ rPath = $ rootpath . "/" . $ f...
Commit changes into real FS
48,153
private function _copyChanges ( $ path ) { $ entity = $ this -> getEntity ( $ path ) ; $ source = $ entity -> path ( ) ; $ root = $ this -> getRoot ( ) -> path ( ) ; $ destination = $ root . "/" . $ path ; if ( $ entity -> is_file ( ) ) { copy ( $ source , $ destination ) ; } else { $ mode = fileperms ( $ source ) ; mk...
Copy new virtual files to real fs
48,154
final public function setSeparator ( $ separator ) { if ( ! is_string ( $ separator ) ) { throw new InvalidArgumentException ( 'Separator must be a string' ) ; } if ( strlen ( $ separator ) > 1 ) { throw new InvalidArgumentException ( 'Separator must be one-character, or empty' ) ; } $ this -> separator = $ separator ;...
Sets the token for traversing a data - tree .
48,155
final protected function hasWithSeparator ( $ key ) { $ structure = $ this ; $ splitKeys = explode ( $ this -> separator , $ key ) ; foreach ( $ splitKeys as $ key ) { if ( ! isset ( $ structure [ $ key ] ) ) { return false ; } if ( ! is_array ( $ structure [ $ key ] ) ) { return true ; } $ structure = $ structure [ $ ...
Determines if this store contains the key - path and if its value is not NULL .
48,156
final protected function getWithSeparator ( $ key ) { $ structure = $ this ; $ splitKeys = explode ( $ this -> separator , $ key ) ; foreach ( $ splitKeys as $ key ) { if ( ! isset ( $ structure [ $ key ] ) ) { return null ; } if ( ! is_array ( $ structure [ $ key ] ) ) { return $ structure [ $ key ] ; } $ structure = ...
Returns the value from the key - path found on this object .
48,157
private function config ( ) { if ( realpath ( $ this -> configPath ) !== false ) { $ json = file_get_contents ( $ this -> configPath ) ; $ this -> config = json_decode ( $ json ) ; $ this -> config -> rootDir = $ this -> rootDir ; } else { throw new \ RuntimeException ( 'Framework not initialized yet. Consider running ...
Initialize the config
48,158
private function storage ( ) { $ this -> storage = new Storage ( $ this -> config -> rootDir . DIRECTORY_SEPARATOR . $ this -> config -> storageDir , $ this -> config -> rootDir . DIRECTORY_SEPARATOR . $ this -> config -> imagesDir , $ this -> config -> rootDir . DIRECTORY_SEPARATOR . $ this -> config -> filesDir ) ; }
Initialize the storage
48,159
public function digipolisSwitchPrevious ( $ releasesDir , $ currentSymlink ) { $ finder = new Finder ( ) ; $ releases = iterator_to_array ( $ finder -> directories ( ) -> in ( $ releasesDir ) -> sortByName ( ) -> depth ( 0 ) -> getIterator ( ) ) ; array_pop ( $ releases ) ; if ( $ releases ) { $ currentDir = readlink (...
Switch the current release symlink to the previous release .
48,160
public function digipolisMirrorDir ( $ dir , $ destination ) { if ( ! is_dir ( $ dir ) ) { return ; } $ task = $ this -> taskFilesystemStack ( ) ; $ task -> mkdir ( $ destination ) ; $ directoryIterator = new \ RecursiveDirectoryIterator ( $ dir , \ RecursiveDirectoryIterator :: SKIP_DOTS ) ; $ recursiveIterator = new ...
Mirror a directory .
48,161
protected function buildTask ( $ archivename = null ) { $ this -> readProperties ( ) ; $ archive = is_null ( $ archivename ) ? $ this -> time . '.tar.gz' : $ archivename ; $ collection = $ this -> collectionBuilder ( ) ; $ collection -> taskPackageProject ( $ archive ) ; return $ collection ; }
Build a site and package it .
48,162
protected function postSymlinkTask ( $ worker , AbstractAuth $ auth , $ remote ) { if ( isset ( $ remote [ 'postsymlink_filechecks' ] ) && $ remote [ 'postsymlink_filechecks' ] ) { $ projectRoot = $ remote [ 'rootdir' ] ; $ collection = $ this -> collectionBuilder ( ) ; $ collection -> taskSsh ( $ worker , $ auth ) -> ...
Tasks to execute after creating the symlinks .
48,163
protected function preSymlinkTask ( $ worker , AbstractAuth $ auth , $ remote ) { $ projectRoot = $ remote [ 'rootdir' ] ; $ collection = $ this -> collectionBuilder ( ) ; $ collection -> taskSsh ( $ worker , $ auth ) -> remoteDirectory ( $ projectRoot , true ) -> timeout ( $ this -> getTimeoutSetting ( 'presymlink_mir...
Tasks to execute before creating the symlinks .
48,164
protected function initRemoteTask ( $ worker , AbstractAuth $ auth , $ remote , $ extra = [ ] , $ force = false ) { $ collection = $ this -> collectionBuilder ( ) ; if ( ! $ this -> isSiteInstalled ( $ worker , $ auth , $ remote ) || $ force ) { $ this -> say ( $ force ? 'Forcing site install.' : 'Site status failed.' ...
Install or update a remote site .
48,165
protected function removeBackupTask ( $ worker , AbstractAuth $ auth , $ remote , $ opts = [ 'files' => false , 'data' => false ] ) { $ backupDir = $ remote [ 'backupsdir' ] . '/' . $ remote [ 'time' ] ; $ collection = $ this -> collectionBuilder ( ) ; $ collection -> taskSsh ( $ worker , $ auth ) -> timeout ( $ this -...
Remove a backup .
48,166
protected function preRestoreBackupTask ( $ worker , AbstractAuth $ auth , $ remote , $ opts = [ 'files' => false , 'data' => false ] ) { if ( ! $ opts [ 'files' ] && ! $ opts [ 'data' ] ) { $ opts [ 'files' ] = true ; $ opts [ 'data' ] = true ; } if ( $ opts [ 'files' ] ) { $ removeFiles = 'rm -rf' ; if ( ! $ this -> ...
Pre restore backup task .
48,167
protected function pushPackageTask ( $ worker , AbstractAuth $ auth , $ remote , $ archivename = null ) { $ archive = is_null ( $ archivename ) ? $ remote [ 'time' ] . '.tar.gz' : $ archivename ; $ releaseDir = $ remote [ 'releasesdir' ] . '/' . $ remote [ 'time' ] ; $ collection = $ this -> collectionBuilder ( ) ; $ c...
Push a package to the server .
48,168
protected function switchPreviousTask ( $ worker , AbstractAuth $ auth , $ remote ) { return $ this -> taskSsh ( $ worker , $ auth ) -> remoteDirectory ( $ this -> getCurrentProjectRoot ( $ worker , $ auth , $ remote ) , true ) -> exec ( 'vendor/bin/robo digipolis:switch-previous ' . $ remote [ 'releasesdir' ] . ' ' . ...
Switch the current symlink to the previous release on the server .
48,169
protected function removeFailedRelease ( $ worker , AbstractAuth $ auth , $ remote , $ releaseDirname = null ) { $ releaseDir = is_null ( $ releaseDirname ) ? $ remote [ 'releasesdir' ] . '/' . $ remote [ 'time' ] : $ releaseDirname ; return $ this -> taskSsh ( $ worker , $ auth ) -> remoteDirectory ( $ remote [ 'rootd...
Remove a failed release from the server .
48,170
protected function symlinksTask ( $ worker , AbstractAuth $ auth , $ remote ) { $ collection = $ this -> collectionBuilder ( ) ; foreach ( $ remote [ 'symlinks' ] as $ link ) { $ collection -> taskSsh ( $ worker , $ auth ) -> exec ( 'ln -s -T -f ' . str_replace ( ':' , ' ' , $ link ) ) ; } return $ collection ; }
Create all required symlinks on the server .
48,171
protected function clearOpCacheTask ( $ worker , AbstractAuth $ auth , $ remote ) { $ clearOpcache = 'vendor/bin/robo digipolis:clear-op-cache ' . $ remote [ 'opcache' ] [ 'env' ] ; if ( isset ( $ remote [ 'opcache' ] [ 'host' ] ) ) { $ clearOpcache .= ' --host=' . $ remote [ 'opcache' ] [ 'host' ] ; } return $ this ->...
Clear OPcache on the server .
48,172
protected function cleanDirsTask ( $ worker , AbstractAuth $ auth , $ remote ) { $ cleandirLimit = isset ( $ remote [ 'cleandir_limit' ] ) ? max ( 1 , $ remote [ 'cleandir_limit' ] ) : '' ; $ task = $ this -> taskSsh ( $ worker , $ auth ) -> remoteDirectory ( $ remote [ 'rootdir' ] , true ) -> timeout ( $ this -> getTi...
Clean the release and backup directories on the server .
48,173
protected function tokenReplace ( $ input , $ replacements ) { if ( is_string ( $ input ) ) { return strtr ( $ input , $ replacements ) ; } if ( is_scalar ( $ input ) || empty ( $ input ) ) { return $ input ; } foreach ( $ input as & $ i ) { $ i = $ this -> tokenReplace ( $ i , $ replacements ) ; } return $ input ; }
Helper functions to replace tokens in an array .
48,174
protected function backupFileName ( $ extension , $ timestamp = null ) { if ( is_null ( $ timestamp ) ) { $ timestamp = $ this -> time ; } return $ timestamp . '_' . date ( 'Y_m_d_H_i_s' , $ timestamp ) . $ extension ; }
Generate a backup filename based on the given time .
48,175
protected function getRemoteSettings ( $ host , $ user , $ keyFile , $ app , $ timestamp = null ) { $ this -> readProperties ( ) ; $ defaults = [ 'user' => $ user , 'private-key' => $ keyFile , 'app' => $ app , 'createbackup' => true , 'time' => is_null ( $ timestamp ) ? $ this -> time : $ timestamp , ] ; $ replacement...
Get the settings from the remote config key with the tokens replaced .
48,176
protected function getLocalSettings ( $ app = null , $ timestamp = null ) { $ this -> readProperties ( ) ; $ defaults = [ 'app' => $ app , 'time' => is_null ( $ timestamp ) ? $ this -> time : $ timestamp , 'project_root' => $ this -> getConfig ( ) -> get ( 'digipolis.root.project' ) , 'web_root' => $ this -> getConfig ...
Get the settings from the local config key with the tokens replaced .
48,177
protected function getTimeoutSetting ( $ setting ) { $ timeoutSettings = $ this -> getTimeoutSettings ( ) ; return isset ( $ timeoutSettings [ $ setting ] ) ? $ timeoutSettings [ $ setting ] : static :: DEFAULT_TIMEOUT ; }
Timeouts can be overwritten in properties . yml under the timeout key .
48,178
protected function getUserHomeDir ( ) { $ home = getenv ( 'HOME' ) ; if ( ! empty ( $ home ) ) { return rtrim ( $ home , '/' ) ; } if ( ! empty ( $ _SERVER [ 'HOMEDRIVE' ] ) && ! empty ( $ _SERVER [ 'HOMEPATH' ] ) ) { $ home = $ _SERVER [ 'HOMEDRIVE' ] . $ _SERVER [ 'HOMEPATH' ] ; return rtrim ( $ home , '\\/' ) ; } th...
Get the home directory for the current user .
48,179
public function setRawData ( array $ data ) { $ this -> data = $ data + $ this -> data ; if ( $ data ) { $ this -> loaded = true ; $ this -> setDataSource ( '*' , 'db' ) ; } return $ this ; }
Set raw data to model
48,180
protected function getDataSource ( $ name ) { return isset ( $ this -> dataSources [ $ name ] ) ? $ this -> dataSources [ $ name ] : $ this -> dataSources [ '*' ] ; }
Returns the data source of specified column name
48,181
protected function generateDbData ( ) { $ dbData = [ ] ; foreach ( $ this -> data as $ name => $ value ) { if ( $ this -> getDataSource ( $ name ) !== 'db' ) { $ dbData [ $ name ] = $ this -> getSetValue ( $ name , $ value ) ; } else { $ dbData [ $ name ] = $ value ; } } return $ dbData ; }
Generates data for saving to database
48,182
protected function & getVirtualValue ( $ name ) { $ result = $ this -> callGetter ( $ name , $ this -> virtualData [ $ name ] ) ; if ( $ result ) { return $ this -> virtualData [ $ name ] ; } throw new InvalidArgumentException ( 'Invalid virtual column: ' . $ name ) ; }
Returns the virtual column value
48,183
protected function setVirtualValue ( $ name , $ value ) { $ result = $ this -> callSetter ( $ name , $ value ) ; if ( ! $ result ) { throw new InvalidArgumentException ( 'Invalid virtual column: ' . $ name ) ; } return $ this ; }
Sets the virtual column value
48,184
protected function hasVirtual ( $ name ) { $ name = $ this -> filterInputColumn ( $ name ) ; return in_array ( $ name , $ this -> virtual ) ; }
Check if the name is virtual column
48,185
private function verifyHandler ( callable $ func ) : bool { $ reflection = Func :: getReflection ( $ func ) ; $ params = $ reflection -> getParameters ( ) ; if ( count ( $ params ) !== 2 ) { return false ; } list ( $ value , $ validator ) = $ params ; if ( $ value -> getType ( ) !== null || $ value -> isOptional ( ) ) ...
Verify the validate function has the correct signature
48,186
protected function getDiscountForClientGroup ( ClientGroupInterface $ clientGroup = null ) : float { if ( null !== $ clientGroup ) { return round ( ( float ) $ clientGroup -> getDiscount ( ) / 100 , 2 ) ; } return 0 ; }
Returns the discount for client s group
48,187
public function validate ( ) { if ( $ this -> count ( ) > 1 ) { throw new DataException ( 'There should be only one root node to configure for Atom Logger data.' ) ; } foreach ( $ this -> getNodes ( ) as $ field => $ value ) { if ( ! in_array ( $ field , $ this -> getFields ( ) ) ) { throw new DataException ( "The fiel...
Validate the data to be correct for a request
48,188
public function cmdCronCron ( ) { if ( ! $ this -> cron -> run ( ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; }
Callback for cron command Run CRON
48,189
public function reverseTransform ( $ value ) { if ( null === $ value ) { return null ; } $ repo = $ this -> em -> getRepository ( $ this -> className ) ; $ entity = $ repo -> find ( $ value ) ; if ( ! $ entity ) { return null ; } return $ entity ; }
Transform to single id value to an entity
48,190
private function inputToNorm ( $ value , string $ path ) { if ( null === $ this -> inputTransformer ) { $ this -> inputTransformer = $ this -> fieldConfig -> getNormTransformer ( ) ?? false ; } if ( false === $ this -> inputTransformer ) { if ( null !== $ value && ! is_scalar ( $ value ) ) { $ e = new \ RuntimeExceptio...
Reverse transforms a value if a value transformer is set .
48,191
public function applyFilter ( ImageInterface $ image , FilterInterface $ filter ) { if ( $ filter instanceof ImagineAware ) { if ( $ this -> imagine === null ) { throw new InvalidArgumentException ( sprintf ( 'In order to use %s pass an Imagine\Image\ImagineInterface instance to Transformation constructor' , get_class ...
Applies a given FilterInterface onto given ImageInterface and returns modified ImageInterface
48,192
public function getFilters ( ) { if ( null === $ this -> sorted ) { if ( ! count ( $ this -> filters ) ) { $ this -> sorted = array ( ) ; } else { ksort ( $ this -> filters ) ; $ this -> sorted = call_user_func_array ( 'array_merge' , $ this -> filters ) ; } } return $ this -> sorted ; }
Returns a list of filters sorted by their priority . Filters with same priority will be returned in the order they were added .
48,193
public function add ( FilterInterface $ filter , $ priority = 0 ) { $ this -> filters [ $ priority ] [ ] = $ filter ; $ this -> sorted = null ; return $ this ; }
Registers a given FilterInterface in an internal array of filters for later application to an instance of ImageInterface
48,194
public function prepend ( FilterChain $ chain ) { $ priorities = array_keys ( $ this -> filters ) ; if ( count ( $ priorities ) ) { $ priority = min ( array_keys ( $ this -> filters ) ) - 1 ; } else { $ priority = 0 ; } $ filters = $ chain -> getFilters ( ) ; foreach ( $ filters as $ filter ) { $ this -> add ( $ filter...
Prepend filters from another filter chain
48,195
public function append ( FilterChain $ chain ) { $ priorities = array_keys ( $ this -> filters ) ; if ( count ( $ priorities ) ) { $ priority = max ( array_keys ( $ this -> filters ) ) + 1 ; } else { $ priority = 0 ; } $ filters = $ chain -> getFilters ( ) ; foreach ( $ filters as $ filter ) { $ this -> add ( $ filter ...
Append filters from another filter chain
48,196
public static function convertToDatetime ( $ rawDate , $ format = 'd.m.Y' ) { if ( Any :: isInt ( $ rawDate ) ) { $ rawDate = date ( \ DateTime :: ATOM , $ rawDate ) ; } try { $ object = new \ DateTime ( $ rawDate ) ; return $ object -> format ( $ format ) ; } catch ( \ Exception $ e ) { return false ; } }
Try to convert string to date time format
48,197
public static function humanize ( $ raw ) { $ timestamp = $ raw ; if ( ! Any :: isInt ( $ raw ) ) { $ timestamp = self :: convertToTimestamp ( ( string ) $ timestamp ) ; } $ diff = time ( ) - $ timestamp ; if ( $ diff < 0 ) { return self :: convertToDatetime ( $ timestamp , static :: FORMAT_TO_SECONDS ) ; } $ deltaSec ...
Humanize date format
48,198
public static function getYoutubeId ( $ url ) { $ videoId = false ; if ( preg_match ( '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i' , $ url , $ match ) ) { $ videoId = $ match [ 1 ] ; } return $ videoId ; }
Extracts the vimeo id from a vimeo url . Returns false if the url is not recognized as a vimeo url .
48,199
public function getTuples ( $ data ) { foreach ( $ this -> tuples as $ tuple ) $ tuples [ $ tuple ] = $ data [ $ tuple ] ; foreach ( $ this -> hidden_tuples as $ hidden_tuple ) unset ( $ tuples [ $ hidden_tuple ] ) ; return $ tuples ; }
Proceso de llenado de las relaciones permitidas y filtrado de las relaciones ocultas otorgadas al modelo Rest .