idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
50,700 | private function queryFloat ( string $ function , ... $ parameters ) : float { [ $ result ] = $ this -> query ( $ function , $ parameters , false ) ; if ( $ result === null ) { throw GeometryEngineException :: operationYieldedNoResult ( ) ; } return ( float ) $ result ; } | Queries a GIS function returning a floating point value . |
50,701 | private function queryGeometry ( string $ function , ... $ parameters ) : Geometry { [ $ wkt , $ wkb , $ geometryType , $ srid ] = $ this -> query ( $ function , $ parameters , true ) ; $ srid = ( int ) $ srid ; if ( $ wkt !== null ) { if ( $ this -> useProxy ) { $ proxyClassName = $ this -> getProxyClassName ( $ geome... | Queries a GIS function returning a Geometry object . |
50,702 | public static function of ( Point $ point1 , Point ... $ pointN ) : CircularString { return new CircularString ( $ point1 -> coordinateSystem ( ) , $ point1 , ... $ pointN ) ; } | Creates a non - empty CircularString composed of the given points . |
50,703 | public function pointN ( int $ n ) : Point { if ( ! isset ( $ this -> points [ $ n - 1 ] ) ) { throw new NoSuchGeometryException ( 'There is no Point in this CircularString at index ' . $ n ) ; } return $ this -> points [ $ n - 1 ] ; } | Returns the specified Point N in this CircularString . |
50,704 | public static function of ( Geometry $ geometry1 , Geometry ... $ geometryN ) : GeometryCollection { return new static ( $ geometry1 -> coordinateSystem ( ) , $ geometry1 , ... $ geometryN ) ; } | Creates a non - empty GeometryCollection composed of the given geometries . |
50,705 | public function geometryN ( int $ n ) : Geometry { if ( ! isset ( $ this -> geometries [ $ n - 1 ] ) ) { throw new NoSuchGeometryException ( 'There is no Geometry in this GeometryCollection at index ' . $ n ) ; } return $ this -> geometries [ $ n - 1 ] ; } | Returns the specified geometry N in this GeometryCollection . |
50,706 | public function coordinateName ( ) : string { $ name = 'XY' ; if ( $ this -> hasZ ) { $ name .= 'Z' ; } if ( $ this -> hasM ) { $ name .= 'M' ; } return $ name ; } | Returns a name for the coordinates in this system such as XY or XYZ . |
50,707 | public function coordinateDimension ( ) : int { $ coordinateDimension = 2 ; if ( $ this -> hasZ ) { $ coordinateDimension ++ ; } if ( $ this -> hasM ) { $ coordinateDimension ++ ; } return $ coordinateDimension ; } | Returns the coordinate dimension of this coordinate system . |
50,708 | public function withSRID ( int $ srid ) : CoordinateSystem { if ( $ srid === $ this -> srid ) { return $ this ; } $ that = clone $ this ; $ that -> srid = $ srid ; return $ that ; } | Returns a copy of this CoordinateSystem with the SRID altered . |
50,709 | public static function of ( Point $ point1 , Point ... $ pointN ) : LineString { return new LineString ( $ point1 -> coordinateSystem ( ) , $ point1 , ... $ pointN ) ; } | Creates a non - empty LineString composed of the given points . |
50,710 | public static function rectangle ( Point $ a , Point $ b ) : LineString { $ cs = $ a -> coordinateSystem ( ) ; if ( $ cs != $ b -> coordinateSystem ( ) ) { throw CoordinateSystemException :: dimensionalityMix ( $ a , $ b ) ; } if ( $ cs -> coordinateDimension ( ) !== 2 ) { throw new CoordinateSystemException ( __METHOD... | Creates a rectangle out of two 2D corner points . |
50,711 | public function isNextOpenerOrWord ( ) : bool { $ token = current ( $ this -> tokens ) ; if ( $ token === false ) { throw new GeometryIOException ( "Expected '(' or word but encountered end of stream" ) ; } if ( $ token [ 1 ] === '(' ) { return true ; } if ( $ token [ 0 ] === static :: T_WORD ) { return false ; } throw... | Returns whether the next token is an opener or a word . |
50,712 | public function getVersion ( $ uri ) { $ response = $ this -> guzzleclient -> get ( $ uri ) ; $ data = json_decode ( $ response -> getBody ( ) , true ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new RuntimeException ( 'Unable to parse response body into JSON: ' . json_last_error ( ) ) ; } return $ data ; ... | get server version |
50,713 | public function set ( $ key , $ value , $ ttl = null , $ condition = array ( ) ) { $ data = array ( 'value' => $ value ) ; if ( $ ttl ) { $ data [ 'ttl' ] = $ ttl ; } try { $ response = $ this -> guzzleclient -> put ( $ this -> buildKeyUri ( $ key ) , array ( 'query' => $ condition , 'form_params' => $ data ) ) ; } cat... | Set the value of a key |
50,714 | public function mk ( $ key , $ value , $ ttl = 0 ) { $ body = $ request = $ this -> set ( $ key , $ value , $ ttl , array ( 'prevExist' => 'false' ) ) ; if ( isset ( $ body [ 'errorCode' ] ) ) { throw new KeyExistsException ( $ body [ 'message' ] , $ body [ 'errorCode' ] ) ; } return $ body ; } | make a new key with a given value |
50,715 | public function rm ( $ key ) { try { $ response = $ this -> guzzleclient -> delete ( $ this -> buildKeyUri ( $ key ) ) ; } catch ( BadResponseException $ e ) { $ response = $ e -> getResponse ( ) ; } $ body = json_decode ( $ response -> getBody ( ) , true ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new R... | remove a key |
50,716 | private function traversalDir ( RecursiveArrayIterator $ iterator ) { $ key = '' ; while ( $ iterator -> valid ( ) ) { if ( $ iterator -> hasChildren ( ) ) { $ this -> traversalDir ( $ iterator -> getChildren ( ) ) ; } else { if ( $ iterator -> key ( ) == 'key' && ( $ iterator -> current ( ) != '/' ) ) { $ this -> dirs... | Traversal the directory to get the keys . |
50,717 | public function mkdirWithInOrderKey ( $ dir , $ ttl = 0 ) { $ data = array ( 'dir' => 'true' ) ; if ( $ ttl ) { $ data [ 'ttl' ] = $ ttl ; } $ request = $ this -> guzzleclient -> post ( $ this -> buildKeyUri ( $ dir ) , null , $ data ) ; $ response = $ request -> send ( ) ; $ body = $ response -> json ( ) ; return $ bo... | create a new directory with auto generated id |
50,718 | public function setWithInOrderKey ( $ dir , $ value , $ ttl = 0 , $ condition = array ( ) ) { $ data = array ( 'value' => $ value ) ; if ( $ ttl ) { $ data [ 'ttl' ] = $ ttl ; } $ request = $ this -> guzzleclient -> post ( $ this -> buildKeyUri ( $ dir ) , null , $ data , array ( 'query' => $ condition ) ) ; $ response... | create a new key in a directory with auto generated id |
50,719 | public function getJsonContents ( ) { $ default = [ ] ; $ path = $ this -> getJsonPath ( ) ; if ( $ this -> files -> exists ( $ path ) ) { $ contents = $ this -> files -> get ( $ path ) ; return json_decode ( $ contents , true ) ; } else { throw new UnknownFileException ( "The theme must have a valid theme.json manifes... | Get theme JSON content as an array . |
50,720 | protected function setJsonContents ( array $ content ) { $ content = json_encode ( $ content , JSON_PRETTY_PRINT ) ; return $ this -> files -> put ( $ this -> getJsonPath ( ) , $ content ) ; } | Set theme manifest JSON content property value . |
50,721 | public function setProperty ( $ key , $ value ) { $ content = $ this -> getJsonContents ( ) ; if ( count ( $ content ) ) { if ( isset ( $ content [ $ key ] ) ) { unset ( $ content [ $ key ] ) ; } $ content [ $ key ] = $ value ; $ this -> setJsonContents ( $ content ) ; return true ; } return false ; } | Set a theme manifest key value . |
50,722 | public function info ( $ property = null , $ value = null ) { $ info = $ this -> manifest ; $ info -> setThemePath ( $ this -> getThemePath ( ) ) ; if ( $ value && $ property ) { $ info -> setProperty ( $ property , $ value ) ; return $ value ; } else { if ( $ property ) { return $ info -> getProperty ( $ property ) ; ... | Get or set data on manifest . |
50,723 | public function partial ( $ view , $ args = array ( ) ) { $ partialDir = $ this -> getThemeNamespace ( 'partials' ) ; return $ this -> loadPartial ( $ view , $ partialDir , $ args ) ; } | Set up a partial . |
50,724 | public function watchPartial ( $ view , $ args = array ( ) ) { try { return $ this -> partial ( $ view , $ args ) ; } catch ( UnknownPartialFileException $ e ) { return $ this -> loadPartial ( $ view , 'partials' , $ args ) ; } } | Watch and set up a partial from anywhere . |
50,725 | public function partialComposer ( $ view , $ callback , $ layout = null ) { if ( ! is_array ( $ view ) ) { $ view = array ( $ view ) ; } $ path = $ this -> getThemeNamespace ( 'partials' ) ; if ( ! is_null ( $ layout ) ) { $ path = $ path . '.' . $ layout ; } $ view = array_map ( function ( $ v ) use ( $ path ) { retur... | Hook a partial before rendering . |
50,726 | public function registerTheme ( ) { $ this -> app -> singleton ( 'theme' , function ( $ app ) { return new Theme ( $ app [ 'config' ] , $ app [ 'events' ] , $ app [ 'view' ] , $ app [ 'asset' ] , $ app [ 'files' ] , $ app [ 'breadcrumb' ] , $ app [ 'manifest' ] ) ; } ) ; $ this -> app -> alias ( 'theme' , 'Facuz\Theme\... | Register theme provider . |
50,727 | public function url ( $ uri , $ secure = null ) { if ( preg_match ( '#^http|//:#' , $ uri ) ) { return $ uri ; } $ path = $ this -> getCurrentPath ( ) . $ uri ; if ( substr ( $ path , 0 , 6 ) == 'public' ) $ path = substr ( $ path , 7 ) ; return $ this -> configAssetUrl ( $ path , $ secure ) ; } | Return asset path with current theme path . |
50,728 | public function absUrl ( $ uri , $ secure = null ) { $ source = $ this -> url ( $ uri , $ secure ) ; if ( substr ( $ source , 0 , 7 ) == '/public' ) $ source = substr ( $ source , 7 ) ; return url ( $ source ) ; } | Return asset absolute path with current theme path . |
50,729 | protected function _lsb ( $ method ) { $ class = get_class ( $ this ) ; $ args = array_slice ( func_get_args ( ) , 1 ) ; return call_user_func_array ( array ( $ class , $ method ) , $ args ) ; } | Pretend to have late static bindings even in PHP 5 . 2 |
50,730 | public static function convertShippoObjectToArray ( $ values ) { $ results = array ( ) ; foreach ( $ values as $ k => $ v ) { if ( $ k [ 0 ] == '_' ) { continue ; } if ( $ v instanceof Shippo_Object ) { $ results [ $ k ] = $ v -> __toArray ( true ) ; } else if ( is_array ( $ v ) ) { $ results [ $ k ] = self :: convertS... | Recursively converts the PHP Shippo object to an array . |
50,731 | public static function convertToShippoObject ( $ resp , $ apiKey ) { $ types = array ( 'QUOTE' => 'Shippo_Address' ) ; if ( self :: isList ( $ resp ) ) { $ mapped = array ( ) ; foreach ( $ resp as $ i ) array_push ( $ mapped , self :: convertToShippoObject ( $ i , $ apiKey ) ) ; return $ mapped ; } else if ( is_array (... | Converts a response from the Shippo API to the corresponding PHP object . |
50,732 | public function delete ( ) { if ( $ this -> _id ) { try { $ this -> _connection -> delete ( $ this -> url ( ) . '/' . $ this -> _id , [ ] ) ; return true ; } catch ( Exception $ e ) { } } return false ; } | Explicitly delete the cursor |
50,733 | public function getCount ( ) { if ( $ this -> _count !== null ) { return $ this -> _count ; } while ( $ this -> _hasMore ) { $ this -> fetchOutstanding ( ) ; } return $ this -> _length ; } | Get the total number of results in the cursor |
50,734 | public function valid ( ) { if ( $ this -> _position <= $ this -> _length - 1 ) { return true ; } if ( ! $ this -> _hasMore || ! $ this -> _id ) { return false ; } $ this -> fetchOutstanding ( ) ; return ( $ this -> _position <= $ this -> _length - 1 ) ; } | Check if cursor can be advanced further necessary for Iterator |
50,735 | private function addDocumentsFromArray ( array $ data ) { $ _documentClass = $ this -> _documentClass ; $ this -> _result [ ] = $ _documentClass :: createFromArray ( $ data , $ this -> _options ) ; } | Create an array of documents from the input array |
50,736 | private function addPathsFromArray ( array $ data ) { $ _documentClass = $ this -> _documentClass ; $ _edgeClass = $ this -> _edgeClass ; $ entry = [ 'vertices' => [ ] , 'edges' => [ ] , 'source' => $ _documentClass :: createFromArray ( $ data [ 'source' ] , $ this -> _options ) , 'destination' => $ _documentClass :: c... | Create an array of paths from the input array |
50,737 | private function addCommonNeighborsFromArray ( array $ data ) { $ _documentClass = $ this -> _documentClass ; $ left = $ data [ 'left' ] ; $ right = $ data [ 'right' ] ; if ( ! isset ( $ this -> _result [ $ left ] ) ) { $ this -> _result [ $ left ] = [ ] ; } if ( ! isset ( $ this -> _result [ $ left ] [ $ right ] ) ) {... | Create an array of common neighbors from the input array |
50,738 | private function addCommonPropertiesFromArray ( array $ data ) { $ k = array_keys ( $ data ) ; $ k = $ k [ 0 ] ; $ this -> _result [ $ k ] = [ ] ; foreach ( $ data [ $ k ] as $ c ) { $ id = $ c [ '_id' ] ; unset ( $ c [ '_id' ] ) ; $ this -> _result [ $ k ] [ $ id ] = $ c ; } } | Create an array of common properties from the input array |
50,739 | private function addEdgesFromArray ( array $ data ) { $ _edgeClass = $ this -> _edgeClass ; $ this -> _result [ ] = $ _edgeClass :: createFromArray ( $ data , $ this -> _options ) ; } | Create an array of Edges from the input array |
50,740 | private function addVerticesFromArray ( array $ data ) { $ _documentClass = $ this -> _documentClass ; $ this -> _result [ ] = $ _documentClass :: createFromArray ( $ data , $ this -> _options ) ; } | Create an array of Vertex from the input array |
50,741 | private function sanitize ( array $ rows ) { $ _documentClass = $ this -> _documentClass ; if ( isset ( $ this -> _options [ self :: ENTRY_SANITIZE ] ) && $ this -> _options [ self :: ENTRY_SANITIZE ] ) { foreach ( $ rows as $ key => $ value ) { if ( is_array ( $ value ) && isset ( $ value [ $ _documentClass :: ENTRY_I... | Sanitize the result set rows |
50,742 | private function fetchOutstanding ( ) { $ response = $ this -> _connection -> put ( $ this -> url ( ) . '/' . $ this -> _id , '' , [ ] ) ; ++ $ this -> _fetches ; $ data = $ response -> getJson ( ) ; $ this -> _hasMore = ( bool ) $ data [ self :: ENTRY_HASMORE ] ; $ this -> add ( $ data [ self :: ENTRY_RESULT ] ) ; if ... | Fetch outstanding results from the server |
50,743 | private function getStatValue ( $ name ) { if ( isset ( $ this -> _extra [ self :: ENTRY_STATS ] [ $ name ] ) ) { return $ this -> _extra [ self :: ENTRY_STATS ] [ $ name ] ; } return 0 ; } | Get a statistical figure value from the query result |
50,744 | public function findOneByExample ( $ example ) { $ cursor = $ this -> byExample ( $ this -> _collectionName , $ example ) ; if ( $ cursor -> getCount ( ) > 0 ) { $ document = $ cursor -> getAll ( ) [ 0 ] ; $ document -> setIsNew ( false ) ; return $ document ; } return false ; } | Find by Example . |
50,745 | public function findOneById ( $ id ) { try { return $ this -> _documentHandler -> getById ( $ this -> _collectionName , $ id ) ; } catch ( ServerException $ e ) { if ( $ e -> getServerMessage ( ) === 'document not found' ) { return null ; } throw $ e ; } } | Gets one document by given ID |
50,746 | public function removeDocument ( AbstractEntity $ document , $ options = [ ] ) { return $ this -> removeByKeys ( $ this -> _collectionName , [ $ document -> getInternalKey ( ) ] , $ options ) ; } | Removes specified document from collection |
50,747 | public function set ( $ key , $ value ) { if ( $ key === self :: ENTRY_EDGE_DEFINITIONS ) { if ( $ this -> _doValidate ) { ValueValidator :: validate ( $ value ) ; } $ edgeDefinitionBaseObject = new EdgeDefinition ( ) ; foreach ( $ value as $ ed ) { $ edgeDefinition = clone $ edgeDefinitionBaseObject ; foreach ( $ ed [... | Set a graph attribute |
50,748 | public function execute ( ) { $ response = $ this -> _connection -> post ( Urls :: URL_TRANSACTION , $ this -> getConnection ( ) -> json_encode_wrapper ( $ this -> attributes ) ) ; $ responseArray = $ response -> getJson ( ) ; if ( isset ( $ responseArray [ 'result' ] ) ) { return $ responseArray [ 'result' ] ; } retur... | Execute the transaction |
50,749 | public function setCollections ( array $ value ) { if ( array_key_exists ( 'read' , $ value ) ) { $ this -> setReadCollections ( $ value [ 'read' ] ) ; } if ( array_key_exists ( 'write' , $ value ) ) { $ this -> setWriteCollections ( $ value [ 'write' ] ) ; } } | Set the collections array . |
50,750 | public function explain ( ) { $ data = $ this -> buildData ( ) ; $ response = $ this -> _connection -> post ( Urls :: URL_EXPLAIN , $ this -> getConnection ( ) -> json_encode_wrapper ( $ data ) , [ ] ) ; return $ response -> getJson ( ) ; } | Explain the statement s execution plan |
50,751 | public function validate ( ) { $ data = $ this -> buildData ( ) ; $ response = $ this -> _connection -> post ( Urls :: URL_QUERY , $ this -> getConnection ( ) -> json_encode_wrapper ( $ data ) , [ ] ) ; return $ response -> getJson ( ) ; } | Validates the statement |
50,752 | public function setBatchSize ( $ value ) { if ( ! is_int ( $ value ) || ( int ) $ value <= 0 ) { throw new ClientException ( 'Batch size should be a positive integer' ) ; } $ this -> _batchSize = ( int ) $ value ; } | Set the batch size for the statement |
50,753 | private function buildData ( ) { $ data = [ self :: ENTRY_QUERY => $ this -> _query , self :: ENTRY_COUNT => $ this -> _doCount , 'options' => [ self :: FULL_COUNT => $ this -> _fullCount , self :: ENTRY_FAIL_ON_WARNING => $ this -> _failOnWarning ] ] ; if ( $ this -> _stream !== null ) { $ data [ 'options' ] [ self ::... | Build an array of data to be posted to the server when issuing the statement |
50,754 | public function transformToArray ( ) { $ transformedEd = [ ] ; $ transformedEd [ 'collection' ] = $ this -> getRelation ( ) ; $ transformedEd [ 'from' ] = $ this -> getFromCollections ( ) ; $ transformedEd [ 'to' ] = $ this -> getToCollections ( ) ; return $ transformedEd ; } | Transforms an edge definition to an array . |
50,755 | public function disable ( ) { $ url = UrlHelper :: buildUrl ( Urls :: URL_QUERY_CACHE , [ 'properties' ] ) ; $ this -> getConnection ( ) -> put ( $ url , $ this -> json_encode_wrapper ( [ 'mode' => 'off' ] ) ) ; } | Globally turns off the AQL query result cache |
50,756 | public function clear ( ) { $ url = UrlHelper :: buildUrl ( Urls :: URL_QUERY_CACHE , [ ] ) ; $ this -> getConnection ( ) -> delete ( $ url ) ; } | Clears the AQL query result cache for the current database |
50,757 | public function getEntries ( ) { $ url = UrlHelper :: buildUrl ( Urls :: URL_QUERY_CACHE , [ 'entries' ] ) ; $ result = $ this -> getConnection ( ) -> get ( $ url ) ; return $ result -> getJson ( ) ; } | Returns the entries from the query cache in current database |
50,758 | public function setProperties ( array $ properties ) { $ bodyParams = $ properties ; $ url = UrlHelper :: buildUrl ( Urls :: URL_QUERY_CACHE ) ; $ response = $ this -> getConnection ( ) -> put ( $ url , $ this -> json_encode_wrapper ( $ bodyParams ) ) ; return $ response -> getJson ( ) ; } | Adjusts the global AQL query result cache properties |
50,759 | public function getProperties ( ) { $ url = UrlHelper :: buildUrl ( Urls :: URL_QUERY_CACHE ) ; $ response = $ this -> getConnection ( ) -> get ( $ url ) ; return $ response -> getJson ( ) ; } | Returns the AQL query result cache properties |
50,760 | public function create ( View $ view ) { $ params = [ View :: ENTRY_NAME => $ view -> getName ( ) , View :: ENTRY_TYPE => $ view -> getType ( ) , ] ; $ url = Urls :: URL_VIEW ; $ response = $ this -> getConnection ( ) -> post ( $ url , $ this -> json_encode_wrapper ( $ params ) ) ; $ json = $ response -> getJson ( ) ; ... | Create a view |
50,761 | public function rename ( $ view , $ name ) { if ( $ view instanceof View ) { $ view = $ view -> getName ( ) ; } $ params = [ View :: ENTRY_NAME => $ name ] ; $ this -> getConnection ( ) -> put ( UrlHelper :: buildUrl ( Urls :: URL_VIEW , [ $ view , self :: OPTION_RENAME ] ) , $ this -> json_encode_wrapper ( $ params ) ... | Rename a view |
50,762 | public static function createFromArray ( $ values , array $ options = [ ] ) { $ document = new static ( $ options ) ; foreach ( $ values as $ key => $ value ) { $ document -> set ( $ key , $ value ) ; } $ document -> setChanged ( true ) ; return $ document ; } | Factory method to construct a new document using the values passed to populate it |
50,763 | public function filterHiddenAttributes ( $ attributes , array $ _hiddenAttributes = [ ] ) { $ hiddenAttributes = $ _hiddenAttributes !== null ? $ _hiddenAttributes : $ this -> getHiddenAttributes ( ) ; if ( count ( $ hiddenAttributes ) > 0 ) { foreach ( $ hiddenAttributes as $ hiddenAttributeName ) { if ( isset ( $ att... | Returns the attributes with the hidden ones removed |
50,764 | public function get ( $ key ) { if ( isset ( $ this -> _values [ $ key ] ) ) { return $ this -> _values [ $ key ] ; } return null ; } | Get a document attribute |
50,765 | public function getAll ( array $ options = [ ] ) { $ includeInternals = false ; $ ignoreHiddenAttributes = $ this -> { self :: ENTRY_IGNOREHIDDENATTRIBUTES } ; $ _hiddenAttributes = $ this -> { self :: ENTRY_HIDDENATTRIBUTES } ; if ( ! is_array ( $ options ) ) { $ includeInternals = $ options ; } else { $ includeIntern... | Get all document attributes |
50,766 | public function getAllAsObject ( array $ options = [ ] ) { $ result = $ this -> getAll ( $ options ) ; if ( count ( $ result ) === 0 ) { return new \ stdClass ( ) ; } return $ result ; } | Get all document attributes and return an empty object if the documentapped into a DocumentWrapper class |
50,767 | public function setInternalId ( $ id ) { if ( $ this -> _id !== null && $ this -> _id !== $ id ) { throw new ClientException ( 'Should not update the id of an existing document' ) ; } if ( ! preg_match ( '/^[a-zA-Z0-9_-]{1,64}\/[a-zA-Z0-9_:.@\-()+,=;$!*\'%]{1,254}$/' , $ id ) ) { throw new ClientException ( 'Invalid fo... | Set the internal document id |
50,768 | public function setInternalKey ( $ key ) { if ( $ this -> _key !== null && $ this -> _key !== $ key ) { throw new ClientException ( 'Should not update the key of an existing document' ) ; } if ( ! preg_match ( '/^[a-zA-Z0-9_:.@\-()+,=;$!*\'%]{1,254}$/' , $ key ) ) { throw new ClientException ( 'Invalid format for docum... | Set the internal document key |
50,769 | public function saveEdge ( $ collection , $ from , $ to , $ document , array $ options = [ ] ) { $ collection = $ this -> makeCollection ( $ collection ) ; if ( is_array ( $ document ) ) { $ _edgeClass = $ this -> _edgeClass ; $ document = $ _edgeClass :: createFromArray ( $ document ) ; } $ document -> setFrom ( $ fro... | save an edge to an edge - collection |
50,770 | public function edges ( $ collection , $ vertexHandle , $ direction = 'any' , array $ options = [ ] ) { $ collection = $ this -> makeCollection ( $ collection ) ; $ params = [ self :: OPTION_VERTEX => $ vertexHandle , self :: OPTION_DIRECTION => $ direction ] ; $ url = UrlHelper :: appendParamsUrl ( Urls :: URL_EDGES .... | Get connected edges for a given vertex |
50,771 | public function getServerCode ( ) { if ( isset ( $ this -> _details [ self :: ENTRY_CODE ] ) ) { return $ this -> _details [ self :: ENTRY_CODE ] ; } return $ this -> getCode ( ) ; } | Get server error code |
50,772 | public function getServerMessage ( ) { if ( isset ( $ this -> _details [ self :: ENTRY_MESSAGE ] ) ) { return $ this -> _details [ self :: ENTRY_MESSAGE ] ; } return null ; } | Get server error message |
50,773 | public function createGraph ( Graph $ graph ) { $ edgeDefinitions = [ ] ; foreach ( $ graph -> getEdgeDefinitions ( ) as $ ed ) { $ edgeDefinitions [ ] = $ ed -> transformToArray ( ) ; } $ params = [ self :: OPTION_NAME => $ graph -> getKey ( ) , self :: OPTION_EDGE_DEFINITIONS => $ edgeDefinitions , self :: OPTION_ORP... | Create a graph |
50,774 | public function getGraph ( $ graph , array $ options = [ ] ) { $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph ] ) ; try { $ response = $ this -> getConnection ( ) -> get ( $ url ) ; } catch ( Exception $ e ) { return false ; } $ data = $ response -> getJson ( ) ; $ options [ '_isNew' ] = false ; $ result... | Get a graph |
50,775 | public function addOrphanCollection ( $ graph , $ orphanCollection ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph , Urls :: URLPART_VERTEX ] ) ; $ data = [ self :: OPTION_COLLECTION => $ orphanCollection ] ; try { $ response = $ th... | add an orphan collection to the graph . |
50,776 | public function deleteOrphanCollection ( $ graph , $ orphanCollection , $ dropCollection = false ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph , Urls :: URLPART_VERTEX , $ orphanCollection ] ) ; $ data = [ self :: OPTION_DROP_COLL... | deletes an orphan collection from the graph . |
50,777 | public function getVertexCollections ( $ graph , array $ options = [ ] ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ excludeOrphans = false ; $ _useCache = $ this -> cacheEnabled ; if ( ( bool ) $ options && isset ( $ options [ 'excludeOrphans' ] ) && ! is_bool ( $ options [ 'excludeOrphan... | gets all vertex collection from the graph . |
50,778 | public function addEdgeDefinition ( $ graph , $ edgeDefinition ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph , Urls :: URLPART_EDGE ] ) ; $ data = $ edgeDefinition -> transformToArray ( ) ; try { $ response = $ this -> getConnecti... | adds an edge definition to the graph . |
50,779 | public function getEdgeCollections ( $ graph ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ _useCache = $ this -> cacheEnabled ; if ( $ _useCache === true && ! empty ( $ this -> cache [ $ graph ] [ 'edgeCollections' ] ) ) { return $ this -> cache [ $ graph ] [ 'edgeCollections' ] ; } $ url ... | gets all edge collections from the graph . |
50,780 | public function saveVertex ( $ graph , $ document , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } if ( is_array ( $ document ) ) { $ _documentClass = $ this -> _documentClass ; $ document = $ _documentClass :: createFromArray ( $ document ) ; } if ( $ collection === null ... | save a vertex to a graph |
50,781 | public function getVertex ( $ graph , $ vertexId , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ vertexId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ vertexId ) = $ parts ; } if ( $ collection === null )... | Get a single vertex from a graph |
50,782 | public function hasVertex ( $ graph , $ vertexId ) { try { $ this -> getVertex ( $ graph , $ vertexId ) ; return true ; } catch ( ServerException $ e ) { if ( $ e -> getCode ( ) === 404 ) { return false ; } throw $ e ; } } | Check if a vertex exists |
50,783 | public function replaceVertex ( $ graph , $ vertexId , Document $ document , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ vertexId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ vertexId ) = $ parts ; } if... | Replace an existing vertex in a graph identified graph name and vertex id |
50,784 | public function updateVertex ( $ graph , $ vertexId , Document $ document , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ vertexId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ vertexId ) = $ parts ; } if ... | Update an existing vertex in a graph identified by graph name and vertex id |
50,785 | public function saveEdge ( $ graph , $ from , $ to , $ label = null , $ document , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } if ( $ collection === null ) { $ edgeCollections = $ this -> getEdgeCollections ( $ graph ) ; $ edgeCollectionsCount = count ( $ edgeCollection... | save an edge to a graph |
50,786 | public function getEdge ( $ graph , $ edgeId , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ edgeId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ edgeId ) = $ parts ; } if ( $ collection === null ) { $ edg... | Get a single edge from a graph |
50,787 | public function hasEdge ( $ graph , $ edgeId ) { try { $ this -> getEdge ( $ graph , $ edgeId ) ; return true ; } catch ( ServerException $ e ) { if ( $ e -> getCode ( ) === 404 ) { return false ; } throw $ e ; } } | Check if an edge exists |
50,788 | public function replaceEdge ( $ graph , $ edgeId , $ label , Edge $ document , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ edgeId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ edgeId ) = $ parts ; } if (... | Replace an existing edge in a graph identified graph name and edge id |
50,789 | public function updateEdge ( $ graph , $ edgeId , $ label , Edge $ document , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ edgeId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ edgeId ) = $ parts ; } if ( ... | Update an existing edge in a graph identified by graph name and edge id |
50,790 | public function getHeader ( $ name ) { assert ( is_string ( $ name ) ) ; $ name = strtolower ( $ name ) ; if ( isset ( $ this -> _headers [ $ name ] ) ) { return $ this -> _headers [ $ name ] ; } return null ; } | Return an individual HTTP headers of the response |
50,791 | public function getJson ( ) { $ body = $ this -> getBody ( ) ; $ json = json_decode ( $ body , true ) ; if ( ! is_array ( $ json ) ) { if ( $ this -> _wasAsync ) { return [ ] ; } throw new ClientException ( 'Got a malformed result from the server' ) ; } return $ json ; } | Return the data from the JSON - encoded body |
50,792 | public static function createFromArray ( array $ values ) { $ collection = new self ( ) ; foreach ( $ values as $ key => $ value ) { $ collection -> set ( $ key , $ value ) ; } return $ collection ; } | Factory method to construct a new collection |
50,793 | public function getAll ( ) { $ result = [ self :: ENTRY_ID => $ this -> _id , self :: ENTRY_NAME => $ this -> _name , self :: ENTRY_WAIT_SYNC => $ this -> _waitForSync , self :: ENTRY_JOURNAL_SIZE => $ this -> _journalSize , self :: ENTRY_IS_SYSTEM => $ this -> _isSystem , self :: ENTRY_IS_VOLATILE => $ this -> _isVola... | Get all collection attributes |
50,794 | public function set ( $ key , $ value ) { if ( ! is_string ( $ key ) ) { throw new ClientException ( 'Invalid collection attribute type' ) ; } if ( $ key === self :: ENTRY_ID ) { $ this -> setId ( $ value ) ; return ; } if ( $ key === self :: ENTRY_NAME ) { $ this -> setName ( $ value ) ; return ; } if ( $ key === self... | Set a collection attribute |
50,795 | public function setId ( $ id ) { if ( $ this -> _id !== null && $ this -> _id !== $ id ) { throw new ClientException ( 'Should not update the id of an existing collection' ) ; } return $ this -> _id = ( string ) $ id ; } | Set the collection id |
50,796 | public function setName ( $ name ) { assert ( is_string ( $ name ) ) ; if ( $ this -> _name !== null && $ this -> _name !== $ name ) { throw new ClientException ( 'Should not update the name of an existing collection' ) ; } $ this -> _name = ( string ) $ name ; } | Set the collection name |
50,797 | public function setType ( $ type ) { if ( $ type === 'document' ) { $ type = self :: TYPE_DOCUMENT ; } else if ( $ type === 'edge' ) { $ type = self :: TYPE_EDGE ; } if ( $ this -> _type !== null && $ this -> _type !== $ type ) { throw new ClientException ( 'Should not update the type of an existing collection' ) ; } i... | Set the collection type . |
50,798 | public function setStatus ( $ status ) { assert ( is_int ( $ status ) ) ; if ( $ this -> _status !== null && $ this -> _status !== $ status ) { throw new ClientException ( 'Should not update the status of an existing collection' ) ; } if ( ! in_array ( $ status , [ self :: STATUS_NEW_BORN , self :: STATUS_UNLOADED , se... | Set the collection status . |
50,799 | public function setWaitForSync ( $ value ) { assert ( null === $ value || is_bool ( $ value ) ) ; $ this -> _waitForSync = $ value ; } | Set the waitForSync value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.