idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
47,800
public function setErrorURL ( string $ errorURL = null ) : void { if ( ! is_null ( $ errorURL ) && ! filter_var ( $ errorURL , FILTER_VALIDATE_URL ) ) { throw new \ InvalidArgumentException ( 'RoleDescriptor errorURL is not a valid URL.' ) ; } $ this -> errorURL = $ errorURL ; }
Set the value of the errorURL property .
47,801
protected function toXML ( DOMElement $ parent ) : DOMElement { $ e = $ parent -> ownerDocument -> createElementNS ( Constants :: NS_MD , $ this -> elementName ) ; $ parent -> appendChild ( $ e ) ; if ( $ this -> ID !== null ) { $ e -> setAttribute ( 'ID' , $ this -> ID ) ; } if ( $ this -> validUntil !== null ) { $ e ...
Add this RoleDescriptor to an EntityDescriptor .
47,802
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: notEmpty ( $ this -> AffiliateMember ) ; $ e = $ parent -> ownerDocument -> createElementNS ( Constants :: NS_MD , 'md:AffiliationDescriptor' ) ; $ parent -> appendChild ( $ e ) ; $ e -> setAttribute ( 'affiliationOwnerID' , $ this -> affiliationOwn...
Add this AffiliationDescriptor to an EntityDescriptor .
47,803
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: notEmpty ( $ this -> scope ) ; $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Scope :: NS , 'shibmd:Scope' ) ; $ parent -> appendChild ( $ e ) ; $ e -> appendChild ( $ doc -> createTextNode ( $ this -> scope ) ) ; if ( $ this -...
Convert this Scope to XML .
47,804
private static function addSSLValidator ( Message $ msg , $ context ) : void { $ options = stream_context_get_options ( $ context ) ; if ( ! isset ( $ options [ 'ssl' ] [ 'peer_certificate' ] ) ) { return ; } $ container = ContainerSingleton :: getInstance ( ) ; $ key = openssl_pkey_get_public ( $ options [ 'ssl' ] [ '...
Add a signature validator based on a SSL context .
47,805
public static function validateSSL ( string $ data , XMLSecurityKey $ key ) : void { $ container = ContainerSingleton :: getInstance ( ) ; $ keyInfo = openssl_pkey_get_details ( $ key -> key ) ; if ( $ keyInfo === false ) { throw new \ Exception ( 'Unable to get key details from XMLSecurityKey.' ) ; } if ( ! isset ( $ ...
Validate a SOAP message against the certificate on the SSL connection .
47,806
private function getSOAPFault ( DOMDocument $ soapMessage ) : ? string { $ soapFault = Utils :: xpQuery ( $ soapMessage -> firstChild , '/soap-env:Envelope/soap-env:Body/soap-env:Fault' ) ; if ( empty ( $ soapFault ) ) { return null ; } $ soapFaultElement = $ soapFault [ 0 ] ; $ soapFaultString = "Unknown fault string ...
Extracts the SOAP Fault from SOAP message
47,807
public function setAssertion ( Assertion $ assertion , XMLSecurityKey $ key ) : void { $ xml = $ assertion -> toXML ( ) ; Utils :: getContainer ( ) -> debugMessage ( $ xml , 'encrypt' ) ; $ enc = new XMLSecEnc ( ) ; $ enc -> setNode ( $ xml ) ; $ enc -> type = XMLSecEnc :: Element ; switch ( $ key -> type ) { case XMLS...
Set the assertion .
47,808
public function getAssertion ( XMLSecurityKey $ inputKey , array $ blacklist = [ ] ) : Assertion { $ assertionXML = Utils :: decryptElement ( $ this -> encryptedData , $ inputKey , $ blacklist ) ; Utils :: getContainer ( ) -> debugMessage ( $ assertionXML , 'decrypt' ) ; return new Assertion ( $ assertionXML ) ; }
Retrieve the assertion .
47,809
public function toXML ( DOMNode $ parentElement = null ) : DOMElement { if ( $ parentElement === null ) { $ document = DOMDocumentFactory :: create ( ) ; $ parentElement = $ document ; } else { $ document = $ parentElement -> ownerDocument ; } $ root = $ document -> createElementNS ( Constants :: NS_SAML , 'saml:' . 'E...
Convert this encrypted assertion to an XML element .
47,810
public function toXML ( DOMElement $ parent = null ) : DOMElement { if ( $ parent === null ) { $ parent = DOMDocumentFactory :: create ( ) ; $ doc = $ parent ; } else { $ doc = $ parent -> ownerDocument ; } $ element = $ doc -> createElementNS ( Constants :: NS_SAML , $ this -> nodeName ) ; $ parent -> appendChild ( $ ...
Convert this BaseID to XML .
47,811
public function getValidatingCertificates ( ) : array { $ ret = [ ] ; foreach ( $ this -> certificates as $ cert ) { $ pemCert = "-----BEGIN CERTIFICATE-----\n" . chunk_split ( $ cert , 64 ) . "-----END CERTIFICATE-----\n" ; $ key = new XMLSecurityKey ( XMLSecurityKey :: RSA_SHA256 , [ 'type' => 'public' ] ) ; $ key ->...
Retrieve certificates that sign this element .
47,812
protected function signElement ( DOMElement $ root , DOMNode $ insertBefore = null ) : ? DOMElement { if ( $ this -> signatureKey === null ) { return null ; } Utils :: insertSignature ( $ this -> signatureKey , $ this -> certificates , $ root , $ insertBefore ) ; return $ root ; }
Sign the given XML element .
47,813
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( XMLSecurityDSig :: XMLDSIGNS , 'ds:KeyInfo' ) ; $ parent -> appendChild ( $ e ) ; if ( $ this -> Id !== null ) { $ e -> setAttribute ( 'Id' , $ this -> Id ) ; } foreach ( $ this -> info as $...
Convert this KeyInfo to XML .
47,814
public function setNameIdPolicy ( array $ nameIdPolicy ) : void { if ( isset ( $ nameIdPolicy [ 'Format' ] ) && ! is_string ( $ nameIdPolicy [ 'Format' ] ) ) { throw InvalidArgumentException :: invalidType ( 'string' , $ nameIdPolicy [ 'Format' ] ) ; } if ( isset ( $ nameIdPolicy [ 'SPNameQualifier' ] ) && ! is_string ...
Set the NameIDPolicy .
47,815
private function addSubject ( DOMElement $ root ) : void { if ( $ this -> nameId === null && $ this -> encryptedNameId === null ) { return ; } $ subject = $ root -> ownerDocument -> createElementNS ( Constants :: NS_SAML , 'saml:Subject' ) ; $ root -> appendChild ( $ subject ) ; if ( $ this -> encryptedNameId === null ...
Add a Subject - node to the assertion .
47,816
private function addConditions ( DOMElement $ root ) : void { if ( $ this -> audiences !== [ ] ) { $ document = $ root -> ownerDocument ; $ conditions = $ document -> createElementNS ( Constants :: NS_SAML , 'saml:Conditions' ) ; $ root -> appendChild ( $ conditions ) ; $ ar = $ document -> createElementNS ( Constants ...
Add a Conditions - node to the request .
47,817
private function assertMode ( $ stream , $ mode ) : bool { $ meta = stream_get_meta_data ( $ stream ) ; return strpos ( $ meta [ 'mode' ] , $ mode ) !== false ; }
Checks if stream is writable or readable .
47,818
public function connect ( ) : bool { if ( $ this -> isConnected ( ) ) { return true ; } $ this -> socket = $ this -> createSocket ( ) ; try { if ( socket_connect ( $ this -> socket , $ this -> address , $ this -> port ) === false ) { throw new RelayException ( socket_strerror ( socket_last_error ( $ this -> socket ) ) ...
Ensure socket connection . Returns true if socket successfully connected or have already been connected .
47,819
protected function handleBody ( $ body , int $ flags ) { if ( $ flags & Relay :: PAYLOAD_ERROR && $ flags & Relay :: PAYLOAD_RAW ) { throw new Exceptions \ ServiceException ( "error '$body' on '{$this->relay}'" ) ; } if ( $ flags & Relay :: PAYLOAD_RAW ) { return $ body ; } return json_decode ( $ body , true ) ; }
Handle response body .
47,820
protected function getPreviewFilePath ( Swift_Mime_SimpleMessage $ message ) { $ to = str_replace ( [ '@' , '.' ] , [ '_at_' , '_' ] , array_keys ( $ message -> getTo ( ) ) [ 0 ] ) ; $ subject = $ message -> getSubject ( ) ; return $ this -> previewPath . '/' . str_slug ( $ message -> getDate ( ) -> getTimestamp ( ) . ...
Get the path to the email preview file .
47,821
protected function getHTMLPreviewContent ( Swift_Mime_SimpleMessage $ message ) { $ messageInfo = $ this -> getMessageInfo ( $ message ) ; return $ messageInfo . $ message -> getBody ( ) ; }
Get the HTML content for the preview file .
47,822
protected function registerPreviewSwiftMailer ( ) { $ this -> app -> singleton ( 'swift.mailer' , function ( $ app ) { return new Swift_Mailer ( new PreviewTransport ( $ app -> make ( 'Illuminate\Filesystem\Filesystem' ) , $ app [ 'config' ] [ 'mailpreview.path' ] , $ app [ 'config' ] [ 'mailpreview.maximum_lifetime' ]...
Register the Preview Swift Mailer instance .
47,823
private function addLinkToResponse ( $ response , $ previewPath ) { if ( app ( ) -> runningInConsole ( ) ) { return ; } $ content = $ response -> getContent ( ) ; $ linkHTML = "<div id='MailPreviewDriverBox' style=' position:absolute; top:0; z-index:99999; background:#fff; ...
Modify the response to add link to the email preview .
47,824
function onFail ( $ error ) { $ msg = "Curl error ($error[errorCode]). $error[errorMsg], url=" . $ error [ 'info' ] [ 'url' ] ; if ( $ this -> _curl -> onInfo == array ( $ this , 'onInfo' ) ) { $ this -> onInfo ( $ msg . "\n" ) ; } else { echo "\n$msg\n\n" ; } }
Output curl error information
47,825
function htmlEncode ( $ html , $ in = null , $ out = null , $ mode = 'auto' ) { $ valid = array ( 'auto' , 'iconv' , 'mb_convert_encoding' ) ; if ( ! isset ( $ out ) ) { $ out = 'UTF-8' ; } if ( ! in_array ( $ mode , $ valid ) ) { user_error ( 'invalid mode, mode=' . $ mode , E_USER_ERROR ) ; } $ if = function_exists (...
Html encoding transform
47,826
function between ( $ str , $ start , $ end = null , $ greed = true ) { if ( isset ( $ start ) ) { $ pos1 = strpos ( $ str , $ start ) ; } else { $ pos1 = 0 ; } if ( isset ( $ end ) ) { if ( $ greed ) { $ pos2 = strrpos ( $ str , $ end ) ; } else { $ pos2 = strpos ( $ str , $ end , $ pos1 ) ; } } else { $ pos2 = strlen ...
content between start and end
47,827
function formatUrl ( $ url ) { if ( ! $ this -> isUrl ( $ url ) ) { return null ; } $ url = trim ( $ url ) ; $ url = str_replace ( ' ' , '+' , $ url ) ; $ parse = parse_url ( $ url ) ; strtolower ( $ parse [ 'scheme' ] ) ; strtolower ( $ parse [ 'host' ] ) ; return $ this -> buildUrl ( $ parse ) ; }
Clean up and format
47,828
static function error2exception ( ) { set_error_handler ( function ( $ errno , $ errstr , $ errfile , $ errline ) { $ r = error_reporting ( ) ; if ( $ r & $ errno ) { $ exception = new \ ErrorException ( $ errstr , null , $ errno , $ errfile , $ errline ) ; if ( $ errno == E_USER_ERROR || $ errno == E_RECOVERABLE_ERROR...
error to exception
47,829
static function catchException ( $ exception ) { $ str = '' ; if ( $ exception instanceof \ ErrorException ) { $ str .= static :: severity2string ( $ exception -> getSeverity ( ) ) . ': ' ; } $ str .= $ exception -> __toString ( ) ; if ( ini_get ( 'display_errors' ) ) { echo $ str . "\n\n" ; } if ( ini_get ( 'log_error...
deal with exception
47,830
protected function cache ( $ task , $ data = null ) { $ config = array_merge ( $ this -> cache , $ task [ 'cache' ] ) ; if ( ! $ config [ 'enable' ] ) { return null ; } if ( ! isset ( $ config [ 'dir' ] ) ) { user_error ( 'cache dir is not defined' , E_USER_WARNING ) ; return null ; } $ url = $ task [ 'opt' ] [ CURLOPT...
Set or get file cache .
47,831
public function getRealDirection ( $ direction ) { if ( $ direction == 'in' || $ direction == 'out' ) { $ direction = ucfirst ( $ direction ) ; } elseif ( $ direction == 'any' ) { $ direction = 'All' ; } else { throw new UnknownDirectionException ( $ direction ) ; } $ direction = "Direction" . $ direction ; return cons...
Get the direction value from the Neo4j client according to the direction set on the inheriting class
47,832
public function asNode ( Model $ model ) { $ node = $ this -> client -> makeNode ( ) ; if ( $ model -> getKeyName ( ) == 'id' ) { $ node -> setId ( $ model -> getKey ( ) ) ; } else { $ node -> setProperty ( $ model -> getKeyName ( ) , $ model -> getKey ( ) ) ; } return $ node ; }
Convert a model to a Node object .
47,833
public function getEdge ( EloquentModel $ model = null , $ attributes = array ( ) ) { $ model = ( ! is_null ( $ model ) ) ? $ model : $ this -> parent -> { $ this -> relation } ; $ unique = true ; return new EdgeOut ( $ this -> query , $ this -> parent , $ model , $ this -> foreignKey , $ attributes , $ unique ) ; }
Get an instance of the EdgeIn relationship .
47,834
public function firstRelation ( Model $ parentModel , Model $ relatedModel , $ type , $ direction = 'any' ) { $ parent = $ this -> asNode ( $ parentModel ) ; $ related = $ this -> asNode ( $ relatedModel ) ; $ direction = $ this -> getRealDirection ( $ direction ) ; $ path = $ parent -> findPathsTo ( $ related , $ type...
Get the direct relation between two models .
47,835
public function get ( Model $ parent , Model $ related , $ type = [ ] ) { $ relationships = $ this -> getModelRelationsForType ( $ parent , $ type ) ; $ edges = [ ] ; foreach ( $ relationships as $ relationship ) { $ direction = $ this -> directionFromRelation ( $ relationship , $ parent , $ related ) ; $ edges [ ] = $...
Get the edges between two models .
47,836
public function hyperFirst ( $ parent , $ related , $ morph , $ type , $ morphType ) { $ left = $ this -> first ( $ parent , $ related , $ type , 'out' ) ; $ right = $ this -> first ( $ related , $ morph , $ morphType , 'out' ) ; $ edge = new HyperEdge ( $ this -> query , $ parent , $ type , $ related , $ morphType , $...
Get the first HyperEdge between three models .
47,837
public function directionFromRelation ( Relationship $ relation , Model $ parent , Model $ related ) { $ node = $ relation -> getStartNode ( ) ; $ direction = 'in' ; if ( $ node -> getId ( ) === $ parent -> getKey ( ) ) { $ direction = 'out' ; } return $ direction ; }
Get the direction of a relationship out of a Relation instance .
47,838
public function edgeFromRelationWithDirection ( Relationship $ relation , Model $ parent , Model $ related , $ direction ) { if ( $ direction == 'any' ) { $ direction = $ this -> directionFromRelation ( $ relation , $ parent , $ related ) ; } $ class = $ this -> getEdgeClass ( $ direction ) ; $ edge = new $ class ( $ t...
Get the Edge instance out of a Relationship based on a direction .
47,839
public function label ( $ label , Closure $ callback ) { return $ this -> build ( $ this -> createBlueprint ( $ label , $ callback ) ) ; }
Create a new data defintion on label schema .
47,840
public function drop ( $ label ) { $ blueprint = $ this -> createBlueprint ( $ label ) ; $ blueprint -> drop ( ) ; return $ this -> build ( $ blueprint ) ; }
Drop a label from the schema .
47,841
public function dropIfExists ( $ label ) { $ blueprint = $ this -> createBlueprint ( $ label ) ; $ blueprint -> dropIfExists ( ) ; return $ this -> build ( $ blueprint ) ; }
Drop a label from the schema if it exists .
47,842
public function hasLabel ( $ label ) { $ cypher = $ this -> conn -> getSchemaGrammar ( ) -> compileLabelExists ( $ label ) ; return $ this -> getConnection ( ) -> select ( $ cypher , [ ] ) -> count ( ) > 0 ; }
Determine if the given label exists .
47,843
public function hasRelation ( $ relation ) { $ cypher = $ this -> conn -> getSchemaGrammar ( ) -> compileRelationExists ( $ relation ) ; return $ this -> getConnection ( ) -> select ( $ cypher , [ ] ) -> count ( ) > 0 ; }
Determine if the given relation exists .
47,844
public function renameLabel ( $ from , $ to ) { $ blueprint = $ this -> createBlueprint ( $ from ) ; $ blueprint -> renameLabel ( $ to ) ; return $ this -> build ( $ blueprint ) ; }
Rename a label .
47,845
protected function build ( Blueprint $ blueprint ) { return $ blueprint -> build ( $ this -> getConnection ( ) , $ this -> conn -> getSchemaGrammar ( ) ) ; }
Execute the blueprint to modify the label .
47,846
public function createConnection ( ) { $ client = new NeoClient ( $ this -> getHost ( ) , $ this -> getPort ( ) ) ; $ client -> getTransport ( ) -> useHttps ( $ this -> getSsl ( ) ) -> setAuth ( $ this -> getUsername ( ) , $ this -> getPassword ( ) ) ; return $ client ; }
Create a new Neo4j client
47,847
public function statement ( $ query , $ bindings = array ( ) , $ rawResults = false ) { return $ this -> run ( $ query , $ bindings , function ( self $ me , $ query , array $ bindings ) use ( $ rawResults ) { if ( $ me -> pretending ( ) ) return true ; $ statement = $ me -> getCypherQuery ( $ query , $ bindings ) ; $ r...
Execute a Cypher statement and return the boolean result .
47,848
public function getCypherQuery ( $ query , array $ bindings ) { return new CypherQuery ( $ this -> getClient ( ) , $ query , $ this -> prepareBindings ( $ bindings ) ) ; }
Make a query out of a Cypher statement and the bindings values
47,849
public function isBinding ( array $ binding ) { if ( ! empty ( $ binding ) ) { $ keys = array_keys ( $ binding ) ; return ! is_numeric ( reset ( $ keys ) ) ; } return false ; }
A binding should always be in an associative form of a key = > value otherwise we will not be able to consider it a valid binding and replace its values in the query . This function validates whether the binding is valid to be used .
47,850
public function lastInsertedId ( ) { $ query = "MATCH (n) RETURN MAX(id(n)) AS lastIdCreated" ; $ statement = $ this -> getCypherQuery ( $ query , [ ] ) ; $ result = $ statement -> getResultSet ( ) ; return $ result [ 0 ] [ 0 ] ; }
Get the last Id created by Neo4J
47,851
protected function resultsToModels ( $ connection , ResultSet $ results , array $ columns = [ ] ) { $ models = [ ] ; if ( $ results -> valid ( ) ) { $ resultColumns = $ results -> getColumns ( ) ; foreach ( $ results as $ result ) { $ attributes = $ this -> getProperties ( $ resultColumns , $ result , $ columns ) ; if ...
Turn Neo4j result set into the corresponding model
47,852
protected function resultsToModelsWithRelations ( $ connection , ResultSet $ results ) { $ models = [ ] ; if ( $ results -> valid ( ) ) { $ grammar = $ this -> getQuery ( ) -> getGrammar ( ) ; $ columns = $ results -> getColumns ( ) ; foreach ( $ results as $ result ) { $ attributes = $ this -> getProperties ( $ column...
Turn Neo4j result set into the corresponding model with its relations
47,853
public function mutateToOrigin ( $ result , $ attributes ) { $ mutations = [ ] ; foreach ( $ attributes as $ mutation => $ values ) { if ( ! $ this -> resolvableMutation ( $ mutation ) ) continue ; if ( $ this -> isManyMutation ( $ mutation ) ) { return $ this -> mutateManyToOrigin ( $ attributes ) ; } elseif ( $ this ...
Mutate a result back into its original Model .
47,854
public function mutateManyToOrigin ( $ attributes ) { $ mutations = [ ] ; foreach ( $ this -> getMutations ( ) as $ label => $ info ) { $ mutationModel = $ this -> getMutationModel ( $ label ) ; $ model = $ mutationModel -> newFromBuilder ( $ attributes [ $ label ] ) ; $ model -> setConnection ( $ mutationModel -> getC...
In the case of Many mutations we need to return an associative array having both relations as a single record so that when we match them back we know which result belongs to which parent node .
47,855
public function shouldMutate ( array $ attributes ) { $ grammar = $ this -> getQuery ( ) -> getGrammar ( ) ; $ attributes = array_map ( [ $ grammar , 'cropLabelIdentifier' ] , array_keys ( $ attributes ) ) ; $ mutations = array_keys ( $ this -> mutations ) ; $ intersect = array_intersect ( $ attributes , $ mutations ) ...
Determine whether attributes are mutations and should be transformed back . It is considered a mutation only when the attributes keys and mutations keys match .
47,856
public function getRowAttributes ( Row $ row , $ columns , $ resultColumns ) { $ attributes = [ ] ; foreach ( $ resultColumns as $ key => $ column ) { $ attributes [ $ columns [ $ key ] ] = $ row [ $ column ] ; } return $ attributes ; }
Get the attributes of a result Row
47,857
public function matchOut ( $ parent , $ related , $ relatedNode , $ relationship , $ property , $ value = null ) { $ this -> query -> matchRelation ( $ parent , $ related , $ relatedNode , $ relationship , $ property , $ value , 'out' ) ; return $ this ; }
Add an OUTGOING - > relationship MATCH to the query .
47,858
public function matchMorphOut ( $ parent , $ relatedNode , $ property , $ value = null ) { $ this -> query -> matchMorphRelation ( $ parent , $ relatedNode , $ property , $ value ) ; return $ this ; }
Add an outgoing morph relationship to the query a morph relationship usually ignores the end node type since it doesn t know what it would be so we ll only set the start node and hope to get it right when we match it .
47,859
public function isMorphMutation ( $ mutation ) { if ( ! is_array ( $ mutation ) && isset ( $ this -> mutations [ $ mutation ] ) ) { $ mutation = $ this -> getMutation ( $ mutation ) ; } return $ mutation [ 'type' ] === 'morph' || $ mutation [ 'type' ] === 'morphEager' ; }
Determine whether this mutation is of the typ morph .
47,860
public function isRelationship ( array $ columns ) { $ matched = array_filter ( $ columns , function ( $ column ) { if ( preg_match ( '/^([a-zA-Z0-9-_]+\.[a-zA-Z0-9-_]+)|(id\(.*\))$/' , $ column ) ) return false ; return true ; } ) ; return count ( $ matched ) > 1 ? true : false ; }
Determine whether the intended result is a relationship result between nodes we can tell by the format of the requested properties in case the requested properties were in the form of user . name we are pretty sure it is an attribute of a node otherwise if they re plain strings like user and they re more than one then ...
47,861
protected function prepareForCreation ( $ class , $ attributes ) { if ( $ attributes instanceof Model ) { $ instance = $ attributes ; } else { $ instance = new $ class ( $ attributes ) ; } if ( $ instance -> usesTimestamps ( ) ) $ instance -> addTimestamps ( ) ; return $ instance -> toArray ( ) ; }
Prepare model s attributes or instance for creation in a query .
47,862
protected function prefixAndMerge ( Builder $ query , $ prefix ) { $ this -> prefixWheres ( $ query , $ prefix ) ; $ this -> query -> mergeWheres ( $ query -> getQuery ( ) -> wheres , $ query -> getQuery ( ) -> getBindings ( ) ) ; }
Prefix query bindings and wheres with the relation s model Node placeholder .
47,863
protected function prefixWheres ( Builder $ query , $ prefix ) { if ( is_array ( $ query -> getQuery ( ) -> wheres ) ) { $ query -> getQuery ( ) -> wheres = array_map ( function ( $ where ) use ( $ prefix ) { $ column = $ where [ 'column' ] ; $ where [ 'column' ] = ( $ this -> isId ( $ column ) ) ? $ column : $ prefix ...
Prefix where clauses columns .
47,864
public function edge ( Model $ model = null ) { return $ this -> finder -> first ( $ this -> parent , $ model , $ this -> type ) ; }
Get the edge between the parent model and the given model or the related model determined by the relation function name .
47,865
public function initRelation ( ) { switch ( $ this -> direction ) { case 'in' : $ this -> start = $ this -> asNode ( $ this -> related ) ; $ this -> end = $ this -> asNode ( $ this -> parent ) ; $ this -> relation = $ this -> makeRelationship ( $ this -> type , $ this -> relation , $ this -> parent , $ this -> attribut...
Initialize the relationship setting the start node end node and relation type .
47,866
public function newFromRelation ( Relationship $ relation ) { $ instance = new static ( $ this -> query , $ this -> parent , $ this -> related , $ this -> type , $ this -> attributes , $ this -> unique ) ; $ instance -> setRelation ( $ relation ) ; return $ instance ; }
Create a new Relation of the current instance from an existing database relation .
47,867
public function setAttribute ( $ key , $ value ) { if ( in_array ( $ key , $ this -> getDates ( ) ) ) { if ( $ value ) { $ value = $ this -> fromDateTime ( $ value ) ; } } $ this -> attributes [ $ key ] = $ value ; }
Set a given attribute on the relation .
47,868
public function getAttribute ( $ key ) { if ( array_key_exists ( $ key , $ this -> attributes ) ) { $ value = $ this -> attributes [ $ key ] ; if ( in_array ( $ key , $ this -> getDates ( ) ) ) { return $ this -> asDateTime ( $ value ) ; } return $ value ; } }
Get an attribute from the relation .
47,869
public function build ( ConnectionInterface $ connection , IlluminateSchemaGrammar $ grammar ) { foreach ( $ this -> toCypher ( $ connection , $ grammar ) as $ statement ) { $ connection -> statement ( $ statement ) ; } }
Execute the blueprint against the label .
47,870
public function toCypher ( ConnectionInterface $ connection , IlluminateSchemaGrammar $ grammar ) { $ statements = [ ] ; foreach ( $ this -> commands as $ command ) { $ method = 'compile' . ucfirst ( $ command -> name ) ; if ( method_exists ( $ grammar , $ method ) ) { if ( ! is_null ( $ cypher = $ grammar -> $ method ...
Get the raw Cypher statements for the blueprint .
47,871
public function dropUnique ( $ properties ) { $ properties = ( array ) $ properties ; foreach ( $ properties as $ property ) { $ this -> indexCommand ( 'dropUnique' , $ property ) ; } }
Indicate that the given unique constraint on labels properties should be dropped .
47,872
public function dropIndex ( $ properties ) { $ properties = ( array ) $ properties ; foreach ( $ properties as $ property ) { $ this -> indexCommand ( 'dropIndex' , $ property ) ; } }
Indicate that the given index on label s properties should be dropped .
47,873
public function unique ( $ properties ) { $ properties = ( array ) $ properties ; foreach ( $ properties as $ property ) { $ this -> addCommand ( 'unique' , [ 'property' => $ property ] ) ; } }
Specify a unique contraint for label s properties .
47,874
public function index ( $ properties ) { $ properties = ( array ) $ properties ; foreach ( $ properties as $ property ) { $ this -> addCommand ( 'index' , [ 'property' => $ property ] ) ; } }
Specify an index for the label properties .
47,875
public function initRelation ( ) { $ this -> start = $ this -> asNode ( $ this -> parent ) ; $ this -> hyper = $ this -> asNode ( $ this -> related ) ; $ this -> end = $ this -> asNode ( $ this -> morph ) ; $ unique = false ; $ this -> left = new EdgeOut ( $ this -> query , $ this -> parent , $ this -> related , $ this...
Initialize the relationship by setting up nodes and edges
47,876
protected function getBindingsMergedWithValues ( array $ values ) { $ bindings = [ ] ; foreach ( $ values as $ key => $ value ) { $ bindings [ $ key . '_update' ] = $ value ; } return array_merge ( $ this -> getBindings ( ) , $ bindings ) ; }
Bindings should have the keys postfixed with _update as used in the CypherGrammar so that we differentiate them from query bindings avoiding clashing values .
47,877
protected function prepareBindingColumn ( $ column ) { $ count = $ this -> columnCountForWhereClause ( $ column ) ; return ( $ count > 0 ) ? $ column . '_' . ( $ count + 1 ) : $ column ; }
Increment the value of an existing column on a where clause . Used to allow querying on the same attribute with different values .
47,878
protected function columnCountForWhereClause ( $ column ) { if ( is_array ( $ this -> wheres ) ) return count ( array_filter ( $ this -> wheres , function ( $ where ) use ( $ column ) { return $ where [ 'column' ] == $ column ; } ) ) ; }
Get the number of occurrences of a column in where clauses .
47,879
public function whereCarried ( $ column , $ operator = null , $ value = null , $ boolean = 'and' ) { $ type = 'Carried' ; $ this -> wheres [ ] = compact ( 'type' , 'column' , 'operator' , 'value' , 'boolean' ) ; return $ this ; }
Add a WHERE statement with carried identifier to the query .
47,880
public function with ( array $ parts ) { foreach ( $ parts as $ key => $ part ) { $ this -> with [ $ key ] = $ part ; } return $ this ; }
Add a WITH clause to the query .
47,881
public function matchRelation ( $ parent , $ related , $ relatedNode , $ relationship , $ property , $ value = null , $ direction = 'out' ) { $ parentLabels = $ parent -> getTable ( ) ; $ relatedLabels = $ related -> getTable ( ) ; $ parentNode = $ this -> modelAsNode ( $ parentLabels ) ; $ this -> matches [ ] = array ...
Add a relationship MATCH clause to the query .
47,882
public function collect ( $ column ) { $ row = $ this -> aggregate ( __FUNCTION__ , array ( $ column ) ) ; $ collected = [ ] ; foreach ( $ row as $ value ) { $ collected [ ] = $ value ; } return new Collection ( $ collected ) ; }
Get the collected values of the give column .
47,883
protected function formatValue ( $ value ) { if ( $ value instanceof DateTime || $ value instanceof Carbon ) { $ value = $ value -> format ( $ this -> grammar -> getDateFormat ( ) ) ; } return $ value ; }
Fromat the value into its string representation .
47,884
public function compileDrop ( Blueprint $ blueprint , Fluent $ command ) { $ match = $ this -> compileFrom ( $ blueprint ) ; $ label = $ this -> prepareLabels ( array ( $ blueprint ) ) ; return $ match . " REMOVE n" . $ label ; }
Compile a drop table command .
47,885
public function compileRenameLabel ( Blueprint $ blueprint , Fluent $ command ) { $ match = $ this -> compileFrom ( $ blueprint ) ; $ from = $ this -> prepareLabels ( array ( $ blueprint ) ) ; $ to = $ this -> prepareLabels ( array ( $ command -> to ) ) ; return $ match . " REMOVE n$from SET n$to" ; }
Compile a rename label command .
47,886
protected function compileIndexKey ( $ operation , Blueprint $ blueprint , Fluent $ command ) { $ label = $ this -> wrapLabel ( $ blueprint ) ; $ property = $ this -> propertize ( $ command -> property ) ; return "$operation INDEX ON $label($property)" ; }
Compiles index operation .
47,887
public function has ( $ relation , $ operator = '>=' , $ count = 1 , $ boolean = 'and' , \ Closure $ callback = null ) { $ relation = $ this -> getRelationWithoutConstraints ( $ relation ) ; $ query = $ relation -> getRelated ( ) -> newQuery ( ) ; $ this -> getQuery ( ) -> from = $ query -> getModel ( ) -> getTable ( )...
Add a relationship query condition .
47,888
protected function formatMessage ( Neo4jException $ exception ) { $ data = $ exception -> getData ( ) ; $ exceptionName = isset ( $ data [ 'exception' ] ) ? $ data [ 'exception' ] . ': ' : '' ; $ message = isset ( $ data [ 'message' ] ) ? $ data [ 'message' ] : $ exception -> getMessage ( ) ; return $ exceptionName . $...
Format the message that should be printed out for devs .
47,889
protected function prepareEntity ( $ entity , $ identifier = false ) { $ label = ( is_array ( $ entity [ 'label' ] ) ) ? $ this -> prepareLabels ( $ entity [ 'label' ] ) : $ entity [ 'label' ] ; if ( $ identifier ) { if ( $ identifier === true ) $ identifier = $ this -> modelAsNode ( $ entity [ 'label' ] ) ; $ label = ...
Prepare an entity s values to be used in a query performs sanitization and reformatting .
47,890
public function edges ( ) { return $ this -> finder -> get ( $ this -> parent , $ this -> related , $ this -> type ) ; }
Get all the edges of the given type and direction .
47,891
public function updateEdge ( $ id , array $ properties ) { $ edge = $ this -> finder -> first ( $ this -> parent , $ this -> related -> findOrFail ( $ id ) , $ this -> type ) ; $ edge -> fill ( $ properties ) ; return $ edge -> save ( ) ; }
Update an edge s properties .
47,892
protected function formatSyncList ( array $ records ) { $ results = array ( ) ; foreach ( $ records as $ id => $ attributes ) { if ( ! is_array ( $ attributes ) ) { list ( $ id , $ attributes ) = array ( $ attributes , array ( ) ) ; } $ results [ $ id ] = $ attributes ; } return $ results ; }
Format the sync list so that it is keyed by ID .
47,893
public function modelsFromIds ( $ ids ) { return $ this -> related -> whereIn ( $ this -> related -> getKeyName ( ) , ( array ) $ ids ) -> get ( ) ; }
Get the related models out of their Ids .
47,894
public function isArrayOfModels ( $ models ) { if ( ! is_array ( $ models ) ) return false ; $ notModels = array_filter ( $ models , function ( $ model ) { return ! $ model instanceof Model ; } ) ; return empty ( $ notModels ) ; }
Determine whether the given array of models is actually an array containing model instances . In case at least one of the elements is not a Model this will return false .
47,895
public function compileSelect ( Builder $ query ) { if ( is_null ( $ query -> columns ) ) $ query -> columns = array ( '*' ) ; return trim ( $ this -> concatenate ( $ this -> compileComponents ( $ query ) ) ) ; }
Get the Cypher representation of the query .
47,896
protected function compileComponent ( Builder $ query , $ components , $ component ) { $ cypher = '' ; if ( ! in_array ( $ component , $ components ) ) { throw new InvalidCypherGrammarComponentException ( $ component ) ; } if ( ! is_null ( $ query -> $ component ) ) { $ method = 'compile' . ucfirst ( $ component ) ; $ ...
Compile a single component .
47,897
public function compileMatches ( Builder $ query , $ matches ) { if ( ! is_array ( $ matches ) || empty ( $ matches ) ) return '' ; $ prepared = array ( ) ; foreach ( $ matches as $ match ) { $ method = 'prepareMatch' . ucfirst ( $ match [ 'type' ] ) ; $ prepared [ ] = $ this -> $ method ( $ match ) ; } return "MATCH "...
Compile the MATCH for a query with relationships .
47,898
protected function whereBasic ( Builder $ query , $ where ) { $ value = $ this -> parameter ( $ where ) ; return $ this -> wrap ( $ where [ 'column' ] ) . ' ' . $ where [ 'operator' ] . ' ' . $ value ; }
Compile a basic where clause .
47,899
protected function whereIn ( Builder $ query , $ where ) { $ values = $ this -> valufy ( $ where [ 'values' ] ) ; return $ this -> wrap ( $ where [ 'column' ] ) . ' IN [' . $ values . ']' ; }
Compile a where in clause .