idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
19,900
public function getTemplate ( $ domain , $ name ) { if ( ! isset ( $ this -> templates [ $ domain ] [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Template with name "%s" in domain "%s" has not been registered' , $ name , $ domain ) ) ; } return $ this -> templates [ $ domain ] [ $ name ] ; }
Retrieves a template by domain and name .
19,901
public function parameterize ( TemplateInterface $ template ) { $ params = [ ] ; foreach ( $ template -> getRequirements ( ) as $ key => $ requirement ) { if ( ! $ this -> input -> hasOption ( $ key ) || ! $ this -> input -> getOption ( $ key ) ) { list ( $ prompt , $ default ) = $ requirement ; if ( 'description' === ...
Retrieves the requirements of the given template and asks the user for any parameters that are not available from the input then binds the parameters to the template .
19,902
public function askAndRender ( $ templateDomain , $ templateName ) { $ template = $ this -> getTemplate ( $ templateDomain , $ templateName ) ; $ this -> parameterize ( $ template ) ; return $ template -> render ( ) ; }
Asks and renders will render the template .
19,903
public function bindAndRender ( array $ parameters , $ templateDomain , $ templateName ) { $ template = $ this -> getTemplate ( $ templateDomain , $ templateName ) ; $ template -> bind ( $ parameters ) ; return $ template -> render ( ) ; }
Like askAndRender but directly binding parameters passed not as options but as direct input argument to method .
19,904
public function getNamesForDomain ( $ domain ) { if ( ! isset ( $ this -> templates [ $ domain ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown template domain "%s"' , $ domain ) ) ; } return array_keys ( $ this -> templates [ $ domain ] ) ; }
Returns the names of registered templates in the given domain .
19,905
public function getCommitStatuses ( $ org , $ repo , $ hash ) { $ pager = new ResultPager ( $ this -> client ) ; return $ pager -> fetchAll ( $ this -> client -> api ( 'repo' ) -> statuses ( ) , 'combined' , [ $ org , $ repo , $ hash ] ) [ 'statuses' ] ; }
Gets the status of a commit reference .
19,906
public function ensureRemoteExists ( $ org , $ repo ) { $ adapter = $ this -> application -> getAdapter ( ) ; $ pushUrl = $ adapter -> getRepositoryInfo ( $ org , $ repo ) [ 'push_url' ] ; if ( ! $ this -> remoteExists ( $ org , $ pushUrl ) ) { $ this -> getHelperSet ( ) -> get ( 'gush_style' ) -> note ( sprintf ( 'Add...
Ensure the remote exist for the org and repo .
19,907
public function ensureNotesFetching ( $ remote ) { $ fetches = StringUtil :: splitLines ( $ this -> getGitConfig ( 'remote.' . $ remote . '.fetch' , 'local' , true ) ) ; if ( ! in_array ( '+refs/notes/*:refs/notes/*' , $ fetches , true ) ) { $ this -> getHelperSet ( ) -> get ( 'gush_style' ) -> note ( sprintf ( 'Set fe...
Ensures the fetching of notes is configured for the remote .
19,908
public function truncate ( $ string , $ length , $ alignment = null , $ delimString = null ) { $ alignment = $ alignment === null ? 'left' : $ alignment ; $ delimString = $ delimString === null ? '...' : $ delimString ; $ delimLen = strlen ( $ delimString ) ; if ( ! in_array ( $ alignment , [ 'left' , 'right' ] , true ...
Truncates a string .
19,909
public function setFixedColumnWidths ( array $ columnWidths ) { if ( $ columnWidths !== array_filter ( $ columnWidths , 'is_numeric' ) || array_keys ( $ columnWidths ) !== array_filter ( array_keys ( $ columnWidths ) , 'is_int' ) ) { throw new \ InvalidArgumentException ( 'Array must contain integer keys and numeric va...
Set custom column widths with 0 representing the first column .
19,910
public function getColumnWidths ( ) { foreach ( $ this -> columnWidths as $ column => $ width ) { if ( $ width > $ this -> maxColumnWidth ) { $ this -> columnWidths [ $ column ] = $ this -> maxColumnWidth ; } elseif ( $ width < $ this -> minColumnWidth ) { $ this -> columnWidths [ $ column ] = $ this -> minColumnWidth ...
Return array containing all column widths limited to min or max column width if one or both of them are set .
19,911
public function addRow ( array $ row , Style $ style ) { $ columnCount = count ( $ row ) ; $ this -> updateMaxColumnCount ( $ columnCount ) ; $ cellXml = $ this -> getCellXml ( $ row , $ style ) ; return $ this -> getRowXml ( $ columnCount , $ cellXml ) ; }
Add single row and style to sheet .
19,912
private function getRowXml ( $ columnCount , $ cellXml ) { return sprintf ( RowXml :: DEFAULT_XML , $ this -> rowIndex ++ , $ columnCount , $ cellXml ) ; }
Build and return xml string for single row .
19,913
private function getCellXml ( array $ row , Style $ style ) { $ cellXml = '' ; foreach ( array_values ( $ row ) as $ cellIndex => $ cellValue ) { $ this -> updateColumnWidths ( $ cellValue , $ cellIndex , $ style -> getFont ( ) ) ; $ cellXml .= $ this -> cellBuilder -> build ( $ this -> rowIndex , $ cellIndex , $ cellV...
Build and return xml string for single cell and update cell widths .
19,914
private function updateColumnWidths ( $ value , $ cellIndex , Font $ font ) { if ( $ this -> useCellAutosizing ) { $ cellWidth = $ this -> sizeCalculator -> getCellWidth ( $ font -> getName ( ) , $ font -> getSize ( ) , $ value ) ; if ( ! isset ( $ this -> columnWidths [ $ cellIndex ] ) || $ this -> columnWidths [ $ ce...
Track cell width for column width sizing if its enabled .
19,915
public function isXml ( $ xmlString ) { $ previousValue = libxml_use_internal_errors ( true ) ; $ simpleXml = simplexml_load_string ( $ xmlString ) ; libxml_use_internal_errors ( $ previousValue ) ; return false !== $ simpleXml ; }
Checks XML string for validity
19,916
public function removeAnnouncement ( $ xmlString ) { $ matches = [ ] ; preg_match ( '/<?xml version="(.*)" encoding="(.*)"?>(.*)$/isuU' , $ xmlString , $ matches ) ; return isset ( $ matches [ 3 ] ) ? $ matches [ 3 ] : $ xmlString ; }
Removes XML declaration
19,917
public function setLayout ( $ layout ) { if ( is_string ( $ layout ) ) { $ layout = constant ( 'Gush\Helper\TableHelper::LAYOUT_' . strtoupper ( $ layout ) ) ; } switch ( $ layout ) { case self :: LAYOUT_BORDERLESS : $ this -> table -> setStyle ( 'borderless' ) ; break ; case self :: LAYOUT_COMPACT : $ this -> table ->...
Sets table layout type .
19,918
protected function convertToStringOrBoolean ( $ string ) { $ result = ( string ) $ string ; $ lowerString = strtolower ( $ result ) ; if ( 'true' === $ lowerString ) { $ result = true ; } elseif ( 'false' === $ lowerString ) { $ result = false ; } return $ result ; }
Cast to string or to a boolean value if the string contains a true or false
19,919
public function readFontMetadata ( ) { $ fontHandle = fopen ( $ this -> fileName , "r" ) ; $ offset = $ this -> getNameTableOffset ( $ fontHandle ) ; fseek ( $ fontHandle , $ offset , SEEK_SET ) ; $ nameTableHeader = fread ( $ fontHandle , 6 ) ; $ numberOfRecords = $ this -> unpack ( substr ( $ nameTableHeader , 2 , 2 ...
Read the font Metadata
19,920
public function supports ( $ name , $ supports ) { if ( ! isset ( $ this -> adapters [ $ name ] ) ) { return false ; } return $ this -> adapters [ $ name ] [ $ supports ] ; }
Returns whether the adapter by name supports the requirements .
19,921
public function get ( $ name ) { if ( ! isset ( $ this -> adapters [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'No Adapter with name "%s" is registered.' , $ name ) ) ; } return $ this -> adapters [ $ name ] ; }
Returns the requested adapter - factory configuration .
19,922
public function createConfigurator ( $ name , HelperSet $ helperSet , Config $ globalConfig ) { return $ this -> getFactoryObject ( $ name ) -> createConfigurator ( $ helperSet , $ globalConfig ) ; }
Creates a new Configurator instance for the given adapter .
19,923
public function downloadFile ( $ url , $ progress = true ) { $ progressBar = null ; $ downloadCallback = function ( $ size , $ downloaded , $ client , $ request , Response $ response ) use ( & $ progressBar ) { if ( $ response -> getStatusCode ( ) >= 300 ) { return ; } if ( null === $ progressBar ) { ProgressBar :: set...
Download a file from the URL to the destination .
19,924
private function formatSize ( $ bytes ) { $ units = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' ] ; $ bytes = max ( $ bytes , 0 ) ; $ pow = $ bytes ? floor ( log ( $ bytes , 1024 ) ) : 0 ; $ pow = min ( $ pow , count ( $ units ) - 1 ) ; $ bytes /= pow ( 1024 , $ pow ) ; return number_format ( $ bytes , 2 ) . ' ' . $ units [ $ po...
Utility method to show the number of bytes in a readable format .
19,925
public function setSurroundingBorder ( $ style = BorderStyle :: THIN , $ color = '000000' ) { $ this -> setBorderLeft ( $ style , $ color ) ; $ this -> setBorderRight ( $ style , $ color ) ; $ this -> setBorderTop ( $ style , $ color ) ; $ this -> setBorderBottom ( $ style , $ color ) ; return $ this ; }
Convenience method to set all borders at once .
19,926
public function fetch ( $ result , $ valuesKey = 'values' ) { if ( '1.0' === $ this -> client -> getApiVersion ( ) ) { return $ this -> fetchApi1 ( $ result , $ valuesKey ) ; } $ request = $ this -> client -> getLastRequest ( ) ; if ( ! array_key_exists ( 'values' , $ result ) ) { throw new \ RuntimeException ( sprintf...
Fetches all the results .
19,927
protected function fetchApi1 ( $ result , $ valuesKey = 'values' ) { $ request = $ this -> client -> getLastRequest ( ) ; if ( ! array_key_exists ( $ valuesKey , $ result ) ) { throw new \ RuntimeException ( sprintf ( 'No values-key "%s" found in resource "%s", please report this bug to the Gush developers.' , $ values...
Fetches all the results using API version 1 . 0 .
19,928
public function getCollectionAction ( $ start , MediaFolder $ parent = null ) { $ mediaFolders = [ ] ; $ results = $ this -> getMediaFolderRepository ( ) -> getMediaFolders ( $ parent , [ 'field' => '_leftnode' , 'dir' => 'asc' , ] ) ; foreach ( $ results as $ folder ) { if ( $ this -> isGranted ( 'VIEW' , $ folder ) |...
Get collection of media folder
19,929
public function postAction ( Request $ request , $ parent = null ) { $ title = trim ( $ request -> request -> get ( 'title' ) ) ; if ( ! $ this -> isGranted ( 'CREATE' , $ parent ) ) { throw new AccessDeniedHttpException ( sprintf ( 'You are not authorized to create %s MediaFolder.' , $ title ) ) ; } try { $ uid = $ re...
Create a media folder and if a parent is provided added has its last child
19,930
public function getAncestorsAction ( MediaFolder $ folder ) { $ ancestors = $ this -> getMediaFolderRepository ( ) -> getAncestors ( $ folder ) ; return $ this -> createJsonResponse ( $ ancestors ) ; }
Get folder ancestors
19,931
public function addValidator ( ValidatorInterface $ validator ) { foreach ( ( array ) $ validator -> getGroups ( ) as $ group_name ) { if ( false === array_key_exists ( $ group_name , $ this -> validators ) ) { $ this -> validators [ $ group_name ] = array ( ) ; } $ this -> validators [ $ group_name ] [ ] = $ validator...
Allows you to add validator .
19,932
public function isValid ( $ group_name , $ object = null ) { if ( false === $ this -> isValidGroup ( $ group_name ) ) { throw new InvalidArgumentException ( "$group_name is not a valid cache validator group." ) ; } $ is_valid = true ; foreach ( $ this -> validators [ $ group_name ] as $ validator ) { if ( false === $ v...
It will invoke every validators of provided group name to define if current set is valid or not .
19,933
protected function setDefaultValues ( array $ params , ParameterBag $ values ) { foreach ( $ params as $ param ) { if ( ! array_key_exists ( 'default' , $ param ) || null === $ param [ 'default' ] ) { continue ; } if ( false === $ values -> has ( $ param [ 'name' ] ) ) { $ values -> set ( $ param [ 'name' ] , $ param [...
Set default values .
19,934
protected function validateParams ( Validator $ validator , array $ params , ParameterBag $ values ) { $ violations = new ConstraintViolationList ( ) ; foreach ( $ params as $ param ) { if ( empty ( $ param [ 'requirements' ] ) ) { continue ; } $ value = $ values -> get ( $ param [ 'name' ] ) ; $ paramViolations = $ va...
Validate params .
19,935
private function getRoles ( ApiUserInterface $ user ) { $ roles = $ user -> getRoles ( ) ; if ( $ user -> getApiKeyEnabled ( ) ) { $ roles [ ] = $ this -> apiUserRole ; } return $ roles ; }
Add API user role to authenticated token
19,936
protected function formatContext ( array $ vars , array $ context ) { $ context = array_merge ( [ 'timestamp' => $ this -> stringify ( $ vars [ 'datetime' ] ) , 'channel' => $ this -> stringify ( $ vars [ 'channel' ] ) , 'severity' => $ this -> stringify ( $ vars [ 'level_name' ] ) , 'level' => $ vars [ 'level' ] , 'me...
Formats the context array in the desired log format .
19,937
public function andLevelEquals ( $ level , $ alias = null ) { list ( $ alias , $ suffix ) = $ this -> getAliasAndSuffix ( $ alias ) ; return $ this -> andWhere ( $ alias . '._level = :level' . $ suffix ) -> setParameter ( 'level' . $ suffix , $ level ) ; }
Add query part to select nodes by level .
19,938
public function andIsPreviousSiblingOf ( AbstractNestedNode $ node , $ alias = null ) { return $ this -> andRootIs ( $ node -> getRoot ( ) , $ alias ) -> andRightnodeEquals ( $ node -> getLeftnode ( ) - 1 , $ alias ) ; }
Add query part to select previous sibling of node .
19,939
public function andIsPreviousSiblingsOf ( AbstractNestedNode $ node , $ alias = null ) { return $ this -> andParentIs ( $ node -> getParent ( ) , $ alias ) -> andLeftnodeIsLowerThan ( $ node -> getLeftnode ( ) , true , $ alias ) ; }
Add query part to select previous siblings of node .
19,940
public function andIsNextSiblingOf ( AbstractNestedNode $ node , $ alias = null ) { return $ this -> andRootIs ( $ node -> getRoot ( ) , $ alias ) -> andLeftnodeEquals ( $ node -> getRightnode ( ) + 1 , $ alias ) ; }
Add query part to select next sibling of node .
19,941
public function andIsNextSiblingsOf ( AbstractNestedNode $ node , $ alias = null ) { return $ this -> andParentIs ( $ node -> getParent ( ) , $ alias ) -> andLeftnodeIsUpperThan ( $ node -> getRightnode ( ) , true , $ alias ) ; }
Add query part to select next siblings of node .
19,942
protected function getAliasAndSuffix ( $ alias = null ) { $ suffix = count ( $ this -> getParameters ( ) ) ; $ alias = $ this -> getFirstAlias ( $ alias ) ; return array ( $ alias , $ suffix ) ; }
Compute suffix and alias used by query part .
19,943
public function getAction ( Revision $ revision ) { $ this -> granted ( 'VIEW' , $ revision -> getContent ( ) ) ; $ response = $ this -> createJsonResponse ( ) ; $ response -> setData ( $ revision -> jsonSerialize ( Revision :: JSON_REVISION_FORMAT ) ) ; return $ response ; }
Returns a revision .
19,944
public function getCollectionByContentAction ( $ type , $ uid , $ start , $ count ) { $ content = $ this -> findOneByTypeAndUid ( $ type , $ uid ) ; $ this -> granted ( 'VIEW' , $ content ) ; $ revisions = $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\ClassContent\Revision' ) -> getRevisions ( $ content , ...
Returns collection of revisions for a content .
19,945
public function update ( Revision $ revision ) { switch ( $ revision -> getState ( ) ) { case Revision :: STATE_ADDED : throw new ClassContentException ( 'Content is not versioned yet' , ClassContentException :: REVISION_ADDED ) ; break ; case Revision :: STATE_MODIFIED : try { $ this -> checkContent ( $ revision ) ; t...
Update user revision .
19,946
public function getDraft ( AbstractClassContent $ content , BBUserToken $ token , $ checkoutOnMissing = false ) { if ( null === $ revision = $ content -> getDraft ( ) ) { try { if ( false === $ this -> _em -> contains ( $ content ) ) { $ content = $ this -> _em -> find ( get_class ( $ content ) , $ content -> getUid ( ...
Return the user s draft of a content optionally checks out a new one if not exists .
19,947
public function getAllDrafts ( TokenInterface $ token ) { $ owner = UserSecurityIdentity :: fromToken ( $ token ) ; $ states = [ Revision :: STATE_ADDED , Revision :: STATE_MODIFIED ] ; $ result = [ ] ; try { $ result = $ this -> findBy ( [ '_owner' => $ owner , '_state' => $ states , ] ) ; } catch ( ConversionExceptio...
Returns all current drafts for authenticated user .
19,948
private function checkContent ( Revision $ revision ) { $ content = $ revision -> getContent ( ) ; if ( null === $ content || ! ( $ content instanceof AbstractClassContent ) ) { $ this -> _em -> remove ( $ revision ) ; throw new ClassContentException ( 'Orphan revision, deleted' , ClassContentException :: REVISION_ORPH...
Checks the content state of a revision .
19,949
public function getIcon ( AbstractContent $ content ) { $ iconUri = null ; foreach ( $ this -> iconizers as $ iconizer ) { if ( null !== $ iconUri = $ iconizer -> getIcon ( $ content ) ) { break ; } } return $ iconUri ; }
Returns the URL of the icon of the provided content .
19,950
public function dump ( array $ options = [ ] ) { $ compiled = false ; if ( isset ( $ options [ 'do_compile' ] ) && true === $ options [ 'do_compile' ] ) { $ this -> container -> compile ( ) ; $ compiled = true ; } $ dumper = [ 'parameters' => $ this -> dumpContainerParameters ( $ options ) , 'services' => $ this -> dum...
Dumps the service container .
19,951
private function dumpContainerDefinitions ( array $ options ) { $ definitions = [ ] ; foreach ( $ this -> container -> getDefinitions ( ) as $ key => $ definition ) { $ definitions [ $ key ] = $ this -> convertDefinitionToPhpArray ( $ definition ) ; $ this -> tryHydrateDefinitionForRestoration ( $ key , $ definition , ...
Dumps every container definitions into array .
19,952
private function dumpContainerAliases ( array $ options ) { $ aliases = [ ] ; foreach ( $ this -> container -> getAliases ( ) as $ id => $ alias ) { $ aliases [ $ id ] = $ alias -> __toString ( ) ; } return $ aliases ; }
Dumps every container aliases into array .
19,953
private function convertDefinitionToPhpArray ( Definition $ definition ) { $ definitionArray = [ ] ; if ( $ definition -> isSynthetic ( ) ) { $ definitionArray = $ this -> convertSyntheticDefinitionToPhpArray ( $ definition ) ; } $ this -> hydrateDefinitionClass ( $ definition , $ definitionArray ) ; $ this -> hydrateD...
Convert a single definition entity into array .
19,954
private function hydrateDefinitionClass ( Definition $ definition , array & $ definitionArray ) { if ( null !== $ definition -> getClass ( ) ) { $ definitionArray [ 'class' ] = $ definition -> getClass ( ) ; } }
Try to hydrate definition class from entity into definition array .
19,955
private function hydrateDefinitionArguments ( Definition $ definition , array & $ definitionArray ) { foreach ( $ definition -> getArguments ( ) as $ arg ) { $ definitionArray [ 'arguments' ] [ ] = $ this -> convertArgument ( $ arg ) ; } }
Try to hydrate definition arguments from entity into definition array .
19,956
private function hydrateDefinitionFactory ( Definition $ definition , array & $ definitionArray ) { if ( null !== $ definition -> getFactory ( ) ) { foreach ( $ definition -> getFactory ( ) as $ argument ) { $ definitionArray [ 'factory' ] [ ] = $ this -> convertArgument ( $ argument ) ; } } }
Try to hydrate definition factory from entity into definition array .
19,957
private function hydrateDefinitionTags ( Definition $ definition , array & $ definitionArray ) { foreach ( $ definition -> getTags ( ) as $ key => $ tag ) { $ definitionTag = [ 'name' => $ key , ] ; foreach ( array_shift ( $ tag ) as $ key => $ option ) { $ definitionTag [ $ key ] = $ option ; } $ definitionArray [ 'ta...
Hydrate definition tags from entity into definition array .
19,958
private function hydrateDefinitionMethodCalls ( Definition $ definition , array & $ definitionArray ) { foreach ( $ definition -> getMethodCalls ( ) as $ methodToCall ) { $ method_call_array = [ ] ; $ method_name = array_shift ( $ methodToCall ) ; $ method_call_array [ ] = $ method_name ; $ methodArgs = [ ] ; foreach (...
Hydrate definition array method calls with definition entity .
19,959
private function hydrateDefinitionConfigurator ( Definition $ definition , array & $ definitionArray ) { if ( null !== $ configurator = $ definition -> getConfigurator ( ) ) { if ( is_string ( $ configurator ) ) { $ definitionArray [ 'configurator' ] = $ definition -> getConfigurator ( ) ; } else { $ definitionArray [ ...
Try to hydrate definition array method calls with definition entity .
19,960
private function hydrateDefinitionScopeProperty ( Definition $ definition , array & $ definitionArray ) { if ( ContainerInterface :: SCOPE_CONTAINER !== $ definition -> getScope ( ) ) { $ definitionArray [ 'scope' ] = $ definition -> getScope ( ) ; } }
Try to hydrate definition scope property from entity into definition array .
19,961
private function hydrateDefinitionFileProperty ( Definition $ definition , array & $ definitionArray ) { if ( null !== $ definition -> getFile ( ) ) { $ definitionArray [ 'file' ] = $ definition -> getFile ( ) ; } }
Try to hydrate definition file property from entity into definition array .
19,962
public function download ( $ region , $ gameId , $ encryptionKey , OutputInterface $ output = null , $ isOverride = false , $ isAsync = false , $ consolePath = null ) { if ( ! $ this -> client -> isGameExists ( $ region , $ gameId ) ) { throw new GameNotFoundException ( 'The game #' . $ gameId . ' is not found' ) ; } i...
Download a replay .
19,963
private static function updateIdxSiteContents ( array $ contents_inserted , array $ contents_removed ) { if ( null === $ site = self :: $ _application -> getSite ( ) ) { return ; } self :: $ em -> getRepository ( 'BackBee\ClassContent\Indexes\IdxContentContent' ) -> replaceIdxSiteContents ( $ site , array_diff ( $ cont...
Updates the site - content indexes for the scheduled AbstractClassContent .
19,964
private static function updateIdxContentContents ( array $ contents_saved , array $ contents_removed ) { if ( null === self :: $ _application -> getSite ( ) ) { return ; } self :: $ em -> getRepository ( 'BackBee\ClassContent\Indexes\IdxContentContent' ) -> replaceIdxContentContents ( array_diff ( $ contents_saved , se...
Updates the content - content indexes for the scheduled AbstractClassContent .
19,965
private static function getApplication ( Event $ event ) { if ( null === self :: $ _application ) { if ( null !== $ event -> getDispatcher ( ) ) { self :: $ _application = $ event -> getDispatcher ( ) -> getApplication ( ) ; } } return self :: $ _application ; }
Returns the current application .
19,966
private static function getEntityManager ( Event $ event ) { if ( null === self :: $ em ) { if ( null !== self :: getApplication ( $ event ) ) { self :: $ em = self :: getApplication ( $ event ) -> getEntityManager ( ) ; } } return self :: $ em ; }
Returns the current entity manager .
19,967
public static function onFlushContent ( Event $ event ) { if ( null === self :: getEntityManager ( $ event ) ) { return ; } $ contents_inserted = ScheduledEntities :: getScheduledAClassContentInsertions ( self :: $ em , true , true ) ; $ contents_updated = ScheduledEntities :: getScheduledAClassContentUpdates ( self ::...
Updates every indexed value assocatied to the contents flushed .
19,968
private static function getIndexValue ( AbstractClassContent $ content , $ indexedField ) { if ( '@' === substr ( $ indexedField , 0 , 1 ) ) { return self :: getParamValue ( $ content , substr ( $ indexedField , 1 ) ) ; } else { return self :: getContentValue ( $ content , $ indexedField ) ; } }
Returns the indexed value .
19,969
private static function getParamValue ( AbstractClassContent $ content , $ indexedParam ) { $ value = ( array ) $ content -> getParamValue ( $ indexedParam ) ; $ owner = $ content ; return [ implode ( ',' , $ value ) , $ owner ] ; }
Returns the indexed parameter value .
19,970
private static function getContentValue ( AbstractClassContent $ content , $ indexedElement ) { $ value = $ owner = $ content ; $ elements = explode ( '->' , $ indexedElement ) ; foreach ( $ elements as $ element ) { $ value = $ value -> getData ( $ element ) ; if ( ! $ value instanceof AbstractClassContent ) { break ;...
Returns the indexed value of an element .
19,971
private static function applyCallbacks ( $ value , array $ callbacks ) { foreach ( $ callbacks as $ callback ) { $ value = call_user_func ( $ callback , $ value ) ; } return $ value ; }
Applies callbacks to value .
19,972
public function getDiscriminators ( ) { if ( null === $ this -> descriminators ) { $ this -> descriminators = [ ] ; if ( array_key_exists ( '_content_' , $ this -> schemes ) ) { foreach ( array_keys ( $ this -> schemes [ '_content_' ] ) as $ descriminator ) { $ this -> descriminators [ ] = 'BackBee\ClassContent\\' . $ ...
Returns the list of class content names used by one of schemes Dynamically add a listener on descrimator . onflush event to RewritingListener .
19,973
public function generate ( Page $ page , AbstractClassContent $ content = null , $ force = false , $ exceptionOnMissingScheme = true ) { if ( ! is_bool ( $ force ) ) { throw new \ InvalidArgumentException ( sprintf ( '%s method expect `force parameter` to be type of boolean, %s given' , __METHOD__ , gettype ( $ force )...
Generates and returns url for the provided page .
19,974
public function getUniqueness ( Page $ page , $ url ) { if ( ! $ this -> preserveUnicity ) { return $ url ; } $ pageRepository = $ this -> application -> getEntityManager ( ) -> getRepository ( 'BackBee\NestedNode\Page' ) ; if ( null === $ pageRepository -> findOneBy ( [ '_url' => $ url , '_root' => $ page -> getRoot (...
Checks for the uniqueness of the URL and postfixe it if need .
19,975
private function doGenerate ( $ scheme , Page $ page , AbstractClassContent $ content = null ) { $ replacement = [ '$parent' => $ page -> isRoot ( ) ? '' : $ page -> getParent ( ) -> getUrl ( false ) , '$title' => StringUtils :: urlize ( $ page -> getTitle ( ) ) , '$datetime' => $ page -> getCreated ( ) -> format ( 'ym...
Computes the URL of a page according to a scheme .
19,976
protected function runSitesYmlProcess ( ) { $ sitesConf = $ this -> bbapp -> getConfig ( ) -> getSitesConfig ( ) ; if ( $ this -> siteDomain === null ) { throw new \ InvalidArgumentException ( 'This site domain is not valid (empty value)' ) ; } if ( is_array ( $ sitesConf ) && array_key_exists ( $ this -> siteLabel , $...
Create new site entry inside sites . yml file
19,977
protected function runLayoutsGenerationProcess ( ) { if ( null === $ site = $ this -> entyMgr -> find ( 'BackBee\Site\Site' , md5 ( $ this -> siteLabel ) ) ) { $ site = $ this -> createSite ( $ this -> siteLabel , $ this -> siteDomain ) ; } $ this -> bbapp -> getContainer ( ) -> set ( 'site' , $ site ) ; if ( null === ...
Create new site db entry home layout root page mediacenter and keyword
19,978
private function createSite ( $ siteLabel , $ siteDomain ) { $ site = new \ BackBee \ Site \ Site ( md5 ( $ this -> siteLabel ) ) ; $ site -> setLabel ( $ siteLabel ) -> setServerName ( $ siteDomain ) ; $ this -> entyMgr -> persist ( $ site ) ; $ this -> entyMgr -> flush ( $ site ) ; return $ site ; }
Create new site db entry
19,979
private function createRootPage ( $ site , $ layout ) { $ pagebuilder = $ this -> bbapp -> getContainer ( ) -> get ( 'pagebuilder' ) ; $ pagebuilder -> setUid ( md5 ( 'root-' . $ site -> getLabel ( ) ) ) -> setTitle ( 'Home' ) -> setLayout ( $ layout ) -> setSite ( $ site ) -> setUrl ( '/' ) -> putOnlineAndHidden ( ) ;...
Create new root page
19,980
private function createHomeLayout ( $ site ) { $ layout = new \ BackBee \ Site \ Layout ( md5 ( 'defaultlayout-' . $ site -> getLabel ( ) ) ) ; $ layout -> setData ( '{"templateLayouts":[{"title":"Top column","layoutSize":{"height":300,"width":false},"gridSizeInfos":{"colWidth":60,"gutterWidth":20},"id":"Layout__133294...
Create new home layout
19,981
public function onPreRenderContent ( RendererEvent $ event ) { $ this -> object = $ event -> getTarget ( ) ; if ( false === ( $ this -> object instanceof AbstractClassContent ) || false === $ this -> checkCacheContentEvent ( ) ) { return ; } $ renderer = $ event -> getRenderer ( ) ; $ cache_id = $ this -> getContentCac...
Looks for available cached data before rendering a content .
19,982
public function onPostRenderContent ( RendererEvent $ event ) { $ this -> object = $ event -> getTarget ( ) ; if ( false === ( $ this -> object instanceof AbstractClassContent ) || false === $ this -> checkCacheContentEvent ( ) ) { return ; } $ renderer = $ event -> getRenderer ( ) ; if ( false === $ cache_id = $ this ...
Saves in cache the rendered cache data .
19,983
public function onFlushContent ( Event $ event ) { $ this -> object = $ event -> getTarget ( ) ; if ( false === ( $ this -> object instanceof AbstractClassContent ) || false === $ this -> checkCacheContentEvent ( false ) ) { return ; } $ parent_uids = $ this -> application -> getEntityManager ( ) -> getRepository ( 'Ba...
Clears cached data associated to the content to be flushed .
19,984
public function onPreRenderPage ( RendererEvent $ event ) { $ this -> object = $ event -> getTarget ( ) ; if ( false === ( $ this -> object instanceof Page ) || false === $ this -> checkCachePageEvent ( ) ) { return ; } $ cache_id = $ this -> getPageCacheId ( ) ; if ( false === $ data = $ this -> cache_page -> load ( $...
Looks for available cached data before rendering a page .
19,985
public function onPostRenderPage ( RendererEvent $ event ) { $ this -> object = $ event -> getTarget ( ) ; if ( false === ( $ this -> object instanceof Page ) || false === $ this -> checkCachePageEvent ( ) ) { return ; } if ( false === $ cache_id = $ this -> getPageCacheId ( ) ) { return ; } $ column_uids = array ( ) ;...
Saves in cache the rendered page data .
19,986
public function onFlushPage ( Event $ event ) { $ this -> object = $ event -> getTarget ( ) ; if ( false === ( $ this -> object instanceof Page ) || false === $ this -> checkCachePageEvent ( false ) ) { return ; } if ( true === $ this -> page_cache_deletion_done ) { return ; } $ pages = ScheduledEntities :: getSchedule...
Clears cached data associated to the page to be flushed .
19,987
private function checkCacheContentEvent ( $ check_status = true ) { if ( null === $ this -> cache_content ) { return false ; } if ( $ this -> object instanceof ContentSet && true === is_array ( $ this -> object -> getPages ( ) ) && 0 < $ this -> object -> getPages ( ) -> count ( ) ) { return false ; } return true === $...
Checks the event and system validity then returns the content target FALSE otherwise .
19,988
private function checkCachePageEvent ( $ check_status = true ) { return null !== $ this -> cache_page && true === $ this -> validator -> isValid ( 'page' , $ this -> application -> getRequest ( ) -> getUri ( ) ) && ( true === $ check_status ? $ this -> validator -> isValid ( 'cache_status' , $ this -> object ) : true )...
Checks the event and system validity then returns the page target FALSE otherwise .
19,989
private function getContentCacheId ( AbstractRenderer $ renderer ) { $ cache_id = $ this -> identifier_generator -> compute ( 'content' , $ this -> object -> getUid ( ) . '-' . $ renderer -> getMode ( ) , $ renderer ) ; return md5 ( '_content_' . $ cache_id ) ; }
Return the cache id for the current rendered content .
19,990
public function fillProperties ( ) { $ entity = $ this -> entity ; $ entityInfo = new EntityInfo ( $ entity ) ; $ entityProperties = $ entityInfo -> getProperties ( ) ; foreach ( $ entityProperties as $ property ) { $ propertyName = $ property -> getName ( ) ; $ fakeData = $ this -> faker -> fake ( $ propertyName ) -> ...
Fills properties .
19,991
public function fillMethods ( ) { $ entity = $ this -> entity ; $ entityInfo = new EntityInfo ( $ entity ) ; $ entityMethods = $ entityInfo -> getSetters ( ) ; foreach ( $ entityMethods as $ methods ) { $ methodsName = $ methods -> getName ( ) ; $ nameToFake = substr ( $ methodsName , 3 , strlen ( $ methodsName ) ) ; $...
Fills mehtods .
19,992
public function fill ( ) { $ totalColumn = $ this -> db -> getTotalColumns ( ) ; $ rows = array ( ) ; for ( $ n = 0 ; $ n < $ this -> num ; $ n ++ ) { $ fakeRow = new DbRowEntity ( ) ; for ( $ i = 0 ; $ i < $ totalColumn ; $ i ++ ) { if ( $ this -> db -> isColumnAutoincrement ( $ i ) ) { continue ; } $ fieldName = $ th...
Fills the tablename with fake value .
19,993
public function handle ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ response = $ this -> successHandler -> onLogoutSuccess ( $ request ) ; if ( ! $ response instanceof Response ) { throw new \ RuntimeException ( 'Logout Success Handler did not return a Response.' ) ; } if ( null !== $ token ...
Performs the logout if requested .
19,994
public static function get ( $ filePath ) { $ fileName = basename ( $ filePath ) ; if ( ! array_key_exists ( $ fileName , static :: $ files ) ) { try { $ file = new File ( $ filePath ) ; } catch ( \ Exception $ e ) { $ file = false ; } static :: $ files [ $ fileName ] = $ file ; } return static :: $ files [ $ fileName ...
Gets a file from container or create a new one if not present .
19,995
protected function runInsertSudoerProcess ( ) { if ( ! $ this -> input -> getOption ( 'user_name' ) || ! $ this -> input -> getOption ( 'user_password' ) || ! $ this -> input -> getOption ( 'user_email' ) ) { $ this -> output -> writeln ( '<info>You have to specify all option in order to insert a new superadmin user (-...
Insert the user in DB and security . yml file
19,996
private function createUser ( $ login , $ password , $ email ) { $ encoderFactory = $ this -> bbapp -> getContainer ( ) -> get ( 'security.context' ) -> getEncoderFactory ( ) ; $ adminUser = new \ BackBee \ Security \ User ( $ login , $ password , 'SuperAdmin' , 'SuperAdmin' ) ; $ adminUser -> setApiKeyEnabled ( true )...
Create new superadmin user
19,997
private function checkAclTables ( ) { $ this -> writeln ( '<info>Checking ACL tables</info>' , OutputInterface :: VERBOSITY_VERBOSE ) ; $ this -> write ( ' - ACL tables - ' , false , OutputInterface :: VERBOSITY_VERY_VERBOSE ) ; $ schemaManager = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ dropTableSq...
Checks ACL tables creates them if they don t exit .
19,998
private function checksTable ( $ classname , array $ fields ) { $ schemaManager = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ metadata = $ this -> em -> getClassMetadata ( $ classname ) ; $ tableName = $ metadata -> getTableName ( ) ; $ this -> writeln ( sprintf ( '<info>Checking %s table</info>' , $ ...
Checks for an existing table for entity .
19,999
private function cleanTables ( InputInterface $ input ) { $ aclOnly = true ; if ( $ input -> getOption ( 'clean' ) ) { $ this -> writeln ( '<info>Deleting current users and groups.</info>' , OutputInterface :: VERBOSITY_VERBOSE ) ; if ( OutputInterface :: VERBOSITY_QUIET < $ this -> output -> getVerbosity ( ) ) { $ hel...
Cleans current users and rights if asked .