idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
6,600
public function reset ( MediaInterface $ media = null , $ onlyFocus = false ) { if ( $ onlyFocus === true ) { $ regex = '#^\d*x\d*_focus/' ; } else { $ regex = '#^\d*x\d*(_focus)?/' ; } $ regex .= ( $ media !== null ) ? $ media -> getReference ( ) : '.*' ; $ regex .= '$#' ; foreach ( $ this -> filesystemManipulator -> ...
Remove empty directory Remove cache of media .
6,601
public function save ( $ media , $ flush = true ) { if ( $ media -> getFile ( ) !== null ) { if ( $ this -> saveFile ( $ media ) === false ) { return false ; } } if ( $ media -> getFocusIsEdited ( ) === true ) { $ this -> reset ( $ media , true ) ; $ media -> setFocusIsEdited ( false ) ; } $ media -> setUpdatedAt ( new...
Save media .
6,602
public function create ( $ path = null ) { $ media = new $ this -> class ( ) ; if ( $ path !== null ) { $ media -> setFile ( new \ Symfony \ Component \ HttpFoundation \ File \ File ( $ path ) ) ; } return $ media ; }
Create media object .
6,603
private function loadModules ( ) { $ this -> modules = new ModuleList ( ) ; $ this -> modules -> add ( new RootModule ( $ this -> rootModuleFile , $ this -> rootDir ) ) ; foreach ( $ this -> rootModuleFile -> getInstallInfos ( ) as $ installInfo ) { $ this -> modules -> add ( $ this -> loadModule ( $ installInfo ) ) ; ...
Loads all modules referenced by the install file .
6,604
private function loadModule ( InstallInfo $ installInfo ) { $ installPath = Path :: makeAbsolute ( $ installInfo -> getInstallPath ( ) , $ this -> rootDir ) ; $ moduleFile = null ; $ loadError = null ; try { $ moduleFile = $ this -> loadModuleFile ( $ installPath ) ; } catch ( InvalidConfigException $ loadError ) { } c...
Loads a module for the given install info .
6,605
private function loadModuleFile ( $ installPath ) { if ( ! file_exists ( $ installPath ) ) { throw FileNotFoundException :: forPath ( $ installPath ) ; } if ( ! is_dir ( $ installPath ) ) { throw new NoDirectoryException ( sprintf ( 'The path %s is a file. Expected a directory.' , $ installPath ) ) ; } try { return $ t...
Loads the module file for the module at the given install path .
6,606
public function get ( Uuid $ uuid ) { if ( ! isset ( $ this -> map [ $ uuid -> toString ( ) ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The binding with UUID "%s" does not exist.' , $ uuid -> toString ( ) ) ) ; } return $ this -> map [ $ uuid -> toString ( ) ] ; }
Returns a binding descriptor .
6,607
public function getUuids ( ) { $ uuids = array ( ) ; foreach ( $ this -> map as $ bindingDescriptor ) { $ uuids [ ] = $ bindingDescriptor -> getUuid ( ) ; } return $ uuids ; }
Returns the UUIDs of all binding descriptors .
6,608
public function compile ( ) { if ( TL_MODE == 'BE' ) { $ this -> strTemplate = 'be_wildcard' ; $ this -> Template = new \ BackendTemplate ( $ this -> strTemplate ) ; $ this -> Template -> title = $ this -> headline ; } else { $ this -> Template = new \ FrontendTemplate ( $ this -> strTemplate ) ; $ this -> Template -> ...
Compile the content element
6,609
public function setEnvironment ( $ env ) { Assert :: oneOf ( $ env , Environment :: all ( ) , 'The environment must be one of: %2$s. Got: %s' ) ; $ this -> env = $ env ; }
Sets the environment that the module is installed in .
6,610
public function getMediasAction ( Request $ request ) { if ( ! $ request -> query -> has ( 'filters' ) ) { return $ this -> createResponse ( array ( ) ) ; } $ mediaManager = $ this -> getMediaManager ( ) ; $ filtersKeys = explode ( ',' , $ request -> query -> get ( 'filters' ) ) ; $ medias = $ mediaManager -> findAllBy...
Get all medias .
6,611
public function postMediaAction ( Request $ request ) { $ response = $ this -> getFilter ( $ request ) ; if ( $ response [ 'success' ] === false ) { return $ response [ 'value' ] ; } $ filter = $ response [ 'value' ] ; $ mm = $ this -> getMediaManager ( ) ; $ media = $ mm -> create ( ) ; $ media -> setFilter ( $ filter...
Add new media .
6,612
private function getFilter ( Request $ request ) { $ success = false ; $ filter = null ; if ( $ request -> query -> has ( 'filter' ) ) { $ filter = $ request -> query -> get ( 'filter' ) ; $ type = 'query' ; } elseif ( $ request -> request -> has ( 'filter' ) ) { $ filter = $ request -> request -> get ( 'filter' ) ; $ ...
Get is filter is send and verify if is a valid filter .
6,613
public function searchMediaAction ( Request $ request ) { $ response = $ this -> getFilter ( $ request ) ; if ( $ response [ 'success' ] === false ) { return $ response [ 'value' ] ; } $ filter = $ response [ 'crypted' ] ; $ mm = $ this -> getMediaManager ( ) ; $ q = ( $ request -> query -> has ( 'q' ) ) ? $ request ->...
Search medias .
6,614
public function set ( $ repositoryPath , PathMapping $ mapping ) { $ this -> map -> set ( $ repositoryPath , $ mapping -> getContainingModule ( ) -> getName ( ) , $ mapping ) ; $ this -> primaryKeysSorted = false ; }
Sets a path mapping for a specific repository path .
6,615
public function listByModuleName ( $ moduleName ) { if ( $ this -> primaryKeysSorted ) { $ this -> lazySortPrimaryKeys ( ) ; } return $ this -> map -> listBySecondaryKey ( $ moduleName ) ; }
Returns all path mappings set for the given module name .
6,616
public function getStartCrop ( $ origin , $ target , $ focus ) { $ focusPx = round ( ( $ origin * $ focus ) / 100 ) ; $ start = $ focusPx - ( $ target / 2 ) ; if ( $ start <= 0 ) { return 0 ; } if ( ( $ start + $ target ) >= $ origin ) { return $ origin - $ target ; } return $ start ; }
Get start to crop by focus .
6,617
public function takeSnapshot ( ) { $ this -> enabledBindingBefore = null ; if ( $ this -> bindingDescriptors -> contains ( $ this -> uuid ) ) { $ bindingDescriptor = $ this -> bindingDescriptors -> get ( $ this -> uuid ) ; if ( $ bindingDescriptor -> isEnabled ( ) ) { $ this -> enabledBindingBefore = clone $ bindingDes...
Records whether the UUID is currently enabled .
6,618
protected function isSurpassingFileSizeLimit ( $ stringData ) { $ expectedFileSize = $ this -> accommulatedFileSize + $ this -> getStringSize ( $ stringData ) ; return $ this -> maxFilesize < $ expectedFileSize ; }
Before appending data we need to check if we ll surpass the file size limit or not .
6,619
public function build ( ) { $ this -> appendToFile ( $ this -> getFooter ( ) ) ; if ( $ this -> gzipOutput ) { $ this -> writeGZipFile ( ) ; } \ fclose ( $ this -> filePointer ) ; }
Generates sitemap file .
6,620
private function detectFromPath ( string $ path ) { if ( ! $ this -> usePath ) { return null ; } $ dirs = explode ( '/' , ltrim ( $ path , '/' ) , 2 ) ; $ first = strtolower ( ( string ) array_shift ( $ dirs ) ) ; if ( ! empty ( $ first ) && in_array ( $ first , $ this -> languages , true ) ) { return $ first ; } }
Returns the language from the first part of the path if it s in the allowed languages .
6,621
private function detectFromHeader ( ServerRequestInterface $ request ) { $ accept = $ request -> getHeaderLine ( 'Accept-Language' ) ; $ language = $ this -> negotiateHeader ( $ accept , new LanguageNegotiator ( ) , $ this -> languages ) ; if ( empty ( $ language ) ) { return isset ( $ this -> languages [ 0 ] ) ? $ thi...
Returns the format using the Accept - Language header .
6,622
public static function forRepositoryPathAndModule ( $ path , $ moduleName , Exception $ cause = null ) { return new static ( sprintf ( 'The repository path "%s" is not mapped in module "%s".' , $ path , $ moduleName ) , 0 , $ cause ) ; }
Creates an exception for a repository path and a module name .
6,623
public static function parseHomeDirectory ( ) { if ( $ value = getenv ( 'PULI_HOME' ) ) { $ homeDir = $ value ; $ env = 'PULI_HOME' ; } elseif ( $ value = getenv ( 'HOME' ) ) { $ homeDir = $ value ; $ env = 'HOME' ; } elseif ( $ value = getenv ( 'APPDATA' ) ) { $ homeDir = $ value ; $ env = 'APPDATA' ; } else { throw n...
Parses context variables for Puli s home directory .
6,624
public static function denyWebAccess ( $ directory ) { if ( ! file_exists ( $ directory . '/.htaccess' ) ) { if ( ! is_dir ( $ directory ) ) { $ filesystem = new Filesystem ( ) ; $ filesystem -> mkdir ( $ directory ) ; } @ file_put_contents ( $ directory . '/.htaccess' , 'Deny from all' ) ; } }
Denies web access to a directory path .
6,625
public function valideAliasName ( $ aliasName ) { if ( $ aliasName === null || $ aliasName === $ this -> originalDir ) { return $ this -> originalDir ; } if ( array_key_exists ( $ aliasName , $ this -> alias ) ) { return $ this -> aliasArrayToName ( $ this -> alias [ $ aliasName ] ) ; } if ( ! preg_match ( '#^(\d*)x(\d...
Verify if the alias name is valid .
6,626
public function valideAliasArray ( $ aliasArray ) { $ aliasArray = array_replace ( array ( 'width' => null , 'height' => null ) , $ aliasArray ) ; foreach ( $ aliasArray as $ name => $ value ) { if ( ! in_array ( $ name , array ( 'width' , 'height' , 'focus' ) ) ) { throw new \ Exception ( $ name . ' is not a good key'...
Verify alias array .
6,627
private function aliasArrayToName ( array $ aliasArray ) { if ( $ aliasArray === null || ( empty ( $ aliasArray [ 'width' ] ) && empty ( $ aliasArray [ 'height' ] ) ) ) { return $ this -> originalDir ; } if ( ! empty ( $ aliasArray [ 'focus' ] ) ) { if ( ! in_array ( $ aliasArray [ 'focus' ] , array ( true , false ) ) ...
Transform aliass array to name .
6,628
private function aliasNameToArray ( $ aliasName ) { if ( ! empty ( $ aliasName ) && isset ( $ this -> alias [ $ aliasName ] ) ) { $ aliasName = $ this -> aliasArrayToName ( $ this -> alias [ $ aliasName ] ) ; } elseif ( is_array ( $ aliasName ) ) { $ aliasName = $ this -> aliasArrayToName ( $ aliasName ) ; } $ aliasArr...
Transform alias name to array .
6,629
public function getParameter ( $ parameterName ) { if ( ! isset ( $ this -> parameters [ $ parameterName ] ) ) { throw NoSuchParameterException :: forParameterName ( $ parameterName , $ this -> name ) ; } return $ this -> parameters [ $ parameterName ] ; }
Returns an installer parameter .
6,630
public function getParameterValues ( ) { $ values = array ( ) ; foreach ( $ this -> parameters as $ name => $ parameter ) { if ( ! $ parameter -> isRequired ( ) ) { $ values [ $ name ] = $ parameter -> getDefaultValue ( ) ; } } return $ values ; }
Returns the default values of all optional parameters .
6,631
public function setInstallInfos ( array $ installInfos ) { $ this -> installInfos = array ( ) ; foreach ( $ installInfos as $ installInfo ) { $ this -> addInstallInfo ( $ installInfo ) ; } }
Sets the install infos of all installed modules .
6,632
public function getInstallInfo ( $ moduleName ) { if ( ! isset ( $ this -> installInfos [ $ moduleName ] ) ) { throw new NoSuchModuleException ( sprintf ( 'Could not get install info: The module "%s" is not installed.' , $ moduleName ) ) ; } return $ this -> installInfos [ $ moduleName ] ; }
Returns the install info of an installed module .
6,633
public function getServerPathForResource ( PuliResource $ resource ) { $ relPath = Path :: makeRelative ( $ resource -> getRepositoryPath ( ) , $ this -> basePath ) ; return '/' . trim ( $ this -> mapping -> getServerPath ( ) . '/' . $ relPath , '/' ) ; }
Returns the path where a resource is going to be installed .
6,634
public function setRecurrenceEventId ( $ entity = null ) : string { $ start = $ entity instanceof EntityInterface ? $ entity -> get ( 'start_date' ) : $ entity [ 'start_date' ] ; $ end = $ entity instanceof EntityInterface ? $ entity -> get ( 'end_date' ) : $ entity [ 'end_date' ] ; $ id = $ entity instanceof EntityInt...
Set ID suffix for recurring events
6,635
public function getRecurrenceEventId ( ? string $ id = null ) : array { $ result = [ ] ; if ( empty ( $ id ) ) { return $ result ; } if ( preg_match ( '/(^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})(__(\d+)?_(\d+)?)?/' , $ id , $ matches ) ) { $ result [ 'id' ] = $ matches [ 1 ] ; $ res...
Parse recurrent event id suffix
6,636
public function getEvents ( ? EntityInterface $ calendar , array $ options = [ ] , bool $ isInfinite = true ) : array { $ result = [ ] ; if ( ! $ calendar ) { return $ result ; } $ events = $ this -> findCalendarEvents ( $ options ) ; foreach ( $ events as $ event ) { $ eventItem = $ this -> prepareEventData ( $ event ...
Get Events of specific calendar
6,637
public function getEventRange ( array $ options = [ ] ) : array { $ result = [ ] ; if ( empty ( $ options [ 'period' ] ) ) { return $ result ; } if ( ! empty ( $ options [ 'period' ] [ 'start_date' ] ) ) { $ result [ 'start' ] = [ 'MONTH(start_date) >=' => date ( 'm' , strtotime ( $ options [ 'period' ] [ 'start_date' ...
Get Event Range condition
6,638
public function getInfiniteEvents ( array $ events , array $ options = [ ] , bool $ isInfinite = true ) : array { $ result = $ existingEventIds = [ ] ; $ query = $ this -> findCalendarEvents ( $ options , $ isInfinite ) ; if ( ! $ query ) { return $ result ; } if ( ! empty ( $ events ) ) { $ existingEventIds = array_ma...
Get infinite calendar events for given calendar
6,639
public function getRRuleConfiguration ( string $ recurrence = null ) : ? string { $ result = null ; if ( empty ( $ recurrence ) ) { return $ result ; } $ result = preg_match ( '/^RRULE:/' , $ recurrence ) ? $ recurrence : 'RRULE:' . $ recurrence ; return $ result ; }
Get RRULE configuration from the event
6,640
public function setRRuleConfiguration ( string $ recurrence = null ) : ? string { $ result = null ; if ( empty ( $ recurrence ) ) { return $ result ; } if ( ! preg_match ( '/RRULE:/' , $ recurrence ) ) { $ result = 'RRULE:' . $ recurrence ; } return $ result ; }
Set valid RRULE string
6,641
public function getEventTypes ( array $ options = [ ] ) : array { $ result = [ ] ; if ( ! empty ( $ options [ 'calendar' ] ) ) { $ types = json_decode ( $ options [ 'calendar' ] -> event_types , true ) ; foreach ( $ types as $ type ) { $ result [ $ type ] = $ type ; } asort ( $ result ) ; return $ result ; } $ event = ...
Get Event types for the calendar event
6,642
public function getEventTypeName ( array $ data = [ ] , array $ options = [ ] ) : ? string { if ( empty ( $ data [ 'name' ] ) ) { return null ; } $ prefix = ! empty ( $ options [ 'prefix' ] ) ? $ options [ 'prefix' ] : 'Config' ; $ type = ! empty ( $ data [ 'type' ] ) ? $ data [ 'type' ] : 'default' ; $ delimiter = '::...
Get Event Type name
6,643
public function getEventInfo ( ? string $ id = null , ? EntityInterface $ calendar = null ) { $ result = [ ] ; if ( empty ( $ id ) ) { return $ result ; } $ options = $ this -> getRecurrenceEventId ( $ id ) ; $ query = $ this -> find ( ) -> where ( [ 'id' => $ options [ 'id' ] ] ) -> contain ( [ 'CalendarAttendees' ] )...
Get Event info
6,644
public function prepareRecurringEventData ( array $ event = [ ] , array $ interval = [ ] , EntityInterface $ calendar = null ) : ? EntityInterface { $ entity = null ; if ( empty ( $ event ) ) { return $ entity ; } $ entity = $ this -> newEntity ( ) ; $ entity = $ this -> patchEntity ( $ entity , $ event ) ; $ entity ->...
Prepare Recurring Event Data
6,645
public function setEventTitle ( array $ data , EntityInterface $ calendar ) : string { $ title = ( ! empty ( $ data [ 'CalendarEvents' ] [ 'title' ] ) ? $ data [ 'CalendarEvents' ] [ 'title' ] : '' ) ; if ( empty ( $ title ) ) { $ title .= ! empty ( $ calendar -> name ) ? $ calendar -> name : '' ; if ( ! empty ( $ data...
Set Event Title
6,646
public function getEventTitle ( array $ event = [ ] ) : string { $ extra = [ ] ; if ( ! empty ( $ event [ 'calendar_attendees' ] ) ) { foreach ( $ event [ 'calendar_attendees' ] as $ att ) { if ( $ att instanceof EntityInterface ) { array_push ( $ extra , $ att -> get ( 'display_name' ) ) ; } } } if ( ! empty ( $ extra...
Get Event Title based on the Event information
6,647
public function sync ( EntityInterface $ calendar , array $ options = [ ] ) : array { $ result = [ ] ; if ( empty ( $ calendar ) ) { return $ result ; } $ event = new Event ( ( string ) EventName :: PLUGIN_CALENDAR_MODEL_GET_EVENTS ( ) , $ this , [ 'calendar' => $ calendar , 'options' => $ options , ] ) ; EventManager ...
Synchronize calendar events
6,648
public function saveEvent ( EntityInterface $ entity ) : array { $ response = [ 'status' => false , 'errors' => [ ] , 'entity' => null , ] ; if ( $ entity instanceof EntityInterface ) { $ entity = $ entity -> toArray ( ) ; } if ( empty ( $ entity [ 'id' ] ) ) { unset ( $ entity [ 'id' ] ) ; } $ query = $ this -> find (...
Save Calendar Event wrapper
6,649
public function getEventsFromEntities ( Table $ table , array $ calendars , ArrayObject $ options ) : array { $ entities = [ ] ; if ( empty ( $ calendars ) ) { return $ entities ; } $ map = ObjectFactory :: getConfig ( $ table -> alias ( ) , 'Event' , $ options [ 'event_type' ] ) ; foreach ( $ calendars as $ calendar )...
Convert incoming ORM Entities to CalendarEvent entities
6,650
public function setCalendarEventData ( array $ data = [ ] , ? EntityInterface $ calendar = null ) : array { $ result = [ 'CalendarEvents' => [ ] , ] ; $ result [ 'CalendarEvents' ] = $ data ; if ( ! empty ( $ data [ 'recurrence' ] ) ) { $ recurrence = $ this -> setRRuleConfiguration ( $ data [ 'recurrence' ] ) ; $ resu...
Set Calendar Event Post data
6,651
protected function addPriorityChoices ( array $ unsortedChoices , ChoicesAwareViewData $ data ) { foreach ( $ this -> getSortPriority ( ) as $ name ) { if ( array_key_exists ( $ name , $ unsortedChoices ) ) { $ data -> addChoice ( $ unsortedChoices [ $ name ] ) ; unset ( $ unsortedChoices [ $ name ] ) ; } } return $ un...
Adds prioritized choices .
6,652
public function validate ( array $ parameterValues , InstallerDescriptor $ descriptor ) { $ violations = array ( ) ; foreach ( $ parameterValues as $ name => $ value ) { if ( ! $ descriptor -> hasParameter ( $ name ) ) { $ violations [ ] = new ConstraintViolation ( ConstraintViolation :: NO_SUCH_PARAMETER , $ value , $...
Returns whether the given parameter values are valid .
6,653
public function load ( Module $ containingModule , BindingTypeDescriptor $ typeDescriptor = null ) { if ( null !== $ this -> state ) { throw new AlreadyLoadedException ( 'The binding descriptor is already loaded.' ) ; } $ this -> loadErrors = array ( ) ; if ( $ typeDescriptor && $ typeDescriptor -> isLoaded ( ) && $ ty...
Loads the binding descriptor .
6,654
public function unload ( ) { if ( null === $ this -> state ) { throw new NotLoadedException ( 'The binding descriptor is not loaded.' ) ; } $ this -> containingModule = null ; $ this -> typeDescriptor = null ; $ this -> loadErrors = array ( ) ; $ this -> state = null ; }
Unloads the binding descriptor .
6,655
public function getArgument ( $ name ) { if ( ! isset ( $ this -> arguments [ $ name ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The argument "%s" does not exist.' , $ name ) ) ; } return $ this -> arguments [ $ name ] ; }
Returns the argument with the given name .
6,656
public function addBody ( $ body ) { Assert :: stringNotEmpty ( $ body , 'The method body must be a non-empty string. Got: %s' ) ; if ( $ this -> body ) { $ this -> body .= "\n" . $ body ; } else { $ this -> body = $ body ; } return $ this ; }
Adds source code to the method body .
6,657
public function search ( SearchRequest $ request ) { $ this -> eventDispatcher -> dispatch ( ONGRFilterManagerEvents :: PRE_SEARCH , new PreSearchEvent ( $ request ) ) ; $ search = $ this -> container -> buildSearch ( $ request ) ; foreach ( $ this -> container -> all ( ) as $ name => $ filter ) { $ relatedSearch = new...
Executes search .
6,658
protected function composeUrlParameters ( SearchRequest $ request , FilterInterface $ filter = null , $ exclude = [ ] ) { $ out = [ ] ; $ and = [ ] ; if ( $ filter ) { $ and [ ] = $ filter -> getResetRelation ( ) ; } if ( ! empty ( $ exclude ) ) { $ and [ ] = new ExcludeRelation ( $ exclude ) ; } $ states = new FilterI...
Composes url parameters related to given filter .
6,659
protected function getFiltersViewData ( DocumentIterator $ result , SearchRequest $ request ) { $ out = [ ] ; $ filters = $ this -> container -> all ( ) ; foreach ( $ filters as $ name => $ filter ) { if ( $ filter instanceof ViewDataFactoryInterface ) { $ viewData = $ filter -> createViewData ( ) ; } else { $ viewData...
Creates view data for each filter .
6,660
public function add ( $ name , $ value ) { Assert :: string ( $ name , 'The attribute name must be a string. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The attribute name must not be empty.' ) ; Assert :: startsWithLetter ( $ name , 'The attribute name %s must start with a letter.' ) ; Assert :: true ( ( bool ) preg_m...
Adds an attribute to the name .
6,661
public function merge ( array $ attributes ) { foreach ( $ attributes as $ name => $ value ) { $ this -> add ( $ name , $ value ) ; } }
Adds multiple attributes to the name .
6,662
public function toString ( ) { $ stringAttr = array ( ) ; foreach ( $ this -> attributes as $ name => $ value ) { $ stringAttr [ ] = $ name . '=' . $ this -> escape ( $ value ) ; } return implode ( ',' , $ stringAttr ) ; }
Returns the distinguished name as string .
6,663
public static function missingParameter ( $ parameterName , $ installerName , Exception $ cause = null ) { return new static ( sprintf ( 'The parameter "%s" is required for the installer "%s".' , $ parameterName , $ installerName ) , self :: MISSING_PARAMETER , $ cause ) ; }
Creates an exception for a missing required parameter .
6,664
public static function installerNotFound ( $ installerName , Exception $ cause = null ) { return new static ( sprintf ( 'The installer "%s" does not exist.' , $ installerName ) , self :: INSTALLER_NOT_FOUND , $ cause ) ; }
Creates an exception for an installer name that was not found .
6,665
public static function noResourceMatches ( $ glob , Exception $ cause = null ) { return new static ( sprintf ( 'The glob "%s" did not return any resources.' , $ glob ) , self :: NO_RESOURCE_MATCHES , $ cause ) ; }
Creates an exception for an glob that did not return any matches .
6,666
public static function serverNotFound ( $ serverName , Exception $ cause = null ) { return new static ( sprintf ( 'The asset server "%s" does not exist.' , $ serverName ) , self :: SERVER_NOT_FOUND , $ cause ) ; }
Creates an exception for a server name that was not found .
6,667
public static function installerClassNotFound ( $ installerClass , Exception $ cause = null ) { return new static ( sprintf ( 'The installer class "%s" does not exist.' , $ installerClass ) , self :: INSTALLER_CLASS_NOT_FOUND , $ cause ) ; }
Creates an exception for an installer class that was not found .
6,668
public static function installerClassNoDefaultConstructor ( $ installerClass , Exception $ cause = null ) { return new static ( sprintf ( 'The constructor of class "%s" must not have required parameters.' , $ installerClass ) , self :: INSTALLER_CLASS_NO_DEFAULT_CONSTRUCTOR , $ cause ) ; }
Creates an exception for an installer class that has no default constructor .
6,669
private function addRelation ( Definition $ definition , $ filter , $ urlType , $ relationType ) { if ( empty ( $ filter [ 'relations' ] [ $ urlType ] [ $ relationType ] ) ) { return ; } $ relation = new Definition ( sprintf ( 'ONGR\FilterManagerBundle\Relation\%sRelation' , ucfirst ( $ relationType ) ) , [ $ filter [ ...
Adds relation to filter .
6,670
public static function all ( ) { return array ( self :: ENABLED , self :: DISABLED , self :: TYPE_NOT_FOUND , self :: TYPE_NOT_ENABLED , self :: INVALID , ) ; }
Returns all binding states .
6,671
public function set ( $ primaryKey , $ secondaryKey , $ value ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { $ this -> values [ $ primaryKey ] = array ( ) ; } $ this -> values [ $ primaryKey ] [ $ secondaryKey ] = $ value ; }
Sets a value in the store .
6,672
public function remove ( $ primaryKey , $ secondaryKey ) { unset ( $ this -> values [ $ primaryKey ] [ $ secondaryKey ] ) ; if ( isset ( $ this -> values [ $ primaryKey ] ) && 0 === count ( $ this -> values [ $ primaryKey ] ) ) { unset ( $ this -> values [ $ primaryKey ] ) ; } }
Removes a value from the store .
6,673
public function get ( $ primaryKey , $ secondaryKey ) { if ( ! isset ( $ this -> values [ $ primaryKey ] [ $ secondaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key ("%s","%s") does not exist.' , $ primaryKey , $ secondaryKey ) ) ; } return $ this -> values [ $ primaryKey ] [ $ secondaryKey ] ; }
Returns a value from the store .
6,674
public function getFirst ( $ primaryKey ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key "%s" does not exist.' , $ primaryKey ) ) ; } return reset ( $ this -> values [ $ primaryKey ] ) ; }
Returns the first value set for the given primary key .
6,675
public function getLast ( $ primaryKey ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key "%s" does not exist.' , $ primaryKey ) ) ; } return end ( $ this -> values [ $ primaryKey ] ) ; }
Returns the last value set for the given primary key .
6,676
public function getCount ( $ primaryKey ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key "%s" does not exist.' , $ primaryKey ) ) ; } return count ( $ this -> values [ $ primaryKey ] ) ; }
Returns the number of secondary keys set for the given primary key .
6,677
public function listByPrimaryKey ( $ primaryKey ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key "%s" does not exist.' , $ primaryKey ) ) ; } return $ this -> values [ $ primaryKey ] ; }
Returns all values set for the given primary key .
6,678
public function listBySecondaryKey ( $ secondaryKey ) { $ list = array ( ) ; foreach ( $ this -> values as $ primaryKey => $ valuesBySecondaryKey ) { if ( isset ( $ valuesBySecondaryKey [ $ secondaryKey ] ) ) { $ list [ $ primaryKey ] = $ valuesBySecondaryKey [ $ secondaryKey ] ; } } if ( ! $ list ) { throw new OutOfBo...
Returns all values set for the given secondary key .
6,679
public function getSecondaryKeys ( $ primaryKey = null ) { if ( $ primaryKey ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key "%s" does not exist.' , $ primaryKey ) ) ; } return array_keys ( $ this -> values [ $ primaryKey ] ) ; } $ allSecondaryKeys = array ...
Returns the secondary keys for the given primary key .
6,680
public function sortPrimaryKeys ( array $ order = null ) { if ( ! $ order ) { ksort ( $ this -> values ) ; return ; } $ orderedKeys = array_intersect_key ( array_flip ( $ order ) , $ this -> values ) ; $ this -> values = array_replace ( $ orderedKeys , $ this -> values ) ; }
Sorts the primary keys of the map .
6,681
public function sortSecondaryKeys ( $ primaryKey , array $ order = null ) { if ( ! isset ( $ this -> values [ $ primaryKey ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The key "%s" does not exist.' , $ primaryKey ) ) ; } if ( ! $ order ) { ksort ( $ this -> values [ $ primaryKey ] ) ; return ; } $ orderedKeys = ...
Sorts the secondary keys of a map entry .
6,682
private function camelizeKeys ( array $ array ) { $ camelized = array ( ) ; foreach ( $ array as $ key => $ value ) { $ camelized [ $ this -> camelize ( $ key ) ] = is_array ( $ value ) ? $ this -> camelizeKeys ( $ value ) : $ value ; } return $ camelized ; }
Recursively camelizes the keys of an array .
6,683
public function load ( Module $ containingModule ) { if ( null !== $ this -> state ) { throw new AlreadyLoadedException ( 'The type descriptor is already loaded.' ) ; } $ this -> containingModule = $ containingModule ; $ this -> state = BindingTypeState :: ENABLED ; }
Loads the type descriptor .
6,684
public function unload ( ) { if ( null === $ this -> state ) { throw new NotLoadedException ( 'The type descriptor is not loaded.' ) ; } $ this -> containingModule = null ; $ this -> state = null ; }
Unloads the type descriptor .
6,685
public function markDuplicate ( $ duplicate ) { Assert :: boolean ( $ duplicate ) ; if ( null === $ this -> state ) { throw new NotLoadedException ( 'The type descriptor is not loaded.' ) ; } $ this -> state = $ duplicate ? BindingTypeState :: DUPLICATE : BindingTypeState :: ENABLED ; }
Marks or unmarks the type as duplicate .
6,686
public function getParameterDescription ( $ parameterName ) { if ( ! $ this -> type -> hasParameter ( $ parameterName ) ) { throw new NoSuchParameterException ( sprintf ( 'The parameter "%s" does not exist.' , $ parameterName ) ) ; } if ( ! isset ( $ this -> parameterDescriptions [ $ parameterName ] ) ) { throw new Out...
Returns the description for a parameter .
6,687
public function authenticate ( ) { if ( ! $ this instanceof UserInterface ) { if ( $ this -> frontendHelperUserAuthenticated === null ) { $ this -> frontendHelperUserAuthenticated = \ User :: authenticate ( ) ; } return $ this -> frontendHelperUserAuthenticated ; } return $ this -> username && $ this -> intId ; }
Disable BackendUser authentication redirect and cache the result
6,688
protected function setUserFromDb ( ) { $ this -> intId = $ this -> id ; foreach ( $ this -> arrData as $ key => $ value ) { if ( ! is_numeric ( $ value ) ) { $ this -> $ key = \ StringUtil :: deserialize ( $ value ) ; } } $ always = array ( 'alexf' ) ; $ depends = array ( ) ; if ( is_array ( $ GLOBALS [ 'TL_PERMISSIONS...
set all user properties from a database record
6,689
public function generate ( ) { $ output = $ this -> generateIdeHelperOutput ( ) ; $ this -> writeIdeHelperFile ( $ output , '.ide-helper.php' ) ; $ outputForPhpStormIde = $ this -> generatePhpStormIdeHelperOutput ( ) ; $ this -> writeIdeHelperFile ( $ outputForPhpStormIde , '.phpstorm.meta.php/oxid.meta.php' ) ; }
Generate a helper file for IDE auto - completion
6,690
protected function getSmarty ( ) { $ smarty = new \ Smarty ( ) ; $ currentDirectory = dirname ( __FILE__ ) ; $ smarty -> template_dir = realpath ( $ currentDirectory . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR ) ; $ smarty -> compile_dir = realpath ( $ currentDirectory . '...
Return an instance of smarty
6,691
public function path ( $ route , $ page , array $ parameters = [ ] ) { $ fieldName = 'page' ; if ( isset ( $ parameters [ '_page' ] ) ) { $ fieldName = $ parameters [ '_page' ] ; unset ( $ parameters [ '_page' ] ) ; } $ parameters [ $ fieldName ] = $ page ; return $ this -> router -> generate ( $ route , $ parameters )...
Generates url to certain page .
6,692
public function getOptionParser ( ) { $ parser = parent :: getOptionParser ( ) ; $ parser -> setDescription ( ( string ) __ ( 'Synchronize local and remote calendars with the database' ) ) ; $ parser -> addOption ( 'start' , [ 'description' => ( string ) __ ( 'Specify start interval for the events to fetch' ) , 'help' ...
Manage available options via Parser
6,693
protected function setDefaultTimePeriod ( array $ params = [ ] ) : array { $ options = [ ] ; if ( ! empty ( $ params [ 'start' ] ) ) { $ options [ 'period' ] [ 'start_date' ] = $ params [ 'start' ] ; } if ( ! empty ( $ params [ 'end' ] ) ) { $ options [ 'period' ] [ 'end_date' ] = $ params [ 'end' ] ; } return $ option...
Set Default Time period
6,694
public static function getModuleFiles ( ? string $ path = null ) : array { $ configs = [ ] ; if ( empty ( $ path ) ) { throw new InvalidArgumentException ( ( string ) __ ( 'Specify [path] for the JSON configs' ) ) ; } $ folder = new Folder ( $ path ) ; $ files = $ folder -> findRecursive ( '.*\.json' ) ; if ( ! empty (...
Get JSON config files to map entities
6,695
public static function getModuleConfigNames ( string $ entityName , array $ files = [ ] , string $ path = '' ) : array { $ configs = [ ] ; foreach ( $ files as $ k => $ file ) { $ label = str_replace ( $ path , '' , $ file ) ; $ label = str_replace ( '.json' , '' , $ label ) ; $ parts = array_filter ( explode ( '/' , $...
Trim down the list of configs based on the file paths
6,696
public function verify ( $ response ) { if ( ! $ this -> secretKey ) { throw new Exception ( 'Missing secret key' ) ; } $ params = array ( 'secret' => $ this -> secretKey , 'response' => $ response , ) ; if ( $ this -> ip !== null ) { $ params [ 'remoteip' ] = $ this -> ip ; } $ this -> httpClient -> setUri ( self :: V...
Verify the user input
6,697
public function setOptions ( $ options = array ( ) ) { if ( $ options instanceof Traversable ) { $ options = ArrayUtils :: iteratorToArray ( $ options ) ; } if ( ! is_array ( $ options ) ) { throw new \ Exception ( 'Config parameter is not a valid' ) ; } foreach ( $ options as $ key => $ value ) { $ this -> options [ $...
Set configuration parameters for HTTP client
6,698
public function getObjectInstance ( EntityInterface $ entity , $ map , ArrayObject $ options ) { $ object = null ; $ object = new EventObject ( ) ; foreach ( $ map as $ field => $ config ) { $ method = Inflector :: variable ( 'set ' . Inflector :: variable ( $ field ) ) ; if ( 'field' == $ config -> type ) { $ object -...
Get Object Type instance
6,699
public function getEventType ( EntityInterface $ entity , ArrayObject $ options , $ map = null ) { $ result = 'Json::' . $ entity -> getSource ( ) . '::Default' ; if ( ! empty ( $ options [ 'event_type' ] ) ) { $ result = $ options [ 'event_type' ] ; } return $ result ; }
Get Default Event Type