idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
229,000
public function whereFirst ( $ where ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; foreach ( $ this as $ record ) { if ( call_user_func ( $ where , $ record ) ) { return $ record ; } } throw new \ OutOfBoundsException ( ) ; }
Get first item matching to callable
229,001
public function whereFirstOrDefault ( $ where , $ default = null ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; foreach ( $ this as $ record ) { if ( call_user_func ( $ where , $ record ) ) { return $ record ; } } return $ default ; }
Get first item matching to callable or default
229,002
public function groupBy ( $ group = null ) { $ group = LambdaUtils :: toSelectCallable ( $ group ) ; $ result = new ObjectArray ( array ( ) ) ; if ( $ this instanceof ObjectArray ) { $ result = $ this -> newInstance ( ) ; } foreach ( $ this as $ record ) { $ key = call_user_func ( $ group , $ record ) ; $ data = array ...
Group fields by condition
229,003
public function distinct ( $ distinct = null ) { $ distinct = LambdaUtils :: toSelectCallable ( $ distinct ) ; $ keys = array ( ) ; $ collection = $ this -> newInstance ( ) ; foreach ( $ this as $ record ) { $ value = call_user_func ( $ distinct , $ record ) ; $ hash = md5 ( json_encode ( $ value ) ) ; if ( ! isset ( $...
filter duplicate field by condition
229,004
public function intersect ( ArrayBase $ comparedata ) { $ cmpvalue = function ( $ v1 , $ v2 ) { return $ v1 == $ v2 ? 0 : ( $ v1 > $ v2 ? 1 : - 1 ) ; } ; $ collection = $ this -> newInstance ( ) ; $ temp = array_uintersect ( $ this -> getData ( ) , $ comparedata -> getData ( ) , $ cmpvalue ) ; $ collection -> setData (...
Intersection to another object
229,005
public function except ( ArrayBase $ comparedata ) { $ cmpvalue = function ( $ v1 , $ v2 ) { return $ v1 == $ v2 ? 0 : ( $ v1 > $ v2 ? 1 : - 1 ) ; } ; $ collection = $ this -> newInstance ( ) ; $ temp1 = array_udiff ( $ this -> getData ( ) , $ comparedata -> getData ( ) , $ cmpvalue ) ; $ temp2 = array_udiff ( $ compar...
Difference to another object
229,006
public function all ( $ where ) { $ where = LambdaUtils :: toConditionCallable ( $ where ) ; foreach ( $ this as $ record ) { if ( ! call_user_func ( $ where , $ record ) ) { return false ; } } return true ; }
Check for all fields by condition
229,007
public function selectMany ( $ select = null ) { $ select = LambdaUtils :: toSelectCallable ( $ select ) ; $ result = array ( ) ; foreach ( $ this as $ key => $ record ) { $ temp = call_user_func ( $ select , $ record , $ key ) ; if ( is_array ( $ temp ) || $ temp instanceof \ Iterator ) { foreach ( $ temp as $ tempite...
Select a field and merge all arrays into one
229,008
public function each ( callable $ each ) { foreach ( $ this -> __data as $ key => & $ record ) { call_user_func_array ( $ each , array ( & $ record , $ key ) ) ; } unset ( $ record ) ; return $ this ; }
Iterate all fields
229,009
public function sum ( $ sum = null ) { $ sum = LambdaUtils :: toSelectCallable ( $ sum ) ; $ temp = $ this -> select ( $ sum ) -> toArray ( ) ; return array_sum ( $ temp ) ; }
Calculates the sum of values from given expression
229,010
public function min ( $ min = null ) { $ min = LambdaUtils :: toSelectCallable ( $ min ) ; $ temp = $ this -> select ( $ min ) -> toArray ( ) ; return min ( $ temp ) ; }
Find the lowest value from given expression
229,011
public function max ( $ max = null ) { $ max = LambdaUtils :: toSelectCallable ( $ max ) ; $ temp = $ this -> select ( $ max ) -> toArray ( ) ; return max ( $ temp ) ; }
Find the biggest value from given expression
229,012
public function avg ( $ avg = null ) { $ avg = LambdaUtils :: toSelectCallable ( $ avg ) ; return ( $ this -> sum ( $ avg ) / $ this -> length ( ) ) ; }
Find the average of the values from given expression
229,013
public function joinString ( $ join = null , $ glue = ", " ) { $ join = LambdaUtils :: toSelectCallable ( $ join ) ; $ temp = $ this -> select ( $ join ) -> toArray ( ) ; return implode ( $ glue , $ temp ) ; }
Join values from expression to one string
229,014
public function take ( $ length ) { if ( ! is_int ( $ length ) ) { throw new \ InvalidArgumentException ( ) ; } if ( $ length >= 0 && $ length > $ this -> length ( ) ) { $ length = $ this -> length ( ) ; } elseif ( $ length < 0 && $ length < ( 0 - $ this -> length ( ) ) ) { $ length = 0 - $ this -> length ( ) ; } $ tem...
Take first x fields
229,015
public function skip ( $ offset ) { if ( ! is_int ( $ offset ) ) { throw new \ InvalidArgumentException ( ) ; } if ( $ offset < 0 || $ offset >= $ this -> length ( ) ) { throw new \ OutOfBoundsException ( ) ; } $ temp = $ this -> newInstance ( ) ; $ temp -> setData ( array_slice ( $ this -> getData ( ) , $ offset ) ) ;...
Skip x fields
229,016
public function newRequest ( RequestParametersInterface $ parameters = null , ReaderInterface $ stdin = null ) { return new Request ( Role :: responder ( ) , $ this -> nextRequestId ++ , true , $ parameters , $ stdin ) ; }
Creates a new responder request .
229,017
public function handle ( RequestInterface $ request ) : RequestInterface { if ( $ this -> token === '' || $ this -> key === '' ) { throw new AuthorizationException ( 'Could not create api token, missing or empty arguments' ) ; } return $ request -> withHeader ( $ this -> key , $ this -> token ) ; }
Get a request with the headers associated with the authorization .
229,018
public function getCSRFCookie ( ) { $ cookie = $ this -> _browserInterface -> getCookie ( $ this -> _csrf_cookiename ) ; if ( ! $ cookie ) throw new SecureRequestHelper \ CSRFException ( 'CSRF cookie has not been initialized' ) ; return $ cookie ; }
Get CSRF cookie value
229,019
private static function getMappedType ( $ type ) { if ( ! isset ( self :: $ mappedTypes [ $ type ] ) ) { throw MysqliException :: mappedTypeDoesNotExist ( $ type ) ; } return self :: $ mappedTypes [ $ type ] ; }
Gets the mapped type .
229,020
private function bindValues ( array $ values ) { $ this -> bindedParameters = array ( ) ; $ this -> bindedTypes = array ( ) ; $ this -> bindedValues = array ( ) ; foreach ( $ values as $ parameter => $ value ) { if ( is_int ( $ parameter ) ) { $ parameter ++ ; } $ this -> bindValue ( $ parameter , $ value ) ; } }
Binds values on the statement .
229,021
private function bindParameters ( ) { $ bindedParameterReferences = array ( implode ( '' , $ this -> bindedTypes ) ) ; $ lobParameters = array ( ) ; $ null = null ; foreach ( $ this -> bindedParameters as $ key => & $ parameter ) { if ( isset ( $ this -> bindedTypes [ $ key - 1 ] ) && ( $ this -> bindedTypes [ $ key - ...
Binds the parameters on the driver statement .
229,022
private function bindResultFields ( ) { $ resultMetadata = $ this -> mysqliStatement -> result_metadata ( ) ; if ( $ resultMetadata !== false ) { $ this -> resultFields = array ( ) ; foreach ( $ resultMetadata -> fetch_fields ( ) as $ field ) { $ this -> resultFields [ ] = $ field -> name ; } $ resultMetadata -> free (...
Binds the driver result fields .
229,023
private function bindResult ( ) { $ this -> result = array_fill ( 0 , count ( $ this -> resultFields ) , null ) ; $ resultReferences = array ( ) ; foreach ( $ this -> result as $ key => & $ result ) { $ resultReferences [ $ key ] = & $ result ; } call_user_func_array ( array ( $ this -> mysqliStatement , 'bind_result' ...
Binds the driver statement result .
229,024
public function createFromImportedData ( $ data ) { $ group = new Group ( $ data [ 'name' ] , $ data [ 'include_pattern' ] , $ data [ 'exclude_pattern' ] ) ; if ( isset ( $ data [ 'type' ] ) ) { $ group -> setType ( $ data [ 'type' ] ) ; } $ group -> setOrdering ( $ data [ 'ordering' ] ) ; foreach ( $ data [ 'classes' ...
Create Group instance from imported data .
229,025
public function getRules ( ) { $ rules = [ static :: FIRST_NAME => "required|max:100" , static :: LAST_NAME => "required|max:100" , static :: EMAIL => "required|max:100|email|unique:users,email,{$this->id},id" , ] ; if ( ! $ this -> id ) { $ rules [ static :: PWD_FIELD ] = 'required|min:' . config ( 'app.model.user.pas...
Return array of rules for model validation
229,026
protected function renameFile ( EntityInterface $ entity , $ target ) { if ( $ entity -> getFilename ( ) && strpos ( $ entity -> getFilename ( ) , 'tmp' ) !== false ) { $ filename = $ entity -> getFilename ( ) ; $ entity -> setFilename ( $ target . pathinfo ( $ filename , PATHINFO_BASENAME ) ) ; $ root = $ this -> root...
Rename file if it in the temp folder .
229,027
private function handle ( Request $ request ) : Response { $ router = $ this -> getInstance ( Router :: class ) ; if ( $ router -> match ( $ request -> getPathInfo ( ) , $ request -> getMethod ( ) ) ) { $ match = $ router -> getMatch ( ) ; $ handler = $ match -> getHandler ( ) ; if ( is_object ( $ handler ) && $ handle...
Turn a request into a response
229,028
static function FirstChildOf ( Content $ content ) { $ provider = self :: GetTreeProvider ( $ content ) ; if ( ! $ provider ) { return null ; } $ item = $ provider -> ItemByContent ( $ content ) ; return $ provider -> ContentByItem ( $ provider -> FirstChildOf ( $ item ) ) ; }
Returns the first child of the content
229,029
public static function hasCommand ( String $ label ) : Bool { return ( isset ( Command :: $ commands [ $ label ] ) ) ? true : false ; }
Checks if a command is registered .
229,030
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 .
229,031
public function question ( String $ question ) { $ this -> env -> sendOutput ( $ question ) ; return $ this -> env -> getOutputOption ( ) ; }
Sends output to user as a question and returns response .
229,032
public function sort ( ) { parent :: sort ( ) ; Helper :: mapMethod ( $ this -> _records , 'sort' ) ; usort ( $ this -> _records , array ( $ this , 'compareRecords' ) ) ; }
Sort fields and contained records .
229,033
public function isEmpty ( ) { return parent :: isEmpty ( ) && Helper :: every ( $ this -> _records , function ( Record $ record ) { return $ record -> isEmpty ( ) ; } ) ; }
Return true if the record is empty .
229,034
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 .
229,035
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 .
229,036
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
229,037
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
229,038
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
229,039
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 .
229,040
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 .
229,041
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 .
229,042
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 .
229,043
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 .
229,044
public function toSQL ( Parameters $ params , bool $ inner_clause ) { return "LIMIT " . $ params -> getDriver ( ) -> toSQL ( $ params , $ this -> getLimit ( ) ) ; }
Write a LIMIT clause to SQL query syntax
229,045
public function add ( PatternInterface $ pattern ) { $ this -> collection [ $ this -> length ] = $ pattern ; $ this -> length ++ ; return $ this ; }
Add pattern object to the collection .
229,046
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 .
229,047
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
229,048
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
229,049
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
229,050
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
229,051
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
229,052
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
229,053
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
229,054
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
229,055
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 .
229,056
static function removeHtmlTag ( $ text ) { $ text = htmlspecialchars_decode ( $ text ) ; $ text = html_entity_decode ( $ text ) ; $ text = strip_tags ( $ text ) ; return $ text ; }
Entfernt Html Tags und Umlaute
229,057
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
229,058
public function deserialize ( $ data ) { $ result = json_decode ( $ data , true ) ; if ( $ result === null ) { return $ data ; } return $ result ; }
Deserialize JSON into an assoc array
229,059
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
229,060
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 .
229,061
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 .
229,062
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 .
229,063
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 .
229,064
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 .
229,065
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
229,066
final public function addFilters ( $ elementName , array $ filters ) { $ this -> elements [ $ elementName ] -> filters -> add ( $ filters ) ; return $ this ; }
Add filters to specified element
229,067
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
229,068
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 .
229,069
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 .
229,070
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 .
229,071
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 .
229,072
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 .
229,073
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 .
229,074
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
229,075
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
229,076
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
229,077
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
229,078
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
229,079
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
229,080
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
229,081
public function commit ( ) { if ( ! is_null ( $ this -> _changes ) ) { $ this -> _commit ( $ this -> _changes ) ; $ this -> _changes = null ; } }
Commit changes to real FS
229,082
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
229,083
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
229,084
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 .
229,085
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 .
229,086
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 .
229,087
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
229,088
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
229,089
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 .
229,090
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 .
229,091
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 .
229,092
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 .
229,093
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 .
229,094
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 .
229,095
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 .
229,096
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 .
229,097
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 .
229,098
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 .
229,099
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 .