idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
46,600
private function validateClaims ( array $ claims ) { if ( ! isset ( $ claims [ 'iss' ] ) || ( strcmp ( rtrim ( $ claims [ 'iss' ] , '/' ) , rtrim ( $ this -> issuerUrl , '/' ) ) !== 0 ) ) { throw new HttpException ( 400 , 'Invalid "iss"' ) ; } if ( ! isset ( $ claims [ 'aud' ] ) || ( strcmp ( $ claims [ 'aud' ] , $ thi...
Validates the claims data received from OpenID provider .
46,601
public function clientLink ( $ client , $ text = null , array $ htmlOptions = [ ] ) { $ viewOptions = $ client -> getViewOptions ( ) ; if ( empty ( $ viewOptions [ 'widget' ] ) ) { if ( $ text === null ) { $ text = Html :: tag ( 'span' , '' , [ 'class' => 'auth-icon ' . $ client -> getName ( ) ] ) ; } if ( ! isset ( $ ...
Outputs client auth link .
46,602
public function createClientUrl ( $ client ) { $ this -> autoRender = false ; $ url = $ this -> getBaseAuthUrl ( ) ; $ url [ $ this -> clientIdGetParamName ] = $ client -> getId ( ) ; return Url :: to ( $ url ) ; }
Composes client auth URL .
46,603
protected function generateCallback ( $ url = [ ] ) { if ( empty ( $ url ) ) { $ url = $ this -> authChoice -> createClientUrl ( $ this -> client ) ; } else { $ url = Url :: to ( $ url ) ; } if ( strpos ( $ url , '?' ) === false ) { $ url .= '?' ; } else { $ url .= '&' ; } $ callbackName = 'googleSignInCallback' . md5 ...
Generates JavaScript callback function which will be used to handle auth response .
46,604
protected function renderButton ( ) { $ buttonHtmlOptions = array_merge ( [ 'class' => 'g-signin' , 'data-callback' => $ this -> getCallback ( ) , 'data-clientid' => $ this -> client -> clientId , 'data-cookiepolicy' => 'single_host_origin' , 'data-requestvisibleactions' => null , 'data-scope' => $ this -> client -> sc...
Renders sign - in button .
46,605
protected function generateAuthState ( ) { $ baseString = get_class ( $ this ) . '-' . time ( ) ; if ( Yii :: $ app -> has ( 'session' ) ) { $ baseString .= '-' . Yii :: $ app -> session -> getId ( ) ; } return hash ( 'sha256' , uniqid ( $ baseString , true ) ) ; }
Generates the auth state value .
46,606
protected function auth ( $ client , $ authUrlParams = [ ] ) { if ( $ client instanceof OAuth2 ) { return $ this -> authOAuth2 ( $ client , $ authUrlParams ) ; } elseif ( $ client instanceof OAuth1 ) { return $ this -> authOAuth1 ( $ client , $ authUrlParams ) ; } elseif ( $ client instanceof OpenId ) { return $ this -...
Perform authentication for the given client .
46,607
protected function authSuccess ( $ client ) { if ( ! is_callable ( $ this -> successCallback ) ) { throw new InvalidConfigException ( '"' . get_class ( $ this ) . '::$successCallback" should be a valid callback.' ) ; } $ response = call_user_func ( $ this -> successCallback , $ client ) ; if ( $ response instanceof Res...
This method is invoked in case of successful authentication via auth client .
46,608
protected function authCancel ( $ client ) { if ( $ this -> cancelCallback !== null ) { $ response = call_user_func ( $ this -> cancelCallback , $ client ) ; if ( $ response instanceof Response ) { return $ response ; } } return $ this -> redirectCancel ( ) ; }
This method is invoked in case of authentication cancelation .
46,609
public function redirect ( $ url , $ enforceRedirect = true ) { $ viewFile = $ this -> redirectView ; if ( $ viewFile === null ) { $ viewFile = __DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'redirect.php' ; } else { $ viewFile = Yii :: getAlias ( $ viewFile ) ; } $ viewData = [ 'url' => $ url , 'enfor...
Redirect to the given URL or simply close the popup window .
46,610
protected function authOpenId ( $ client ) { $ request = Yii :: $ app -> getRequest ( ) ; $ mode = $ request -> get ( 'openid_mode' , $ request -> post ( 'openid_mode' ) ) ; if ( empty ( $ mode ) ) { $ url = $ client -> buildAuthUrl ( ) ; return Yii :: $ app -> getResponse ( ) -> redirect ( $ url ) ; } switch ( $ mode ...
Performs OpenID auth flow .
46,611
protected function authOAuth1 ( $ client , $ authUrlParams = [ ] ) { $ request = Yii :: $ app -> getRequest ( ) ; if ( $ request -> get ( 'denied' ) !== null ) { return $ this -> authCancel ( $ client ) ; } if ( ( $ oauthToken = $ request -> get ( 'oauth_token' , $ request -> post ( 'oauth_token' ) ) ) !== null ) { $ c...
Performs OAuth1 auth flow .
46,612
protected function authOAuth2 ( $ client , $ authUrlParams = [ ] ) { $ request = Yii :: $ app -> getRequest ( ) ; if ( ( $ error = $ request -> get ( 'error' ) ) !== null ) { if ( $ error === 'access_denied' || $ error === 'user_cancelled_login' || $ error === 'user_cancelled_authorize' ) { return $ this -> authCancel ...
Performs OAuth2 auth flow .
46,613
protected function createClient ( $ id , $ config ) { $ config [ 'id' ] = $ id ; if ( ! isset ( $ config [ 'httpClient' ] ) && $ this -> httpClient !== null ) { $ config [ 'httpClient' ] = $ this -> httpClient ; } return Yii :: createObject ( $ config ) ; }
Creates auth client instance from its array configuration .
46,614
public function hostExists ( $ url ) { if ( strpos ( $ url , '/' ) === false ) { $ server = $ url ; } else { $ server = @ parse_url ( $ url , PHP_URL_HOST ) ; } if ( ! $ server ) { return false ; } $ ips = gethostbynamel ( $ server ) ; return ! empty ( $ ips ) ; }
Checks if the server specified in the url exists .
46,615
protected function sendRequest ( $ url , $ method = 'GET' , $ params = [ ] ) { $ request = $ this -> createRequest ( ) -> setMethod ( $ method ) -> setUrl ( $ url ) -> setData ( $ params ) ; if ( $ this -> verifyPeer !== null ) { $ options = [ 'sslVerifyPeer' => $ this -> verifyPeer ] ; if ( $ this -> capath ) { $ opti...
Sends request to the server
46,616
protected function buildUrl ( $ baseUrl , $ additionalUrl ) { $ baseUrl = parse_url ( $ baseUrl ) ; if ( ! is_array ( $ additionalUrl ) ) { $ additionalUrl = parse_url ( $ additionalUrl ) ; } if ( isset ( $ baseUrl [ 'query' ] , $ additionalUrl [ 'query' ] ) ) { $ additionalUrl [ 'query' ] = $ baseUrl [ 'query' ] . '&'...
Combines given URLs into single one .
46,617
protected function buildSregParams ( ) { $ params = [ ] ; $ params [ 'openid.ns.sreg' ] = 'http://openid.net/extensions/sreg/1.1' ; if ( ! empty ( $ this -> requiredAttributes ) ) { $ params [ 'openid.sreg.required' ] = [ ] ; foreach ( $ this -> requiredAttributes as $ required ) { if ( ! isset ( $ this -> axToSregMap ...
Composes SREG request parameters .
46,618
protected function buildAxParams ( ) { $ params = [ ] ; if ( ! empty ( $ this -> requiredAttributes ) || ! empty ( $ this -> optionalAttributes ) ) { $ params [ 'openid.ns.ax' ] = 'http://openid.net/srv/ax/1.0' ; $ params [ 'openid.ax.mode' ] = 'fetch_request' ; $ aliases = [ ] ; $ counts = [ ] ; $ requiredAttributes =...
Composes AX request parameters .
46,619
protected function buildAuthUrlV1 ( $ serverInfo ) { $ returnUrl = $ this -> getReturnUrl ( ) ; if ( $ serverInfo [ 'identity' ] != $ this -> getClaimedId ( ) ) { $ returnUrl .= ( strpos ( $ returnUrl , '?' ) ? '&' : '?' ) . 'openid.claimed_id=' . $ this -> getClaimedId ( ) ; } $ params = array_merge ( [ 'openid.return...
Builds authentication URL for the protocol version 1 .
46,620
protected function buildAuthUrlV2 ( $ serverInfo ) { $ params = [ 'openid.ns' => 'http://specs.openid.net/auth/2.0' , 'openid.mode' => 'checkid_setup' , 'openid.return_to' => $ this -> getReturnUrl ( ) , 'openid.realm' => $ this -> getTrustRoot ( ) , ] ; if ( $ serverInfo [ 'ax' ] ) { $ params = array_merge ( $ params ...
Builds authentication URL for the protocol version 2 .
46,621
public function buildAuthUrl ( $ identifierSelect = null ) { $ authUrl = $ this -> authUrl ; $ claimedId = $ this -> getClaimedId ( ) ; if ( empty ( $ claimedId ) ) { $ this -> setClaimedId ( $ authUrl ) ; } $ serverInfo = $ this -> discover ( $ authUrl ) ; if ( $ serverInfo [ 'version' ] == 2 ) { if ( $ identifierSele...
Returns authentication URL . Usually you want to redirect your user to it .
46,622
public function validate ( $ validateRequiredAttributes = true ) { $ claimedId = $ this -> getClaimedId ( ) ; if ( empty ( $ claimedId ) ) { return false ; } $ params = [ 'openid.assoc_handle' => $ this -> data [ 'openid_assoc_handle' ] , 'openid.signed' => $ this -> data [ 'openid_signed' ] , 'openid.sig' => $ this ->...
Performs OpenID verification with the OP .
46,623
protected function validateRequiredAttributes ( ) { if ( ! empty ( $ this -> requiredAttributes ) ) { $ attributes = $ this -> fetchAttributes ( ) ; foreach ( $ this -> requiredAttributes as $ openIdAttributeName ) { if ( ! isset ( $ attributes [ $ openIdAttributeName ] ) ) { return false ; } } } return true ; }
Checks if all required attributes are present in the server response .
46,624
protected function fetchAxAttributes ( ) { $ alias = null ; if ( isset ( $ this -> data [ 'openid_ns_ax' ] ) && $ this -> data [ 'openid_ns_ax' ] != 'http://openid.net/srv/ax/1.0' ) { $ alias = 'ax' ; } else { foreach ( $ this -> data as $ key => $ value ) { if ( strncmp ( $ key , 'openid_ns_' , 10 ) === 0 && $ value =...
Gets AX attributes provided by OP .
46,625
protected function fetchSregAttributes ( ) { $ attributes = [ ] ; $ sregToAx = array_flip ( $ this -> axToSregMap ) ; foreach ( $ this -> data as $ key => $ value ) { $ keyMatch = 'openid_sreg_' ; if ( strncmp ( $ key , $ keyMatch , strlen ( $ keyMatch ) ) ) { continue ; } $ key = substr ( $ key , strlen ( $ keyMatch )...
Gets SREG attributes provided by OP . SREG names will be mapped to AX names .
46,626
protected function compareUrl ( $ expectedUrl , $ actualUrl ) { $ expectedUrlInfo = parse_url ( $ expectedUrl ) ; $ actualUrlInfo = parse_url ( $ actualUrl ) ; foreach ( $ expectedUrlInfo as $ name => $ expectedValue ) { if ( $ name == 'query' ) { parse_str ( $ expectedValue , $ expectedUrlParams ) ; parse_str ( $ actu...
Compares 2 URLs taking in account possible GET parameters order miss match and URL encoding inconsistencies .
46,627
public function getRoot ( ) { if ( ! $ this -> root ) { $ this -> root = $ this -> active -> getContext ( ) -> getCurrentSiteNode ( ) ; } return $ this -> root ; }
Get the root node
46,628
public function build ( $ includeRoot = false , $ root = null , $ depth = null ) { $ root = $ root === null ? $ this -> getRoot ( ) : $ root ; $ depth = $ depth === null ? $ this -> depth : $ depth ; $ result = [ ] ; foreach ( $ root -> getChildNodes ( $ this -> nodeTypeFilter ) as $ childNode ) { $ hasChildNodes = $ c...
Build a json serializable tree structure containing node information
46,629
protected function wrapHttpResponse ( \ Exception $ exception , string $ bodyContent ) : string { $ body = fopen ( 'php://temp' , 'rw' ) ; fputs ( $ body , $ bodyContent ) ; rewind ( $ body ) ; $ response = ( new Response ( ) ) -> withStatus ( $ exception instanceof FlowException ? $ exception -> getStatusCode ( ) : 50...
Renders an actual HTTP response including the correct status and cache control header .
46,630
public function canApply ( ) { $ nodeType = $ this -> getSubject ( ) -> getNodeType ( ) ; $ propertyName = $ this -> getPropertyName ( ) ; $ nodeTypeProperties = $ nodeType -> getProperties ( ) ; if ( ! isset ( $ nodeTypeProperties [ $ propertyName ] ) ) { return false ; } if ( isset ( $ nodeTypeProperties [ $ property...
Checks whether this change can be applied to the subject
46,631
public function jsonSerialize ( ) { $ feedbacks = [ ] ; foreach ( $ this -> feedbacks as $ feedback ) { $ feedbacks [ ] = $ feedback -> serialize ( $ this -> controllerContext ) ; } return [ 'timestamp' => new \ DateTime ( ) , 'feedbacks' => $ feedbacks ] ; }
Serialize collection to json_encode able array
46,632
public function serializeNodeRecursively ( NodeInterface $ node , ControllerContext $ controllerContext ) { $ result = [ $ node -> getContextPath ( ) => $ this -> nodeInfoHelper -> renderNodeWithPropertiesAndChildrenInformation ( $ node , $ controllerContext ) ] ; if ( $ this -> isRecursive === true ) { foreach ( $ nod...
Serialize node and all child nodes
46,633
public function handle ( NodeInterface $ node , array $ data ) { if ( $ node -> getNodeType ( ) -> isOfType ( 'Neos.Neos:Document' ) ) { if ( isset ( $ data [ 'title' ] ) ) { $ node -> setProperty ( 'title' , $ data [ 'title' ] ) ; } $ node -> setProperty ( 'uriPathSegment' , $ this -> nodeUriPathSegmentGenerator -> ge...
Set the node title for the newly created Document node
46,634
public function canApply ( ) { $ nodeType = $ this -> getSubject ( ) -> getNodeType ( ) ; return $ this -> getSiblingNode ( ) -> getParent ( ) -> isNodeTypeAllowedAsChildNode ( $ nodeType ) ; }
Subject is the to - be - copied node ; the sibling node is the node after which the Subject should be copied .
46,635
public function initializeController ( RequestInterface $ request , ResponseInterface $ response ) { parent :: initializeController ( $ request , $ response ) ; $ this -> feedbackCollection -> setControllerContext ( $ this -> getControllerContext ( ) ) ; }
Set the controller context on the feedback collection after the controller has been initialized
46,636
public function changeAction ( ChangeCollection $ changes ) { try { $ count = $ changes -> count ( ) ; $ changes -> apply ( ) ; $ success = new Info ( ) ; $ success -> setMessage ( sprintf ( '%d change(s) successfully applied.' , $ count ) ) ; $ this -> feedbackCollection -> add ( $ success ) ; $ this -> persistenceMan...
Apply a set of changes to the system
46,637
public function changeBaseWorkspaceAction ( string $ targetWorkspaceName , NodeInterface $ documentNode ) { try { $ targetWorkspace = $ this -> workspaceRepository -> findOneByName ( $ targetWorkspaceName ) ; $ userWorkspace = $ this -> userService -> getPersonalWorkspace ( ) ; if ( count ( $ this -> workspaceService -...
Change base workspace of current user workspace
46,638
public function loadTreeAction ( NodeTreeBuilder $ nodeTreeArguments , $ includeRoot = false ) { $ nodeTreeArguments -> setControllerContext ( $ this -> controllerContext ) ; $ this -> view -> assign ( 'value' , $ nodeTreeArguments -> build ( $ includeRoot ) ) ; }
Load the nodetree
46,639
public function getAdditionalNodeMetadataAction ( array $ nodes ) { $ result = [ ] ; foreach ( $ nodes as $ node ) { $ otherNodeVariants = array_values ( array_filter ( array_map ( function ( $ node ) { return $ this -> getCurrentDimensionPresetIdentifiersForNode ( $ node ) ; } , $ node -> getOtherNodeVariants ( ) ) ) ...
Fetches all the node information that can be lazy - loaded
46,640
protected function getCurrentDimensionPresetIdentifiersForNode ( $ node ) { $ targetPresets = $ this -> contentDimensionsPresetSource -> findPresetsByTargetValues ( $ node -> getDimensions ( ) ) ; $ presetCombo = [ ] ; foreach ( $ targetPresets as $ dimensionName => $ presetConfig ) { $ fullPresetConfig = $ this -> con...
Gets an array of current preset identifiers for each dimension of the give node
46,641
public function flowQueryAction ( array $ chain ) { $ createContext = array_shift ( $ chain ) ; $ finisher = array_pop ( $ chain ) ; $ flowQuery = new FlowQuery ( array_map ( function ( $ envelope ) { return $ this -> nodeService -> getNodeFromContextPath ( $ envelope [ '$node' ] ) ; } , $ createContext [ 'payload' ] )...
Build and execute a flow query chain
46,642
public function setNodeType ( $ nodeType ) { if ( is_string ( $ nodeType ) ) { $ nodeType = $ this -> nodeTypeManager -> getNodeType ( $ nodeType ) ; } if ( ! $ nodeType instanceof NodeType ) { throw new \ InvalidArgumentException ( 'nodeType needs to be of type string or NodeType' , 1452100970 ) ; } $ this -> nodeType...
Set the node type
46,643
public function switchToUILocale ( $ reset = false ) { if ( $ reset === true ) { $ this -> i18nService -> getConfiguration ( ) -> setCurrentLocale ( $ this -> rememberedContentLocale ) ; } else { $ this -> rememberedContentLocale = $ this -> i18nService -> getConfiguration ( ) -> getCurrentLocale ( ) ; $ userLocalePref...
For serialization we need to respect the UI locale rather than the content locale
46,644
public function convertFrom ( $ source , $ targetType , array $ subProperties = [ ] , PropertyMappingConfigurationInterface $ configuration = null ) { if ( ! is_array ( $ source ) ) { return new Error ( sprintf ( 'Cannot convert %s to ChangeCollection.' , gettype ( $ source ) ) ) ; } $ changeCollection = new ChangeColl...
Converts a accordingly formatted associative array to a change collection
46,645
protected function convertChangeData ( $ changeData ) { $ type = $ changeData [ 'type' ] ; if ( ! isset ( $ this -> typeMap [ $ type ] ) ) { return new Error ( sprintf ( 'Could not convert change type %s, it is unknown to the system' , $ type ) ) ; } $ changeClass = $ this -> typeMap [ $ type ] ; $ changeClassInstance ...
Convert array to change interface
46,646
public function convert ( NodeType $ nodeType , $ propertyName , $ rawValue , Context $ context ) { $ propertyType = $ nodeType -> getPropertyType ( $ propertyName ) ; switch ( $ propertyType ) { case 'string' : return $ rawValue ; case 'reference' : return $ this -> convertReference ( $ rawValue , $ context ) ; case '...
Convert raw property values to the correct type according to a node type configuration
46,647
protected function convertReferences ( $ rawValue , Context $ context ) { $ nodeIdentifiers = $ rawValue ; $ result = [ ] ; if ( is_array ( $ nodeIdentifiers ) ) { foreach ( $ nodeIdentifiers as $ nodeIdentifier ) { $ referencedNode = $ context -> getNodeByIdentifier ( $ nodeIdentifier ) ; if ( $ referencedNode !== nul...
Convert raw value to references
46,648
protected function convertDateTime ( $ rawValue ) { if ( $ rawValue !== '' ) { $ result = \ DateTime :: createFromFormat ( \ DateTime :: W3C , $ rawValue ) ; $ result -> setTimezone ( new \ DateTimeZone ( date_default_timezone_get ( ) ) ) ; return $ result ; } }
Convert raw value to \ DateTime
46,649
public function getPublishableNodeInfo ( Workspace $ workspace ) { $ publishableNodes = $ this -> publishingService -> getUnpublishedNodes ( $ workspace ) ; $ publishableNodes = array_map ( function ( $ node ) { if ( $ documentNode = $ this -> nodeService -> getClosestDocument ( $ node ) ) { return [ 'contextPath' => $...
Get all publishable node context paths for a workspace
46,650
public function getAllowedTargetWorkspaces ( ) { $ user = $ this -> domainUserService -> getCurrentUser ( ) ; $ workspacesArray = [ ] ; foreach ( $ this -> workspaceRepository -> findAll ( ) as $ workspace ) { if ( $ workspace -> getOwner ( ) !== null && $ workspace -> getOwner ( ) !== $ user ) { continue ; } if ( $ wo...
Get allowed target workspaces for current user
46,651
public function setBaseWorkspace ( Workspace $ workspace ) { $ userWorkspace = $ this -> userService -> getPersonalWorkspace ( ) ; $ userWorkspace -> setBaseWorkspace ( $ workspace ) ; }
Sets base workspace of current user workspace
46,652
public function contentElementAugmentation ( JoinPointInterface $ joinPoint ) { $ node = $ joinPoint -> getMethodArgument ( 'node' ) ; if ( ! $ this -> session -> isStarted ( ) || $ this -> session -> getData ( '__neosLegacyUiEnabled__' ) || $ node -> getContext ( ) -> getWorkspace ( ) -> isPublicWorkspace ( ) ) { retu...
Hooks into standard content element wrapping to render those attributes needed for the package to identify nodes and Fusion paths
46,653
public function editableElementAugmentation ( JoinPointInterface $ joinPoint ) { if ( ! $ this -> session -> isStarted ( ) || $ this -> session -> getData ( '__neosLegacyUiEnabled__' ) ) { return $ joinPoint -> getAdviceChain ( ) -> proceed ( $ joinPoint ) ; } $ property = $ joinPoint -> getMethodArgument ( 'property' ...
Hooks into the editable viewhelper to render those attributes needed for the package s inline editing
46,654
public function isEnabled ( $ modulePath ) { $ modulePathSegments = explode ( '/' , $ modulePath ) ; $ moduleConfiguration = Arrays :: getValueByPath ( $ this -> modules , implode ( '.submodules.' , $ modulePathSegments ) ) ; if ( isset ( $ moduleConfiguration [ 'enabled' ] ) && $ moduleConfiguration [ 'enabled' ] !== ...
Checks whether a module is enabled
46,655
public function isAllowed ( $ modulePath ) { $ modulePathSegments = explode ( '/' , $ modulePath ) ; $ moduleConfiguration = Arrays :: getValueByPath ( $ this -> modules , implode ( '.submodules.' , $ modulePathSegments ) ) ; if ( ! $ this -> privilegeManager -> isGranted ( ModulePrivilege :: class , new ModulePrivileg...
Checks whether the current user has access to a module
46,656
public function apply ( ) { if ( $ this -> canApply ( ) ) { $ subject = $ this -> getSubject ( ) ; $ parent = $ subject -> getParent ( ) ; $ node = $ this -> createNode ( $ parent ) ; $ node -> moveAfter ( $ subject ) ; $ this -> updateWorkspaceInfo ( ) ; } }
Create a new node after the subject
46,657
public function copyNode ( NodeInterface $ node ) { $ this -> nodeContextPath = $ node -> getContextPath ( ) ; $ this -> mode = self :: MODE_COPY ; }
Save copied node to clipboard .
46,658
public function cutNode ( NodeInterface $ node ) { $ this -> nodeContextPath = $ node -> getContextPath ( ) ; $ this -> mode = self :: MODE_MOVE ; }
Save cut node to clipboard .
46,659
public function getSiblingNode ( ) { if ( $ this -> siblingDomAddress === null ) { return null ; } if ( $ this -> cachedSiblingNode === null ) { $ this -> cachedSiblingNode = $ this -> nodeService -> getNodeFromContextPath ( $ this -> siblingDomAddress -> getContextPath ( ) ) ; } return $ this -> cachedSiblingNode ; }
Get the sibling node
46,660
protected function reloadDocument ( $ node = null ) { $ reloadDocument = new ReloadDocument ( ) ; if ( $ node ) { $ reloadDocument -> setNode ( $ node ) ; } $ this -> feedbackCollection -> add ( $ reloadDocument ) ; }
Inform the client to reload the currently - displayed document because the rendering has changed .
46,661
protected function addNodeCreatedFeedback ( $ subject = null ) { $ node = $ subject ? : $ this -> getSubject ( ) ; $ nodeCreated = new NodeCreated ( ) ; $ nodeCreated -> setNode ( $ node ) ; $ this -> feedbackCollection -> add ( $ nodeCreated ) ; }
Inform the client that a node has been created the client decides if and which tree should react to this change .
46,662
protected function getUriInformation ( NodeInterface $ node , ControllerContext $ controllerContext ) : array { $ nodeInfo = [ ] ; if ( ! $ node -> getNodeType ( ) -> isOfType ( $ this -> documentNodeTypeRole ) ) { return $ nodeInfo ; } try { $ nodeInfo [ 'uri' ] = $ this -> createRedirectToNode ( $ controllerContext ,...
Get the uri and previewUri for the given node
46,663
protected function getBasicNodeInformation ( NodeInterface $ node ) : array { return [ 'contextPath' => $ node -> getContextPath ( ) , 'name' => $ node -> getName ( ) , 'identifier' => $ node -> getIdentifier ( ) , 'nodeType' => $ node -> getNodeType ( ) -> getName ( ) , 'label' => $ node -> getLabel ( ) , 'isAutoCreat...
Get the basic information about a node .
46,664
protected function renderChildrenInformation ( NodeInterface $ node , string $ nodeTypeFilterString ) : array { $ documentChildNodes = $ node -> getChildNodes ( $ nodeTypeFilterString ) ; $ contentChildNodes = $ node -> getChildNodes ( $ this -> buildContentChildNodeFilterString ( ) ) ; $ childNodes = array_merge ( $ d...
Get information for all children of the given parent node .
46,665
public function indexAction ( NodeInterface $ node = null ) { $ this -> session -> start ( ) ; $ this -> session -> putData ( '__neosLegacyUiEnabled__' , false ) ; $ user = $ this -> userService -> getBackendUser ( ) ; if ( $ user === null ) { $ this -> redirectToUri ( $ this -> uriBuilder -> uriFor ( 'index' , [ ] , '...
Displays the backend interface
46,666
public function deactivateAction ( NodeInterface $ node = null ) { if ( $ node === null ) { $ node = $ this -> findNodeToEdit ( ) ; } $ this -> session -> start ( ) ; $ this -> session -> putData ( '__neosLegacyUiEnabled__' , true ) ; $ this -> redirect ( 'show' , 'Frontend\Node' , 'Neos.Neos' , [ 'node' => $ node ] ) ...
Deactivates the new UI and redirects back to the old one
46,667
public function apply ( ) { if ( $ this -> canApply ( ) ) { $ subject = $ this -> getSubject ( ) ; $ this -> createNode ( $ subject ) ; $ this -> updateWorkspaceInfo ( ) ; } }
Create a new node beneath the subject
46,668
public function convertFrom ( $ source , $ targetType , array $ convertedChildProperties = [ ] , PropertyMappingConfigurationInterface $ configuration = null ) { $ activationHelper = $ this -> objectManager -> get ( ActivationHelper :: class ) ; $ innerConverter = $ this -> objectManager -> get ( ImageInterfaceArrayPre...
Converts the given source ImageInterface depending on which UI is active .
46,669
public function getClosestDocument ( NodeInterface $ node ) { if ( $ node -> getNodeType ( ) -> isOfType ( 'Neos.Neos:Document' ) ) { return $ node ; } $ flowQuery = new FlowQuery ( [ $ node ] ) ; return $ flowQuery -> closest ( '[instanceof Neos.Neos:Document]' ) -> get ( 0 ) ; }
Helper method to retrieve the closest document for a node
46,670
public function getNodeFromContextPath ( $ contextPath , Site $ site = null , Domain $ domain = null , $ includeAll = false ) { $ nodePathAndContext = NodePaths :: explodeContextPath ( $ contextPath ) ; $ nodePath = $ nodePathAndContext [ 'nodePath' ] ; $ workspaceName = $ nodePathAndContext [ 'workspaceName' ] ; $ dim...
Converts a given context path to a node object
46,671
public function nodeExistsInWorkspace ( NodeInterface $ node , Workspace $ workspace ) { $ context = [ 'workspaceName' => $ workspace -> getName ( ) ] ; $ flowQuery = new FlowQuery ( [ $ node ] ) ; return $ flowQuery -> context ( $ context ) -> count ( ) > 0 ; }
Checks if the given node exists in the given workspace
46,672
public function getByReferenceCallArguments ( $ callNode ) { $ byReferenceArguments = $ callNode -> args ; if ( ! $ this -> calleeReflector -> supports ( $ callNode ) ) { return $ byReferenceArguments ; } $ reflection = $ this -> calleeReflector -> reflect ( $ callNode ) ; $ byReferenceParameterPositions = array_flip (...
Returns arguments passed by reference if reflection for the called function is available . Otherwise returns all the arguments .
46,673
public function canonicalize ( array $ checkedPaths , array $ excludedPaths ) { $ checkedDirectories = array_filter ( $ checkedPaths , function ( $ path ) { return is_dir ( $ path ) ; } ) ; $ canonicalizedPaths = array ( ) ; foreach ( $ excludedPaths as $ path ) { if ( ! $ this -> pathHelper -> isDirectoryRelative ( $ ...
Makes all excluded paths absolute . Non - existent paths are removed .
46,674
public function getSalesInvoiceLines ( ) { if ( array_key_exists ( '__deferred' , $ this -> attributes [ 'SalesInvoiceLines' ] ) ) { $ this -> attributes [ 'SalesInvoiceLines' ] = ( new SalesInvoiceLine ( $ this -> connection ( ) ) ) -> filter ( "InvoiceID eq guid'{$this->InvoiceID}'" ) ; } return $ this -> attributes ...
Updates the SalesInvoiceLines collection on a SalesInvoice if it s been detected as a deferred collection . Fetches results and stores them on this object .
46,675
protected function lazyLoad ( $ key ) { if ( isset ( $ this -> deferred [ $ key ] ) ) { return true ; } try { if ( array_key_exists ( $ key , $ this -> attributes ) && is_array ( $ this -> attributes [ $ key ] ) && array_key_exists ( '__deferred' , $ this -> attributes [ $ key ] ) ) { $ class = preg_replace ( '/(.+?)s?...
Resolve deferred values .
46,676
public function exists ( ) { if ( ! array_key_exists ( $ this -> primaryKey , $ this -> attributes ) ) { return false ; } return ! empty ( $ this -> attributes [ $ this -> primaryKey ] ) ; }
Checks if primaryKey holds a value .
46,677
public function json ( $ options = 0 , $ withDeferred = false ) { $ attributes = $ this -> attributes ; if ( $ withDeferred ) { foreach ( $ this -> deferred as $ attribute => $ collection ) { if ( empty ( $ collection ) ) { continue ; } $ attributes [ $ attribute ] = [ ] ; foreach ( $ collection as $ value ) { if ( ! e...
Return the JSON representation of the data .
46,678
public function findId ( $ code , $ key = 'Code' ) { if ( $ this -> isFillable ( $ key ) ) { $ format = ( $ this -> url ( ) == 'crm/Accounts' && $ key === 'Code' ) ? '%18s' : '%s' ; if ( preg_match ( '/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/' , $ code ) ) { $ format = "guid'$format'" ; } elseif ( is_string ( $ code ) ) { $ fo...
Return the value of the primary key .
46,679
private function parseExceptionForErrorMessages ( Exception $ e ) { if ( ! $ e instanceof BadResponseException ) { throw new ApiException ( $ e -> getMessage ( ) ) ; } $ response = $ e -> getResponse ( ) ; Psr7 \ rewind_body ( $ response ) ; $ responseBody = $ response -> getBody ( ) -> getContents ( ) ; $ decodedRespo...
Parse the reponse in the Exception to return the Exact error messages .
46,680
public function getPurchaseInvoiceLines ( $ statement = '' ) { if ( array_key_exists ( '__deferred' , $ this -> attributes [ 'PurchaseInvoiceLines' ] ) ) { $ this -> attributes [ 'PurchaseInvoiceLines' ] = ( new PurchaseInvoiceLine ( $ this -> connection ( ) ) ) -> filter ( "InvoiceID eq guid'{$this->ID}'" , '' , '' , ...
Updates the PurchaseInvoiceLines collection on a PurchaseInvoice if it s been detected as a deferred collection . Fetches results and stores them on this object .
46,681
public function findStatementForNode ( ? Name $ namespaceName , Name $ node ) : ? Name { $ name = strtolower ( $ node -> getFirst ( ) ) ; $ parentNode = ParentNodeAppender :: findParent ( $ node ) ; if ( $ parentNode instanceof ClassLike && $ node instanceof NamedIdentifier && $ node -> getOriginalNode ( ) === $ parent...
Finds the statements matching the given name .
46,682
public function outputFileCount ( int $ count ) : void { if ( OutputInterface :: VERBOSITY_NORMAL === $ this -> io -> getVerbosity ( ) ) { $ this -> progressBar = $ this -> io -> createProgressBar ( $ count ) ; $ this -> progressBar -> start ( ) ; } elseif ( $ this -> io -> getVerbosity ( ) >= OutputInterface :: VERBOS...
Output file count message if relevant .
46,683
public function outputSuccess ( string $ path ) : void { if ( $ this -> io -> getVerbosity ( ) >= OutputInterface :: VERBOSITY_VERBOSE ) { $ this -> io -> writeln ( sprintf ( ' * [<info>OK</info>] %s' , $ path ) ) ; } $ this -> progressBar -> advance ( ) ; }
Output scoping success message .
46,684
public function scope ( string $ filePath , string $ contents , string $ prefix , array $ patchers , Whitelist $ whitelist ) : string { if ( false === $ this -> isPhpFile ( $ filePath , $ contents ) ) { return $ this -> decoratedScoper -> scope ( ... func_get_args ( ) ) ; } return $ this -> scopePhp ( $ contents , $ pr...
Scopes PHP files .
46,685
private static function lowerConstantName ( string $ name ) : string { $ parts = explode ( '\\' , $ name ) ; $ lastPart = array_pop ( $ parts ) ; $ parts = array_map ( 'strtolower' , $ parts ) ; $ parts [ ] = $ lastPart ; return implode ( '\\' , $ parts ) ; }
Transforms the constant FQ name Acme \ Foo \ X to acme \ foo \ X since the namespace remains case insensitive for constants regardless of whether or not constants actually are case insensitive .
46,686
private function findUseType ( UseUse $ use ) : int { if ( Use_ :: TYPE_UNKNOWN === $ use -> type ) { $ parentNode = ParentNodeAppender :: getParent ( $ use ) ; return $ parentNode -> type ; } return $ use -> type ; }
Finds the type of the use statement .
46,687
public function importProperties ( $ data ) { $ data -> each ( function ( $ value , $ key ) { $ key = camel_case ( $ key ) ; if ( ! property_exists ( $ this , $ key ) ) { $ this -> $ key = $ value ; } } ) ; }
Import all collection items to object properties .
46,688
protected function checkAndStoreTime ( ) { Timer :: start ( ) ; $ result = $ this -> check ( ) ; $ result -> elapsedTime = Timer :: stop ( ) ; return $ result ; }
Check target and store elapsed time .
46,689
protected function makeDir ( $ fileName ) { $ dir = dirname ( $ fileName ) ; if ( ! file_exists ( $ dir ) ) { mkdir ( $ dir , 0775 , true ) ; } }
Create base directory for files .
46,690
public function persist ( $ data = null ) { if ( is_null ( $ data ) ) { $ data = $ this -> database -> toArray ( ) ; } if ( ! is_array ( $ data ) ) { $ data = $ data -> toArray ( ) ; } $ this -> makeDir ( $ this -> getFileName ( ) ) ; file_put_contents ( $ this -> getFileName ( ) , json_encode ( $ data ) ) ; }
Persist to database cache file .
46,691
protected function checkPresence ( ) { $ messages = [ ] ; $ result = collect ( $ this -> getFiles ( ) ) -> map ( function ( $ files , $ type ) use ( & $ messages ) { $ isGood = true ; $ files = collect ( $ files ) ; foreach ( $ files as $ file ) { if ( ! is_null ( $ file ) ) { foreach ( $ this -> getCheckers ( $ type )...
Check file or dir presence .
46,692
public function getCheckers ( $ checker ) { switch ( $ checker ) { case static :: FILE_EXISTS : return [ $ this -> buildFileExistsChecker ( ) ] ; case static :: FILE_DOES_NOT_EXISTS : return [ $ this -> buildFileDoesNotExistsChecker ( ) ] ; case static :: DIRECTORY_EXISTS : return [ $ this -> buildFileExistsChecker ( )...
Get checkers .
46,693
public function check ( ) { $ message = $ this -> checkMinMax ( $ this -> getProcessesRunningCount ( ) ) ; if ( ! empty ( $ message ) ) { return $ this -> makeResult ( false , $ message ) ; } return $ this -> makeHealthyResult ( ) ; }
Check target .
46,694
private function executeUptimeCommand ( ) { $ error = exec ( $ this -> resource -> command , $ system_string , $ output ) ; if ( $ output !== 0 ) { throw new DomainException ( ( string ) $ error ) ; } return ( ! is_array ( $ system_string ) || empty ( $ system_string ) ) ? '' : $ system_string [ 0 ] ; }
Execute command to get an uptime string .
46,695
protected function normalizeMatches ( $ matches ) { return collect ( $ matches ) -> filter ( function ( $ item , $ key ) { return ! is_numeric ( $ key ) ; } ) -> map ( function ( $ item , $ key ) { $ return = $ item [ 0 ] ; if ( starts_with ( $ key , 'load' ) ) { $ return = floatval ( $ return ) ; } elseif ( is_numeric...
Normalize uptime matches .
46,696
protected function uptimeInSeconds ( $ date ) { return ( isset ( $ date [ 'up_days' ] ) ? $ date [ 'up_days' ] * 24 * 60 : 0 ) + ( isset ( $ date [ 'up_hours' ] ) ? $ date [ 'up_hours' ] * 60 : 0 ) + ( isset ( $ date [ 'up_minutes' ] ) ? $ date [ 'up_minutes' ] : 0 ) ; }
Convert uptime to seconds .
46,697
protected function makeMessage ( $ current , $ saved = null ) { $ current = $ this -> toUptimeString ( $ current ) ; $ saved = $ this -> toUptimeString ( $ saved ) ; return sprintf ( $ this -> target -> getErrorMessage ( ) , $ current , $ saved ) ; }
Make uptime message .
46,698
public function toUptimeString ( $ uptime ) { return ( string ) CarbonInterval :: days ( isset ( $ uptime [ 'up_days' ] ) ? $ uptime [ 'up_days' ] : 0 ) -> hours ( isset ( $ uptime [ 'up_hours' ] ) ? $ uptime [ 'up_hours' ] : 0 ) -> minutes ( isset ( $ uptime [ 'up_minutes' ] ) ? $ uptime [ 'up_minutes' ] : 0 ) ; }
Convert uptime to human readable string .
46,699
public function check ( ) { try { $ health = [ ] ; foreach ( $ this -> getResourceUrlArray ( ) as $ url ) { list ( $ healthy , $ message ) = $ this -> checkWebPage ( $ this -> makeUrlWithScheme ( $ url , $ this -> secure ) , $ this -> secure ) ; if ( ! $ healthy ) { return $ this -> makeResult ( $ healthy , $ message )...
HTTP Checker .