idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
18,500 | protected function getDocumentLocation ( $ database , $ rid = null , $ fetchPlan = null ) { $ this -> ensureDatabase ( $ database ) ; $ arguments = array ( $ rid ) ; if ( $ fetchPlan ) { $ arguments [ ] = $ fetchPlan ; } return $ this -> getLocation ( 'document' , $ database , $ arguments ) ; } | Returns the URL to fetch a document . |
18,501 | protected function getClusterLocation ( $ database , $ cluster , $ limit = null ) { $ this -> ensureDatabase ( $ database ) ; return $ this -> getLocation ( 'cluster' , $ database , array ( $ cluster , $ limit ) ) ; } | Returns the URL to fetch a cluster . |
18,502 | public function toKeyValue ( array $ values ) { $ result = [ ] ; foreach ( $ values as $ key => $ value ) { if ( is_array ( $ value ) ) { $ result [ $ key ] = $ this -> toKeyValue ( $ value ) ; } elseif ( is_object ( $ value ) ) { $ result [ $ key ] = $ this -> toKeyValue ( ( array ) $ value ) ; } else { $ result [ $ k... | Transform the given array of values into a key - value pair recursively . |
18,503 | public function getLink ( $ providerName , $ url , array $ options = array ( ) ) { $ this -> checkProvider ( $ providerName ) ; return $ this -> providers [ $ providerName ] [ 'provider' ] -> getLink ( $ url , $ options ) ; } | Gets the sharing links for the given provider and url . |
18,504 | public function getShares ( $ providerName , $ url , $ delayUpdate = false ) { $ this -> checkProvider ( $ providerName ) ; $ id = $ this -> getId ( $ providerName , $ url ) ; $ lifeTime = $ this -> providers [ $ providerName ] [ 'lifeTime' ] ; $ now = new \ DateTime ( ) ; $ dataFromCache = $ this -> cache -> fetch ( $... | Gets the number of share of the given URL on the given provider . |
18,505 | public function getSharesTotal ( $ url ) { $ shares = 0 ; foreach ( $ this -> providers as $ providerName => $ provider ) { $ shares += $ this -> getShares ( $ providerName , $ url ) ; } return $ shares ; } | Gets the total number of share of the given URL for all providers . |
18,506 | public function update ( ) { $ now = new \ DateTime ( ) ; foreach ( $ this -> toUpdate as $ providerName => $ urls ) { foreach ( $ urls as $ url ) { $ shares = $ this -> providers [ $ providerName ] [ 'provider' ] -> getShares ( $ url ) ; $ this -> cache -> save ( $ this -> getId ( $ providerName , $ url ) , array ( $ ... | Updates delayed URLs . |
18,507 | public function start ( $ debug = false , $ startLoop = true ) { if ( ! $ debug ) { Logger :: set ( new NullLogger ( ) ) ; } parent :: start ( $ startLoop ) ; } | Start the transport . |
18,508 | public function call ( $ procedure , $ arguments = null , $ argumentsKw = null , $ options = null ) { return $ this -> getSession ( ) -> call ( $ this -> prepareTopic ( $ procedure ) , $ arguments , $ argumentsKw , $ options ) ; } | Call a registered procedure . |
18,509 | public function subscribe ( $ topic , $ callback , $ options = null , $ isFunction = false ) { return $ this -> getSession ( ) -> subscribe ( $ this -> prepareTopic ( $ topic ) , $ this -> wrapWithProxy ( $ callback , $ isFunction ) , $ options ) ; } | Subscribe to a topic and specify a callback for it . |
18,510 | public function register ( $ topic , $ callback , $ options = null , $ isFunction = false ) { return $ this -> getCallee ( ) -> register ( $ this -> getSession ( ) , $ this -> prepareTopic ( $ topic ) , $ this -> wrapWithProxy ( $ callback , $ isFunction ) , $ options ) ; } | Register a RPC . |
18,511 | public function hasMeta ( $ key ) { $ meta = $ this -> meta ( ) -> where ( 'key' , $ key ) -> get ( ) ; return ( bool ) count ( $ meta ) ; } | Has meta . |
18,512 | public function getMeta ( $ key , $ default = null ) { $ meta = $ this -> meta ( ) -> where ( 'key' , $ key ) -> get ( ) ; if ( $ meta -> count ( ) <= 1 ) { return $ meta -> count ( ) == 1 ? $ meta -> first ( ) : $ default ; } return $ meta ; } | Get meta . |
18,513 | public function updateMeta ( $ key , $ value ) { if ( $ meta = $ this -> getMeta ( $ key ) ) { $ meta -> value = $ value ; return $ meta -> save ( ) ; } return false ; } | Update meta . |
18,514 | public function addOrUpdateMeta ( $ key , $ value ) { return $ this -> hasMeta ( $ key ) ? $ this -> updateMeta ( $ key , $ value ) : $ this -> addMeta ( $ key , $ value ) ; } | Add or update meta if it already exists . |
18,515 | public function deleteMeta ( $ key , $ value = null ) { return $ value ? $ this -> meta ( ) -> where ( 'key' , $ key ) -> where ( 'value' , $ value ) -> delete ( ) : $ this -> meta ( ) -> where ( 'key' , $ key ) -> delete ( ) ; } | Delete meta . |
18,516 | protected function setClient ( HttpClient $ client = null ) { if ( $ client instanceof HttpClient ) { $ this -> client = $ client ; } else { $ this -> client = new HttpClient ( [ 'headers' => [ 'Authorization' => "Bearer {$this->accessToken}" , ] , ] ) ; } } | Set Http Client . |
18,517 | public function performApiRequest ( $ endpoint , $ payload ) { $ this -> setupRequest ( $ payload ) ; $ this -> apiEndpoint = $ endpoint ; return $ this -> doDropboxApiRequest ( ) ; } | Perform Dropbox API v2 request . |
18,518 | public function performContentApiRequest ( $ endpoint , $ payload ) { $ this -> setupRequest ( $ payload ) ; $ this -> apiEndpoint = $ endpoint ; return $ this -> doDropboxApiContentRequest ( ) ; } | Perform Dropbox API v2 content request . |
18,519 | protected function setupDropboxHeaders ( ) { $ headers = [ 'Dropbox-API-Arg' => json_encode ( $ this -> request ) , ] ; if ( ! empty ( $ this -> content ) || $ this -> apiEndpoint == 'files/upload_session/finish' ) { $ headers [ 'Content-Type' ] = 'application/octet-stream' ; } return $ headers ; } | Setup headers for Dropbox API request . |
18,520 | protected function determineException ( HttpClientException $ exception ) { if ( ! empty ( $ exception -> getResponse ( ) ) && in_array ( $ exception -> getResponse ( ) -> getStatusCode ( ) , [ 400 , 409 ] ) ) { return new BadRequest ( $ exception -> getResponse ( ) ) ; } return $ exception ; } | Catch Dropbox API request exception . |
18,521 | public function register ( $ provider ) { if ( is_string ( $ provider ) && ! is_a ( $ provider , '\Vinelab\Minion\Provider' , true ) ) { throw new InvalidProviderException ( sprintf ( 'Provider %s must be an instance of \Vinelab\Minion\Provider' , $ provider ) ) ; } if ( ! in_array ( $ provider , $ this -> providers ) ... | Register the given provider . |
18,522 | public function run ( $ options = [ ] , LoopInterface $ loop = null ) { $ this -> mergeConfig ( $ options ) ; echo $ this -> gimmeASCII ( ) . "\n" ; $ client = $ this -> newClient ( $ loop ) ; $ client -> addTransportProvider ( $ this -> newTransportProvider ( ) ) ; return $ client -> start ( $ this -> getConfig ( 'deb... | Run the server . |
18,523 | public function newClient ( LoopInterface $ loop = null ) { return new Client ( $ this -> getConfig ( 'realm' ) , $ this -> getRegisteredProviders ( ) , $ loop ) ; } | Get a new Client instance . |
18,524 | public function transportUrl ( ) { $ proto = $ this -> getConfig ( 'tls' ) ? 'wss' : 'ws' ; $ port = intval ( $ this -> getConfig ( 'port' ) ) ; if ( $ port > 0 ) { $ port = ':' . $ port ; } else { $ port = '' ; } return $ proto . '://' . $ this -> getConfig ( 'host' ) . $ port . $ this -> getConfig ( 'path' ) ; } | Get the transport URL that provider should connect to . |
18,525 | public function addProduct ( $ dealId , array $ data ) { if ( ! isset ( $ data [ 'product_id' ] ) ) { throw new PipedriveMissingFieldError ( 'You must include a "pdoruct_id" field when adding a product to a deal' ) ; } if ( ! isset ( $ data [ 'item_price' ] ) ) { throw new PipedriveMissingFieldError ( 'You must include... | Adds a product to a deal |
18,526 | public function setQueue ( $ queue ) { $ this -> queue = $ queue ; if ( $ this -> mailer ) { $ this -> mailer -> setQueue ( $ queue ) ; } return $ this ; } | Assigns Queue manager instance |
18,527 | public function inMode ( $ mode ) { if ( ! is_array ( $ mode ) ) { $ mode = func_get_args ( ) ; } return in_array ( $ this -> reset_mode , $ mode ) ; } | Checks auto reset mode |
18,528 | protected function getSwiftMailerTransport ( ) { if ( ! $ mailer = $ this -> mailer ) { return null ; } if ( ! $ swift_mailer = $ mailer -> getSwiftMailer ( ) ) { return null ; } if ( ! is_a ( $ swift_mailer , '\Swift_Mailer' ) ) { return null ; } return $ swift_mailer -> getTransport ( ) ; } | Get the Swift Mailer Transport instance . |
18,529 | protected function resetSwiftTransport ( ) { if ( ! $ transport = $ this -> queryTransport ( ) ) { return ; } if ( ! $ transport -> isStarted ( ) ) { $ transport -> start ( ) ; return ; } try { $ transport -> reset ( ) ; } catch ( Exception $ e ) { $ this -> stopSwiftTransport ( ) ; $ transport -> start ( ) ; } } | Reset Swift Mailer SMTP transport adapter |
18,530 | protected function stopSwiftTransport ( ) { if ( ! $ transport = $ this -> queryTransport ( ) ) { return ; } if ( ! $ transport -> isStarted ( ) ) { return ; } try { $ transport -> stop ( ) ; } catch ( Exception $ e ) { $ reflection = new \ ReflectionClass ( $ transport ) ; $ prop = $ reflection -> getProperty ( '_star... | Stop Swift Mailer SMTP transport adapter |
18,531 | protected function queryTransport ( ) { if ( $ this -> mailer && method_exists ( $ this -> mailer , 'isPretending' ) && $ this -> mailer -> isPretending ( ) ) { return null ; } $ transport = $ this -> getSwiftMailerTransport ( ) ; if ( ! $ transport || ! is_a ( $ transport , '\Swift_Transport_AbstractSmtpTransport' ) )... | Query correct transport object |
18,532 | protected function getQueuedCallable ( array $ data ) { if ( Str :: contains ( $ data [ 'callback' ] , 'SerializableClosure' ) ) { if ( class_exists ( '\SuperClosure\Serializer' ) ) { return ( new \ SuperClosure \ Serializer ) -> unserialize ( $ data [ 'callback' ] ) ; } else { return with ( unserialize ( $ data [ 'cal... | Get the true callable for a queued e - mail message . |
18,533 | protected function exec ( ) { $ response = curl_exec ( $ this -> curl ) ; $ info = curl_getinfo ( $ this -> curl ) ; if ( curl_error ( $ this -> curl ) ) { throw new PipedriveHttpError ( 'API call failed: ' . curl_error ( $ this -> curl ) ) ; } $ result = json_decode ( $ response , true ) ; if ( floor ( $ info [ 'http_... | Execute current cURL session |
18,534 | protected function createEndPoint ( $ method , $ data = array ( ) ) { $ data [ 'api_token' ] = $ this -> apiKey ; $ endPoint = $ this -> url . '/' . $ method . '?' . http_build_query ( $ data ) ; $ this -> setOpt ( CURLOPT_URL , $ endPoint ) ; return $ this ; } | takes the pipedrive method and turns it into the correct URL endpoint by adding the method and API key |
18,535 | public function add ( array $ data ) { if ( ! isset ( $ data [ 'subject' ] ) or ! isset ( $ data [ 'type' ] ) ) { throw new PipedriveMissingFieldError ( 'You must include both a "subject" and "type" field when inserting a note' ) ; } return $ this -> curl -> post ( 'activities' , $ data ) ; } | Adds a activity |
18,536 | public function getMessages ( $ key = null ) { if ( null !== $ key ) { return $ this -> flash -> getMessage ( $ key ) ; } return $ this -> flash -> getMessages ( ) ; } | Returns Flash messages ; If key is provided then returns messages for that key . |
18,537 | public function add ( array $ data ) { if ( ! isset ( $ data [ 'content' ] ) ) { throw new PipedriveMissingFieldError ( 'You must include a "content" field when inserting a note' ) ; } if ( ! isset ( $ data [ 'deal_id' ] ) && ! isset ( $ data [ 'person_id' ] ) && ! isset ( $ data [ 'org_id' ] ) ) { throw new PipedriveM... | Adds a note |
18,538 | final public static function create ( array $ params , $ adapter = null ) { $ adapter = isset ( $ params [ '_adapter' ] ) ? $ params [ '_adapter' ] : $ adapter ; $ adapter = strtolower ( $ adapter ) ; $ classname = __NAMESPACE__ . '\\Adapters\\' . ucfirst ( $ adapter ) ; if ( ! class_exists ( $ classname , true ) ) { t... | Creates an instance for database access |
18,539 | final public static function getAvailableAdapters ( ) { if ( ! self :: $ availableAdapters ) { $ adapters = array ( ) ; foreach ( glob ( __DIR__ . '/Adapters/*.php' ) as $ filename ) { if ( preg_match ( '~([a-z0-9]*)\.php$~si' , $ filename , $ matches ) ) { $ adapters [ ] = strtolower ( $ matches [ 1 ] ) ; } } self :: ... | Returns the list of available adapters |
18,540 | final public function query ( $ pattern , $ data = null , $ fetch = null , $ prefix = null ) { $ query = $ this -> makeQuery ( $ pattern , $ data , $ prefix ) ; return $ this -> plainQuery ( $ query , $ fetch ) ; } | Performs a query on the database |
18,541 | final public function preQuery ( $ pattern , $ data = null ) { $ this -> preQueries [ ] = array ( $ pattern , $ data ) ; if ( $ this -> connected ) { $ this -> execPre ( ) ; } } | Saves a pre - query |
18,542 | final public function plainQuery ( $ query , $ fetch = null ) { $ this -> forcedConnect ( ) ; $ implementation = $ this -> connector -> getImplementation ( ) ; $ connection = $ this -> connector -> getConnection ( ) ; $ duration = microtime ( true ) ; $ cursor = $ implementation -> query ( $ connection , $ query ) ; $ ... | Performs a plain query |
18,543 | final public function setDebug ( $ callback = true ) { if ( $ callback === true ) { if ( php_sapi_name ( ) === 'cli' ) { $ callback = new DebuggerOutConsole ( ) ; } else { $ callback = new DebuggerOutHtml ( ) ; } } $ this -> debugCallback = $ callback ; } | Sets a handler for the debug info |
18,544 | public function makeQuery ( $ pattern , $ data , $ prefix = null ) { Compat :: setCurrentOpts ( $ this -> paramsSys [ 'compat' ] ) ; $ this -> forcedConnect ( ) ; if ( $ prefix === null ) { $ prefix = $ this -> prefix ; } $ templater = $ this -> createTemplater ( $ pattern , $ data , $ prefix ) ; $ templater -> parse (... | Creates a query by a pattern and an incoming data |
18,545 | public function getTable ( $ tableName , array $ map = null ) { if ( ( $ map === null ) && ( is_string ( $ tableName ) ) ) { if ( isset ( $ this -> cacheTables [ $ tableName ] ) ) { $ table = $ this -> cacheTables [ $ tableName ] ; } else { $ table = new Table ( $ this , $ tableName ) ; $ this -> cacheTables [ $ tableN... | Returns an object for a table access |
18,546 | protected function createTemplater ( $ pattern , $ data , $ prefix ) { return ( new Templater ( $ this -> connector , $ pattern , $ data , $ prefix ) ) ; } | Creates a templating for a query |
18,547 | protected function separateParams ( $ params ) { $ this -> paramsDB = array ( ) ; $ this -> paramsSys = Config :: get ( 'configsys' ) ; foreach ( $ params as $ name => $ value ) { if ( substr ( $ name , 0 , 1 ) === '_' ) { $ name = substr ( $ name , 1 ) ; if ( ! array_key_exists ( $ name , $ this -> paramsSys ) ) { thr... | Analysis parameters and separates its to system and adapter - depending |
18,548 | protected function debugLog ( $ query , $ duration , $ info ) { if ( $ this -> debugCallback ) { call_user_func ( $ this -> debugCallback , $ query , $ duration , $ info ) ; } } | Sends a debug info to the handler |
18,549 | protected function execPre ( ) { foreach ( $ this -> preQueries as $ pq ) { if ( is_array ( $ pq ) ) { $ pattern = $ pq [ 0 ] ; $ data = isset ( $ pq [ 1 ] ) ? $ pq [ 1 ] : null ; } else { $ pattern = $ pq ; $ data = null ; } $ this -> query ( $ pattern , $ data ) ; } $ this -> preQueries = array ( ) ; } | Executes all pre - queries |
18,550 | public function onPreFileDownload ( PreFileDownloadEvent $ event ) { $ protocol = parse_url ( $ event -> getProcessedUrl ( ) , PHP_URL_SCHEME ) ; if ( $ protocol === 's3' ) { $ s3RemoteFilesystem = new S3RemoteFilesystem ( $ this -> io , $ this -> composer -> getConfig ( ) , $ event -> getRemoteFilesystem ( ) -> getOpt... | Replace remote file system on S3 protocol download |
18,551 | public static function register ( ) { if ( ! self :: $ autoloader ) { self :: $ autoloader = new self ( __NAMESPACE__ , __DIR__ ) ; spl_autoload_register ( self :: $ autoloader ) ; } } | Registers an autoloader for the library |
18,552 | public static function get ( $ name ) { if ( ! isset ( self :: $ config [ $ name ] ) ) { $ filename = __DIR__ . '/../_config/' . $ name . '.php' ; if ( ! file_exists ( $ filename ) ) { throw new \ RuntimeException ( 'Error go\\DB config "' . $ name . '"' ) ; } self :: $ config [ $ name ] = include $ filename ; } return... | Returns a specified configuration |
18,553 | public function query ( $ query ) { $ this -> errorInfo = null ; $ this -> errorCode = null ; $ query = trim ( strtolower ( $ query ) ) ; if ( $ query === 'show tables' ) { $ data = array ( ) ; foreach ( $ this -> tables as $ k => $ table ) { $ data [ ] = array ( 'name' => $ k ) ; } return new Cursor ( $ data ) ; } $ t... | Performs a query |
18,554 | protected function bindUserModel ( ) { $ this -> app -> bind ( CanBeOwnerContract :: class , function ( ApplicationContract $ app ) { $ config = $ app -> make ( 'config' ) ; return $ config -> get ( 'auth.providers.users.model' , $ config -> get ( 'auth.model' ) ) ; } ) ; } | Bind User model from config to Owner contract . |
18,555 | public function withDefaultOwner ( CanBeOwnerContract $ owner = null ) { $ this -> defaultOwner = $ owner ? : $ this -> resolveDefaultOwner ( ) ; if ( isset ( $ this -> withDefaultOwnerOnCreate ) ) { $ this -> withDefaultOwnerOnCreate = false ; } return $ this ; } | Set owner as default for entity . |
18,556 | public function withoutDefaultOwner ( ) { $ this -> defaultOwner = null ; if ( isset ( $ this -> withDefaultOwnerOnCreate ) ) { $ this -> withDefaultOwnerOnCreate = false ; } return $ this ; } | Remove default owner for entity . |
18,557 | public function isOwnedByDefaultOwner ( ) { $ owner = $ this -> resolveDefaultOwner ( ) ; if ( ! $ owner ) { throw InvalidDefaultOwner :: isNull ( $ this ) ; } return $ this -> isOwnedBy ( $ owner ) ; } | Determine if model owned by owner resolved as default . |
18,558 | public function changeOwnerTo ( CanBeOwnerContract $ owner ) { $ allowedOwnerType = $ this -> getOwnerModel ( ) ; if ( ! $ owner instanceof $ allowedOwnerType ) { throw InvalidOwnerType :: notAllowed ( $ this , $ owner ) ; } return $ this -> ownedBy ( ) -> associate ( $ owner ) ; } | Changes owner of the model . |
18,559 | public static function setInstance ( $ instance ) { if ( $ instance instanceof self ) { self :: $ instance = $ instance ; } elseif ( is_array ( $ instance ) ) { self :: $ instance = new self ( $ instance ) ; } else { $ message = 'Argument 1 passed to Storage::setInstance must be ' . 'an instance of go\DB\DB or array, '... | Sets a storage instance as main |
18,560 | public static function query ( $ pattern , $ data = null , $ fetch = null , $ prefix = null ) { return self :: getInstance ( ) -> __invoke ( $ pattern , $ data , $ fetch , $ prefix ) ; } | A query to the main database of the main storage |
18,561 | public function get ( $ name = null ) { if ( $ name === null ) { $ name = $ this -> mainname ; } if ( ! isset ( $ this -> dbs [ $ name ] ) ) { throw new Exceptions \ StorageNotFound ( $ name ) ; } return $ this -> dbs [ $ name ] ; } | Returns a database instance by its name |
18,562 | public function create ( array $ params , $ name = null ) { if ( $ name === null ) { $ name = $ this -> mainname ; } $ db = DB :: create ( $ params ) ; $ this -> set ( $ db , $ name ) ; return $ db ; } | Creates a database instance and saves it in the storage |
18,563 | public function set ( DB $ db , $ name = null ) { if ( $ name === null ) { $ name = $ this -> mainname ; } if ( isset ( $ this -> dbs [ $ name ] ) ) { throw new StorageEngaged ( $ name ) ; } $ this -> dbs [ $ name ] = $ db ; } | Saves a database in the storage |
18,564 | public function fill ( array $ mparams ) { $ assocs = array ( ) ; foreach ( $ mparams as $ name => $ params ) { if ( is_array ( $ params ) ) { $ this -> create ( $ params , $ name ) ; } elseif ( isset ( $ mparams [ $ params ] ) ) { $ assocs [ $ name ] = $ params ; } else { throw new StorageAssoc ( $ params ) ; } } fore... | Fills the storage by databases |
18,565 | public function exists ( $ name = null ) { if ( $ name === null ) { $ name = $ this -> mainname ; } return isset ( $ this -> dbs [ $ name ] ) ; } | Checks if a name exists in the storage |
18,566 | private function parse ( ) { if ( ! self :: $ placeholders ) { self :: loadConfig ( ) ; } $ this -> type = '' ; $ this -> modifiers = self :: $ lModifiers ; $ ph = $ this -> placeholder ; if ( $ ph == '' ) { return true ; } $ comp = explode ( '-' , $ ph ) ; if ( count ( $ comp ) > 1 ) { $ type = array_shift ( $ comp ) ... | Parses the placeholder |
18,567 | private static function loadConfig ( ) { $ config = Config :: get ( 'placeholders' ) ; self :: $ longs = $ config [ 'longs' ] ; self :: $ longModifiers = $ config [ 'longModifiers' ] ; self :: $ placeholders = array ( ) ; foreach ( $ config [ 'placeholders' ] as $ placeholder ) { self :: $ placeholders [ $ placeholder ... | Loads the placeholders configuration |
18,568 | public static function getOpt ( $ key , $ default = null ) { if ( array_key_exists ( $ key , self :: $ current ) ) { return self :: $ current [ $ key ] ; } if ( array_key_exists ( $ key , self :: $ opts ) ) { return self :: $ opts [ $ key ] ; } return $ default ; } | Returns a compatibility option by its key |
18,569 | public function connect ( ) { if ( $ this -> connection ) { $ this -> countConnections ++ ; return false ; } $ connection = $ this -> implementation -> connect ( $ this -> params , $ errorInfo , $ errorCode ) ; if ( ! $ connection ) { throw new Connect ( $ errorInfo , $ errorCode ) ; } $ this -> connection = $ connecti... | The connection requirement |
18,570 | public function close ( ) { if ( ! $ this -> connection ) { return false ; } $ this -> countConnections -- ; if ( $ this -> countConnections > 0 ) { return false ; } $ this -> implementation -> close ( $ this -> connection ) ; $ this -> connection = null ; return true ; } | The closing requirement |
18,571 | protected function deny ( ) { if ( $ this -> connection ) { $ this -> implementation -> close ( $ this -> connection ) ; $ this -> connection = null ; } $ this -> countLinks = 0 ; $ this -> countConnections = 0 ; return true ; } | Closes all connection |
18,572 | public function insert ( array $ set ) { if ( empty ( $ set ) ) { return null ; } if ( $ this -> accum !== null ) { $ this -> accum [ ] = $ set ; if ( count ( $ this -> accum ) >= $ this -> sizeAccum ) { $ this -> multiInsert ( $ this -> accum , true ) ; $ this -> accum = array ( ) ; } $ this -> lastIdAccum ++ ; return... | Inserts a row to the table |
18,573 | public function replace ( array $ set ) { if ( empty ( $ set ) ) { return null ; } if ( $ this -> map ) { $ set = $ this -> map -> set ( $ set ) ; } if ( $ this -> fake ) { return $ this -> fake -> replace ( $ set ) ; } $ pattern = 'REPLACE INTO ?t (?cols) VALUES (?ln)' ; $ data = array ( $ this -> name , array_keys ( ... | Replaces or inserts a row |
18,574 | public function select ( $ cols = null , $ where = true , $ order = null , $ limit = null ) { if ( $ this -> map ) { $ cols = $ this -> map -> cols ( $ cols ) ; $ where = $ this -> map -> where ( $ where ) ; $ order = $ this -> map -> order ( $ order ) ; } if ( $ cols === null ) { $ cols = true ; } if ( $ this -> fake ... | Selects rows from the table |
18,575 | public function delete ( $ where = null ) { if ( $ this -> map ) { $ where = $ this -> map -> where ( $ where ) ; } if ( $ this -> fake ) { return $ this -> fake -> delete ( $ where ) ; } $ pattern = 'DELETE FROM ?t WHERE ?w' ; $ data = array ( $ this -> name , $ where ) ; return $ this -> db -> query ( $ pattern , $ d... | Deletes rows from the table |
18,576 | public function truncate ( ) { if ( $ this -> fake ) { return $ this -> fake -> truncate ( ) ; } $ pattern = 'TRUNCATE TABLE ?t' ; $ data = array ( $ this -> name ) ; $ this -> db -> query ( $ pattern , $ data ) ; } | Truncates the table |
18,577 | public function flushAccumInsert ( ) { if ( $ this -> accum === null ) { return 0 ; } $ count = count ( $ this -> accum ) ; if ( $ count > 0 ) { $ this -> multiInsert ( $ this -> accum , true ) ; } $ this -> accum = null ; $ this -> lastIdAccum = null ; $ this -> sizeAccum = null ; return $ count ; } | Flushes the accumulated queries |
18,578 | public static function notAllowed ( OwnableContract $ ownable , CanBeOwnerContract $ owner ) { return new static ( sprintf ( 'Model `%s` not allows owner of type `%s`.' , get_class ( $ ownable ) , get_class ( $ owner ) ) ) ; } | Owner of the provided type is not allowed to own this model . |
18,579 | public function parse ( ) { if ( $ this -> query !== null ) { return $ this -> query ; } $ query = preg_replace_callback ( '~{(.*?)}~' , array ( $ this , 'tableClb' ) , $ this -> pattern ) ; $ pattern = '~\?([a-z\?-]+)?(:([a-z0-9_-]*))?;?~i' ; $ callback = array ( $ this , 'placeholderClb' ) ; $ query = preg_replace_ca... | The query templating |
18,580 | protected function placeholderClb ( $ matches ) { $ placeholder = isset ( $ matches [ 1 ] ) ? $ matches [ 1 ] : '' ; if ( isset ( $ matches [ 3 ] ) ) { $ name = $ matches [ 3 ] ; if ( empty ( $ name ) ) { throw new UnknownPlaceholder ( $ matches [ 0 ] ) ; } } else { $ name = null ; if ( $ placeholder == '?' ) { return ... | Replaces a next placeholder in the pattern |
18,581 | private function valueModification ( $ value , array $ modifiers ) { if ( is_null ( $ value ) ) { if ( $ modifiers [ 'n' ] || Compat :: getOpt ( 'types' ) ) { return $ this -> implementation -> reprNULL ( $ this -> connection ) ; } } if ( $ modifiers [ 'h' ] ) { return $ this -> implementation -> reprHexadecimal ( $ th... | Converts a scalar value in conformity with the modifiers list |
18,582 | public static function getImplementationForAdapter ( $ adapter ) { if ( ! isset ( self :: $ cacheAdapters [ $ adapter ] ) ) { $ classname = __NAMESPACE__ . '\\' . ucfirst ( $ adapter ) ; self :: $ cacheAdapters [ $ adapter ] = new $ classname ( ) ; } return self :: $ cacheAdapters [ $ adapter ] ; } | Creates an instance for the specified adapter |
18,583 | public function checkParams ( array $ params , & $ error = null ) { $ result = array ( ) ; foreach ( $ this -> paramsReq as $ param ) { if ( ! array_key_exists ( $ param , $ params ) ) { $ error = 'required ' . $ param ; return false ; } $ result [ $ param ] = $ params [ $ param ] ; } foreach ( $ this -> paramsDefault ... | Validates and normalizes connection parameters |
18,584 | public function fetchObject ( $ connection , $ cursor ) { $ result = $ this -> fetchAssoc ( $ connection , $ cursor ) ; return $ result ? ( object ) $ result : false ; } | Returns a next line as a object |
18,585 | public function reprInt ( $ connection , $ value ) { $ value = ( int ) $ value ; if ( $ value < 0 ) { $ value = '(' . $ value . ')' ; } return $ value ; } | Represents a integer number as a data |
18,586 | public static function update ( array $ id = [ ] , array $ data = [ ] , ClientInterface $ client = null ) { return ( new RequestService ( $ client ) ) -> setResourceClass ( static :: class ) -> setResourcePath ( static :: RESOURCE_PATH . "/:" . static :: RESOURCE_ID ) -> update ( $ id , $ data ) ; } | Update a Resource |
18,587 | public function withHolder ( Holder $ holder ) : self { $ obj = clone $ this ; $ obj -> _holder = $ holder ; return $ obj ; } | Get self with holder . |
18,588 | public function withIssuer ( AttCertIssuer $ issuer ) : self { $ obj = clone $ this ; $ obj -> _issuer = $ issuer ; return $ obj ; } | Get self with issuer . |
18,589 | public function withSignature ( SignatureAlgorithmIdentifier $ algo ) : self { $ obj = clone $ this ; $ obj -> _signature = $ algo ; return $ obj ; } | Get self with signature algorithm identifier . |
18,590 | public function withSerialNumber ( $ serial ) : self { $ obj = clone $ this ; $ obj -> _serialNumber = strval ( $ serial ) ; return $ obj ; } | Get self with serial number . |
18,591 | public function withRandomSerialNumber ( int $ size = 16 ) : self { $ num = gmp_init ( mt_rand ( 1 , 0x7f ) , 10 ) ; for ( $ i = 1 ; $ i < $ size ; ++ $ i ) { $ num <<= 8 ; $ num += mt_rand ( 0 , 0xff ) ; } return $ this -> withSerialNumber ( gmp_strval ( $ num , 10 ) ) ; } | Get self with random positive serial number . |
18,592 | public function withValidity ( AttCertValidityPeriod $ validity ) : self { $ obj = clone $ this ; $ obj -> _attrCertValidityPeriod = $ validity ; return $ obj ; } | Get self with validity period . |
18,593 | public function withAttributes ( Attributes $ attribs ) : self { $ obj = clone $ this ; $ obj -> _attributes = $ attribs ; return $ obj ; } | Get self with attributes . |
18,594 | public function withIssuerUniqueID ( UniqueIdentifier $ uid ) : self { $ obj = clone $ this ; $ obj -> _issuerUniqueID = $ uid ; return $ obj ; } | Get self with issuer unique identifier . |
18,595 | public function withExtensions ( Extensions $ extensions ) : self { $ obj = clone $ this ; $ obj -> _extensions = $ extensions ; return $ obj ; } | Get self with extensions . |
18,596 | public function sign ( SignatureAlgorithmIdentifier $ algo , PrivateKeyInfo $ privkey_info , Crypto $ crypto = null ) : AttributeCertificate { $ crypto = $ crypto ? : Crypto :: getDefault ( ) ; $ aci = clone $ this ; if ( ! isset ( $ aci -> _serialNumber ) ) { $ aci -> _serialNumber = "0" ; } $ aci -> _signature = $ al... | Create signed attribute certificate . |
18,597 | public static function fromRawString ( string $ oid , bool $ critical , string $ data ) : self { $ obj = new self ( $ oid , $ critical , new OctetString ( '' ) ) ; $ obj -> _element = null ; $ obj -> _data = $ data ; return $ obj ; } | Create instance from a raw encoded extension value . |
18,598 | protected function _allOfType ( int $ type ) : array { return array_values ( array_filter ( $ this -> _targets , function ( Target $ target ) use ( $ type ) { return $ target -> type ( ) == $ type ; } ) ) ; } | Get all targets of given type . |
18,599 | public function hasTarget ( Target $ target ) : bool { foreach ( $ this -> _allOfType ( $ target -> type ( ) ) as $ t ) { if ( $ target -> equals ( $ t ) ) { return true ; } } return false ; } | Check whether given target is present . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.