id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
190,200
srmklive/flysystem-dropbox-v2
src/Client/DropboxClient.php
DropboxClient.performContentApiRequest
public function performContentApiRequest($endpoint, $payload) { $this->setupRequest($payload); $this->apiEndpoint = $endpoint; return $this->doDropboxApiContentRequest(); }
php
public function performContentApiRequest($endpoint, $payload) { $this->setupRequest($payload); $this->apiEndpoint = $endpoint; return $this->doDropboxApiContentRequest(); }
[ "public", "function", "performContentApiRequest", "(", "$", "endpoint", ",", "$", "payload", ")", "{", "$", "this", "->", "setupRequest", "(", "$", "payload", ")", ";", "$", "this", "->", "apiEndpoint", "=", "$", "endpoint", ";", "return", "$", "this", "...
Perform Dropbox API v2 content request. @param $endpoint @param $payload @throws \Exception @return \Psr\Http\Message\ResponseInterface
[ "Perform", "Dropbox", "API", "v2", "content", "request", "." ]
82c074a437723d735e70d1c03fbead9fe7204668
https://github.com/srmklive/flysystem-dropbox-v2/blob/82c074a437723d735e70d1c03fbead9fe7204668/src/Client/DropboxClient.php#L495-L501
190,201
srmklive/flysystem-dropbox-v2
src/Client/DropboxClient.php
DropboxClient.setupDropboxHeaders
protected function setupDropboxHeaders() { $headers = [ 'Dropbox-API-Arg' => json_encode( $this->request ), ]; if (!empty($this->content) || $this->apiEndpoint == 'files/upload_session/finish') { // The upload_session/finish ...
php
protected function setupDropboxHeaders() { $headers = [ 'Dropbox-API-Arg' => json_encode( $this->request ), ]; if (!empty($this->content) || $this->apiEndpoint == 'files/upload_session/finish') { // The upload_session/finish ...
[ "protected", "function", "setupDropboxHeaders", "(", ")", "{", "$", "headers", "=", "[", "'Dropbox-API-Arg'", "=>", "json_encode", "(", "$", "this", "->", "request", ")", ",", "]", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "content", ")", "...
Setup headers for Dropbox API request. @return array
[ "Setup", "headers", "for", "Dropbox", "API", "request", "." ]
82c074a437723d735e70d1c03fbead9fe7204668
https://github.com/srmklive/flysystem-dropbox-v2/blob/82c074a437723d735e70d1c03fbead9fe7204668/src/Client/DropboxClient.php#L528-L542
190,202
srmklive/flysystem-dropbox-v2
src/Client/DropboxClient.php
DropboxClient.determineException
protected function determineException(HttpClientException $exception) { if (!empty($exception->getResponse()) && in_array($exception->getResponse()->getStatusCode(), [400, 409])) { return new BadRequest($exception->getResponse()); } return $exception; }
php
protected function determineException(HttpClientException $exception) { if (!empty($exception->getResponse()) && in_array($exception->getResponse()->getStatusCode(), [400, 409])) { return new BadRequest($exception->getResponse()); } return $exception; }
[ "protected", "function", "determineException", "(", "HttpClientException", "$", "exception", ")", "{", "if", "(", "!", "empty", "(", "$", "exception", "->", "getResponse", "(", ")", ")", "&&", "in_array", "(", "$", "exception", "->", "getResponse", "(", ")",...
Catch Dropbox API request exception. @param HttpClientException $exception @return \Exception
[ "Catch", "Dropbox", "API", "request", "exception", "." ]
82c074a437723d735e70d1c03fbead9fe7204668
https://github.com/srmklive/flysystem-dropbox-v2/blob/82c074a437723d735e70d1c03fbead9fe7204668/src/Client/DropboxClient.php#L590-L597
190,203
Vinelab/minion
src/Vinelab/Minion/Minion.php
Minion.register
public function register($provider) { // When we receive a string we consider it to be a provider, if not we throw them away! if (is_string($provider) && !is_a($provider, '\Vinelab\Minion\Provider', true)) { throw new InvalidProviderException( sprintf('Provider %s must be...
php
public function register($provider) { // When we receive a string we consider it to be a provider, if not we throw them away! if (is_string($provider) && !is_a($provider, '\Vinelab\Minion\Provider', true)) { throw new InvalidProviderException( sprintf('Provider %s must be...
[ "public", "function", "register", "(", "$", "provider", ")", "{", "// When we receive a string we consider it to be a provider, if not we throw them away!", "if", "(", "is_string", "(", "$", "provider", ")", "&&", "!", "is_a", "(", "$", "provider", ",", "'\\Vinelab\\Min...
Register the given provider. @param Closure|string $provider
[ "Register", "the", "given", "provider", "." ]
0f9cf9bfeb9372f975f30eb197ab98906393b12a
https://github.com/Vinelab/minion/blob/0f9cf9bfeb9372f975f30eb197ab98906393b12a/src/Vinelab/Minion/Minion.php#L40-L52
190,204
Vinelab/minion
src/Vinelab/Minion/Minion.php
Minion.run
public function run($options = [], LoopInterface $loop = null) { $this->mergeConfig($options); // Print out our lovely minion. echo $this->gimmeASCII()."\n"; $client = $this->newClient($loop); $client->addTransportProvider($this->newTransportProvider()); return $cl...
php
public function run($options = [], LoopInterface $loop = null) { $this->mergeConfig($options); // Print out our lovely minion. echo $this->gimmeASCII()."\n"; $client = $this->newClient($loop); $client->addTransportProvider($this->newTransportProvider()); return $cl...
[ "public", "function", "run", "(", "$", "options", "=", "[", "]", ",", "LoopInterface", "$", "loop", "=", "null", ")", "{", "$", "this", "->", "mergeConfig", "(", "$", "options", ")", ";", "// Print out our lovely minion.", "echo", "$", "this", "->", "gim...
Run the server. @param array $options @param \React\EventLoop\LoopInterface $loop @throws \Exception If encountered any failure starting the client.
[ "Run", "the", "server", "." ]
0f9cf9bfeb9372f975f30eb197ab98906393b12a
https://github.com/Vinelab/minion/blob/0f9cf9bfeb9372f975f30eb197ab98906393b12a/src/Vinelab/Minion/Minion.php#L72-L83
190,205
Vinelab/minion
src/Vinelab/Minion/Minion.php
Minion.newClient
public function newClient(LoopInterface $loop = null) { return new Client($this->getConfig('realm'), $this->getRegisteredProviders(), $loop); }
php
public function newClient(LoopInterface $loop = null) { return new Client($this->getConfig('realm'), $this->getRegisteredProviders(), $loop); }
[ "public", "function", "newClient", "(", "LoopInterface", "$", "loop", "=", "null", ")", "{", "return", "new", "Client", "(", "$", "this", "->", "getConfig", "(", "'realm'", ")", ",", "$", "this", "->", "getRegisteredProviders", "(", ")", ",", "$", "loop"...
Get a new Client instance. @param \React\EventLoop\LoopInterface $loop @return \Vinelab\Minion\Client
[ "Get", "a", "new", "Client", "instance", "." ]
0f9cf9bfeb9372f975f30eb197ab98906393b12a
https://github.com/Vinelab/minion/blob/0f9cf9bfeb9372f975f30eb197ab98906393b12a/src/Vinelab/Minion/Minion.php#L92-L95
190,206
Vinelab/minion
src/Vinelab/Minion/Minion.php
Minion.transportUrl
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...
php
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...
[ "public", "function", "transportUrl", "(", ")", "{", "$", "proto", "=", "$", "this", "->", "getConfig", "(", "'tls'", ")", "?", "'wss'", ":", "'ws'", ";", "$", "port", "=", "intval", "(", "$", "this", "->", "getConfig", "(", "'port'", ")", ")", ";"...
Get the transport URL that provider should connect to. @return string
[ "Get", "the", "transport", "URL", "that", "provider", "should", "connect", "to", "." ]
0f9cf9bfeb9372f975f30eb197ab98906393b12a
https://github.com/Vinelab/minion/blob/0f9cf9bfeb9372f975f30eb197ab98906393b12a/src/Vinelab/Minion/Minion.php#L112-L123
190,207
TTRGroup/pipedrive-api-php
src/Benhawker/Pipedrive/Library/Deals.php
Deals.addProduct
public function addProduct($dealId, array $data) { //if there is no product_id set throw error as it is a required field if (!isset($data['product_id'])) { throw new PipedriveMissingFieldError('You must include a "pdoruct_id" field when adding a product to a deal'); } //i...
php
public function addProduct($dealId, array $data) { //if there is no product_id set throw error as it is a required field if (!isset($data['product_id'])) { throw new PipedriveMissingFieldError('You must include a "pdoruct_id" field when adding a product to a deal'); } //i...
[ "public", "function", "addProduct", "(", "$", "dealId", ",", "array", "$", "data", ")", "{", "//if there is no product_id set throw error as it is a required field", "if", "(", "!", "isset", "(", "$", "data", "[", "'product_id'", "]", ")", ")", "{", "throw", "ne...
Adds a product to a deal @param int $dealId deal id @param array $data deal and product detials @return array returns detials of the deal-product @throws PipedriveMissingFieldError
[ "Adds", "a", "product", "to", "a", "deal" ]
a5fd15aa5ce2624460c1f57449fb5f775b77538d
https://github.com/TTRGroup/pipedrive-api-php/blob/a5fd15aa5ce2624460c1f57449fb5f775b77538d/src/Benhawker/Pipedrive/Library/Deals.php#L103-L119
190,208
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.setQueue
public function setQueue( $queue ) { $this->queue = $queue; if ( $this->mailer ) { $this->mailer->setQueue( $queue ); } return $this; }
php
public function setQueue( $queue ) { $this->queue = $queue; if ( $this->mailer ) { $this->mailer->setQueue( $queue ); } return $this; }
[ "public", "function", "setQueue", "(", "$", "queue", ")", "{", "$", "this", "->", "queue", "=", "$", "queue", ";", "if", "(", "$", "this", "->", "mailer", ")", "{", "$", "this", "->", "mailer", "->", "setQueue", "(", "$", "queue", ")", ";", "}", ...
Assigns Queue manager instance @param \Illuminate\Queue\QueueManager $queue @return Mailer
[ "Assigns", "Queue", "manager", "instance" ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L97-L107
190,209
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.inMode
public function inMode( $mode ) { if ( !is_array($mode) ) { $mode = func_get_args(); } return in_array( $this->reset_mode, $mode ); }
php
public function inMode( $mode ) { if ( !is_array($mode) ) { $mode = func_get_args(); } return in_array( $this->reset_mode, $mode ); }
[ "public", "function", "inMode", "(", "$", "mode", ")", "{", "if", "(", "!", "is_array", "(", "$", "mode", ")", ")", "{", "$", "mode", "=", "func_get_args", "(", ")", ";", "}", "return", "in_array", "(", "$", "this", "->", "reset_mode", ",", "$", ...
Checks auto reset mode @param int|array $mode @return bool
[ "Checks", "auto", "reset", "mode" ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L204-L212
190,210
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.getSwiftMailerTransport
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(); }
php
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(); }
[ "protected", "function", "getSwiftMailerTransport", "(", ")", "{", "if", "(", "!", "$", "mailer", "=", "$", "this", "->", "mailer", ")", "{", "return", "null", ";", "}", "if", "(", "!", "$", "swift_mailer", "=", "$", "mailer", "->", "getSwiftMailer", "...
Get the Swift Mailer Transport instance. @return \Swift_Transport|null
[ "Get", "the", "Swift", "Mailer", "Transport", "instance", "." ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L233-L251
190,211
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.resetSwiftTransport
protected function resetSwiftTransport() { if ( !$transport = $this->queryTransport() ) { return; } if ( !$transport->isStarted() ) { $transport->start(); return; } try { // Send RESET to restart the SMTP status and check if it's ready for running $transport->reset(); } catch (Exc...
php
protected function resetSwiftTransport() { if ( !$transport = $this->queryTransport() ) { return; } if ( !$transport->isStarted() ) { $transport->start(); return; } try { // Send RESET to restart the SMTP status and check if it's ready for running $transport->reset(); } catch (Exc...
[ "protected", "function", "resetSwiftTransport", "(", ")", "{", "if", "(", "!", "$", "transport", "=", "$", "this", "->", "queryTransport", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "$", "transport", "->", "isStarted", "(", ")", ")", "{"...
Reset Swift Mailer SMTP transport adapter @return void
[ "Reset", "Swift", "Mailer", "SMTP", "transport", "adapter" ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L258-L284
190,212
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.stopSwiftTransport
protected function stopSwiftTransport() { if ( !$transport = $this->queryTransport() ) { return; } if ( !$transport->isStarted() ) { // Not running - no reason for stopping it return; } try { // Send STOP to stop the SMTP connection $transport->stop(); } catch (Exception $e) { ...
php
protected function stopSwiftTransport() { if ( !$transport = $this->queryTransport() ) { return; } if ( !$transport->isStarted() ) { // Not running - no reason for stopping it return; } try { // Send STOP to stop the SMTP connection $transport->stop(); } catch (Exception $e) { ...
[ "protected", "function", "stopSwiftTransport", "(", ")", "{", "if", "(", "!", "$", "transport", "=", "$", "this", "->", "queryTransport", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "$", "transport", "->", "isStarted", "(", ")", ")", "{",...
Stop Swift Mailer SMTP transport adapter @return void
[ "Stop", "Swift", "Mailer", "SMTP", "transport", "adapter" ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L291-L318
190,213
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.queryTransport
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' ) ) { return ...
php
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' ) ) { return ...
[ "protected", "function", "queryTransport", "(", ")", "{", "if", "(", "$", "this", "->", "mailer", "&&", "method_exists", "(", "$", "this", "->", "mailer", ",", "'isPretending'", ")", "&&", "$", "this", "->", "mailer", "->", "isPretending", "(", ")", ")",...
Query correct transport object @return \Swift_Transport|null
[ "Query", "correct", "transport", "object" ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L325-L340
190,214
YOzaz/Laravel-SwiftMailer
src/YOzaz/LaravelSwiftmailer/Mailer.php
Mailer.getQueuedCallable
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['callback']))->ge...
php
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['callback']))->ge...
[ "protected", "function", "getQueuedCallable", "(", "array", "$", "data", ")", "{", "if", "(", "Str", "::", "contains", "(", "$", "data", "[", "'callback'", "]", ",", "'SerializableClosure'", ")", ")", "{", "if", "(", "class_exists", "(", "'\\SuperClosure\\Se...
Get the true callable for a queued e-mail message. @param array $data @return mixed
[ "Get", "the", "true", "callable", "for", "a", "queued", "e", "-", "mail", "message", "." ]
3493e1195d2ff719982cfa4251e81d10aa0dffef
https://github.com/YOzaz/Laravel-SwiftMailer/blob/3493e1195d2ff719982cfa4251e81d10aa0dffef/src/YOzaz/LaravelSwiftmailer/Mailer.php#L396-L411
190,215
TTRGroup/pipedrive-api-php
src/Benhawker/Pipedrive/Library/Curl.php
Curl.exec
protected function exec() { //get response output and info $response = curl_exec($this->curl); $info = curl_getinfo($this->curl); //if there is a curl error throw Exception if (curl_error($this->curl)) { //throw error throw new PipedriveHttpError(...
php
protected function exec() { //get response output and info $response = curl_exec($this->curl); $info = curl_getinfo($this->curl); //if there is a curl error throw Exception if (curl_error($this->curl)) { //throw error throw new PipedriveHttpError(...
[ "protected", "function", "exec", "(", ")", "{", "//get response output and info", "$", "response", "=", "curl_exec", "(", "$", "this", "->", "curl", ")", ";", "$", "info", "=", "curl_getinfo", "(", "$", "this", "->", "curl", ")", ";", "//if there is a curl e...
Execute current cURL session @return array decoded json ouput
[ "Execute", "current", "cURL", "session" ]
a5fd15aa5ce2624460c1f57449fb5f775b77538d
https://github.com/TTRGroup/pipedrive-api-php/blob/a5fd15aa5ce2624460c1f57449fb5f775b77538d/src/Benhawker/Pipedrive/Library/Curl.php#L130-L151
190,216
TTRGroup/pipedrive-api-php
src/Benhawker/Pipedrive/Library/Curl.php
Curl.createEndPoint
protected function createEndPoint($method, $data = array()) { //create array for api key $data['api_token'] = $this->apiKey; //make API end point $endPoint = $this->url . '/' . $method . '?' . http_build_query($data); //set API endpoint $this->setOpt(CURLOPT_URL, $en...
php
protected function createEndPoint($method, $data = array()) { //create array for api key $data['api_token'] = $this->apiKey; //make API end point $endPoint = $this->url . '/' . $method . '?' . http_build_query($data); //set API endpoint $this->setOpt(CURLOPT_URL, $en...
[ "protected", "function", "createEndPoint", "(", "$", "method", ",", "$", "data", "=", "array", "(", ")", ")", "{", "//create array for api key", "$", "data", "[", "'api_token'", "]", "=", "$", "this", "->", "apiKey", ";", "//make API end point", "$", "endPoi...
takes the pipedrive method and turns it into the correct URL endpoint by adding the method and API key @param string $method Pipedrive method @return $this Current Object
[ "takes", "the", "pipedrive", "method", "and", "turns", "it", "into", "the", "correct", "URL", "endpoint", "by", "adding", "the", "method", "and", "API", "key" ]
a5fd15aa5ce2624460c1f57449fb5f775b77538d
https://github.com/TTRGroup/pipedrive-api-php/blob/a5fd15aa5ce2624460c1f57449fb5f775b77538d/src/Benhawker/Pipedrive/Library/Curl.php#L176-L186
190,217
TTRGroup/pipedrive-api-php
src/Benhawker/Pipedrive/Library/Activities.php
Activities.add
public function add(array $data) { //if there is no subject or type set chuck error as both of the fields are required if (!isset($data['subject']) or !isset($data['type'])) { throw new PipedriveMissingFieldError('You must include both a "subject" and "type" field when inserting a note'...
php
public function add(array $data) { //if there is no subject or type set chuck error as both of the fields are required if (!isset($data['subject']) or !isset($data['type'])) { throw new PipedriveMissingFieldError('You must include both a "subject" and "type" field when inserting a note'...
[ "public", "function", "add", "(", "array", "$", "data", ")", "{", "//if there is no subject or type set chuck error as both of the fields are required", "if", "(", "!", "isset", "(", "$", "data", "[", "'subject'", "]", ")", "or", "!", "isset", "(", "$", "data", ...
Adds a activity @param array $data activity detials @return array returns detials of the activity
[ "Adds", "a", "activity" ]
a5fd15aa5ce2624460c1f57449fb5f775b77538d
https://github.com/TTRGroup/pipedrive-api-php/blob/a5fd15aa5ce2624460c1f57449fb5f775b77538d/src/Benhawker/Pipedrive/Library/Activities.php#L38-L47
190,218
kanellov/slim-twig-flash
src/TwigMessages.php
TwigMessages.getMessages
public function getMessages($key = null) { if (null !== $key) { return $this->flash->getMessage($key); } return $this->flash->getMessages(); }
php
public function getMessages($key = null) { if (null !== $key) { return $this->flash->getMessage($key); } return $this->flash->getMessages(); }
[ "public", "function", "getMessages", "(", "$", "key", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "key", ")", "{", "return", "$", "this", "->", "flash", "->", "getMessage", "(", "$", "key", ")", ";", "}", "return", "$", "this", "->", "f...
Returns Flash messages; If key is provided then returns messages for that key. @param string $key @return array
[ "Returns", "Flash", "messages", ";", "If", "key", "is", "provided", "then", "returns", "messages", "for", "that", "key", "." ]
919e9d6a2ee8c9db94af0bc47192e02ec5d83ba6
https://github.com/kanellov/slim-twig-flash/blob/919e9d6a2ee8c9db94af0bc47192e02ec5d83ba6/src/TwigMessages.php#L63-L70
190,219
TTRGroup/pipedrive-api-php
src/Benhawker/Pipedrive/Library/Notes.php
Notes.add
public function add(array $data) { //if there is no content set throw error as it is a required field if (!isset($data['content'])) { throw new PipedriveMissingFieldError('You must include a "content" field when inserting a note'); } //if there is no deal, person, organi...
php
public function add(array $data) { //if there is no content set throw error as it is a required field if (!isset($data['content'])) { throw new PipedriveMissingFieldError('You must include a "content" field when inserting a note'); } //if there is no deal, person, organi...
[ "public", "function", "add", "(", "array", "$", "data", ")", "{", "//if there is no content set throw error as it is a required field", "if", "(", "!", "isset", "(", "$", "data", "[", "'content'", "]", ")", ")", "{", "throw", "new", "PipedriveMissingFieldError", "...
Adds a note @param array $data note detials @return array returns detials of the note
[ "Adds", "a", "note" ]
a5fd15aa5ce2624460c1f57449fb5f775b77538d
https://github.com/TTRGroup/pipedrive-api-php/blob/a5fd15aa5ce2624460c1f57449fb5f775b77538d/src/Benhawker/Pipedrive/Library/Notes.php#L37-L50
190,220
vasa-c/go-db
goDB/DB.php
DB.create
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)) { ...
php
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)) { ...
[ "final", "public", "static", "function", "create", "(", "array", "$", "params", ",", "$", "adapter", "=", "null", ")", "{", "$", "adapter", "=", "isset", "(", "$", "params", "[", "'_adapter'", "]", ")", "?", "$", "params", "[", "'_adapter'", "]", ":"...
Creates an instance for database access @param array $params database connection parameters @param string $adapter [optional] a name of a db-adapter (if it not specified in $params) @return \go\DB\DB the instance for database access @throws \go\DB\Exceptions\Config parameters is invalid @throws \go\DB\Exceptions\Conne...
[ "Creates", "an", "instance", "for", "database", "access" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L47-L57
190,221
vasa-c/go-db
goDB/DB.php
DB.getAvailableAdapters
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[] = strto...
php
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[] = strto...
[ "final", "public", "static", "function", "getAvailableAdapters", "(", ")", "{", "if", "(", "!", "self", "::", "$", "availableAdapters", ")", "{", "$", "adapters", "=", "array", "(", ")", ";", "foreach", "(", "glob", "(", "__DIR__", ".", "'/Adapters/*.php'"...
Returns the list of available adapters @return array
[ "Returns", "the", "list", "of", "available", "adapters" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L64-L76
190,222
vasa-c/go-db
goDB/DB.php
DB.query
final public function query($pattern, $data = null, $fetch = null, $prefix = null) { $query = $this->makeQuery($pattern, $data, $prefix); return $this->plainQuery($query, $fetch); }
php
final public function query($pattern, $data = null, $fetch = null, $prefix = null) { $query = $this->makeQuery($pattern, $data, $prefix); return $this->plainQuery($query, $fetch); }
[ "final", "public", "function", "query", "(", "$", "pattern", ",", "$", "data", "=", "null", ",", "$", "fetch", "=", "null", ",", "$", "prefix", "=", "null", ")", "{", "$", "query", "=", "$", "this", "->", "makeQuery", "(", "$", "pattern", ",", "$...
Performs a query on the database @param string $pattern the query pattern @param array $data [optional] the incoming data for the query pattern @param string $fetch [optional] the result format @param string $prefix [optional] a table prefix for the current query @return \go\DB\Result the query result in specified for...
[ "Performs", "a", "query", "on", "the", "database" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L102-L106
190,223
vasa-c/go-db
goDB/DB.php
DB.preQuery
final public function preQuery($pattern, $data = null) { $this->preQueries[] = array($pattern, $data); if ($this->connected) { $this->execPre(); } }
php
final public function preQuery($pattern, $data = null) { $this->preQueries[] = array($pattern, $data); if ($this->connected) { $this->execPre(); } }
[ "final", "public", "function", "preQuery", "(", "$", "pattern", ",", "$", "data", "=", "null", ")", "{", "$", "this", "->", "preQueries", "[", "]", "=", "array", "(", "$", "pattern", ",", "$", "data", ")", ";", "if", "(", "$", "this", "->", "conn...
Saves a pre-query @param string $pattern @param array $data [optional] @throws \go\DB\Exceptions\Exception
[ "Saves", "a", "pre", "-", "query" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L115-L121
190,224
vasa-c/go-db
goDB/DB.php
DB.plainQuery
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); ...
php
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); ...
[ "final", "public", "function", "plainQuery", "(", "$", "query", ",", "$", "fetch", "=", "null", ")", "{", "$", "this", "->", "forcedConnect", "(", ")", ";", "$", "implementation", "=", "$", "this", "->", "connector", "->", "getImplementation", "(", ")", ...
Performs a "plain" query @param string $query a plain query @param string $fetch [optional] the result format @return \go\DB\Result the query result in specified format @throws \go\DB\Exceptions\Connect an error of lazy connection @throws \go\DB\Exceptions\Closed the connection is closed @throws \go\DB\Exceptions\Quer...
[ "Performs", "a", "plain", "query" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L141-L160
190,225
vasa-c/go-db
goDB/DB.php
DB.setDebug
final public function setDebug($callback = true) { if ($callback === true) { if (php_sapi_name() === 'cli') { $callback = new DebuggerOutConsole(); } else { $callback = new DebuggerOutHtml(); } } $this->debugCallback = $call...
php
final public function setDebug($callback = true) { if ($callback === true) { if (php_sapi_name() === 'cli') { $callback = new DebuggerOutConsole(); } else { $callback = new DebuggerOutHtml(); } } $this->debugCallback = $call...
[ "final", "public", "function", "setDebug", "(", "$", "callback", "=", "true", ")", "{", "if", "(", "$", "callback", "===", "true", ")", "{", "if", "(", "php_sapi_name", "(", ")", "===", "'cli'", ")", "{", "$", "callback", "=", "new", "DebuggerOutConsol...
Sets a handler for the debug info @param callable|bool $callback [optional] a callback($query, $duration, $info) or TRUE for the standard handler or NULL for disable
[ "Sets", "a", "handler", "for", "the", "debug", "info" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L279-L289
190,226
vasa-c/go-db
goDB/DB.php
DB.makeQuery
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); $temp...
php
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); $temp...
[ "public", "function", "makeQuery", "(", "$", "pattern", ",", "$", "data", ",", "$", "prefix", "=", "null", ")", "{", "Compat", "::", "setCurrentOpts", "(", "$", "this", "->", "paramsSys", "[", "'compat'", "]", ")", ";", "$", "this", "->", "forcedConnec...
Creates a query by a pattern and an incoming data @param string $pattern a query pattern @param array $data an incoming data for the pattern @param string $prefix a prefix for tables @return string the plain query @throws \go\DB\Exceptions\Templater an error of templating system
[ "Creates", "a", "query", "by", "a", "pattern", "and", "an", "incoming", "data" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L341-L351
190,227
vasa-c/go-db
goDB/DB.php
DB.getTable
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); ...
php
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); ...
[ "public", "function", "getTable", "(", "$", "tableName", ",", "array", "$", "map", "=", "null", ")", "{", "if", "(", "(", "$", "map", "===", "null", ")", "&&", "(", "is_string", "(", "$", "tableName", ")", ")", ")", "{", "if", "(", "isset", "(", ...
Returns an object for a table access @param string $tableName a table name @param array $map [optional] a map (a key => a real table column) @return \go\DB\Table a "table" instance
[ "Returns", "an", "object", "for", "a", "table", "access" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L363-L376
190,228
vasa-c/go-db
goDB/DB.php
DB.createTemplater
protected function createTemplater($pattern, $data, $prefix) { return (new Templater($this->connector, $pattern, $data, $prefix)); }
php
protected function createTemplater($pattern, $data, $prefix) { return (new Templater($this->connector, $pattern, $data, $prefix)); }
[ "protected", "function", "createTemplater", "(", "$", "pattern", ",", "$", "data", ",", "$", "prefix", ")", "{", "return", "(", "new", "Templater", "(", "$", "this", "->", "connector", ",", "$", "pattern", ",", "$", "data", ",", "$", "prefix", ")", "...
Creates a templating for a query @param string $pattern @param array $data @param string $prefix @return \go\DB\Helpers\Templater
[ "Creates", "a", "templating", "for", "a", "query" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L438-L441
190,229
vasa-c/go-db
goDB/DB.php
DB.separateParams
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, $t...
php
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, $t...
[ "protected", "function", "separateParams", "(", "$", "params", ")", "{", "$", "this", "->", "paramsDB", "=", "array", "(", ")", ";", "$", "this", "->", "paramsSys", "=", "Config", "::", "get", "(", "'configsys'", ")", ";", "foreach", "(", "$", "params"...
Analysis parameters and separates its to system and adapter-depending @param array $params @throws \go\DB\Exceptions\ConfigSys
[ "Analysis", "parameters", "and", "separates", "its", "to", "system", "and", "adapter", "-", "depending" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L460-L475
190,230
vasa-c/go-db
goDB/DB.php
DB.debugLog
protected function debugLog($query, $duration, $info) { if ($this->debugCallback) { call_user_func($this->debugCallback, $query, $duration, $info); } }
php
protected function debugLog($query, $duration, $info) { if ($this->debugCallback) { call_user_func($this->debugCallback, $query, $duration, $info); } }
[ "protected", "function", "debugLog", "(", "$", "query", ",", "$", "duration", ",", "$", "info", ")", "{", "if", "(", "$", "this", "->", "debugCallback", ")", "{", "call_user_func", "(", "$", "this", "->", "debugCallback", ",", "$", "query", ",", "$", ...
Sends a debug info to the handler @param string $query @param float $duration @param mixed $info
[ "Sends", "a", "debug", "info", "to", "the", "handler" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L484-L489
190,231
vasa-c/go-db
goDB/DB.php
DB.execPre
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->q...
php
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->q...
[ "protected", "function", "execPre", "(", ")", "{", "foreach", "(", "$", "this", "->", "preQueries", "as", "$", "pq", ")", "{", "if", "(", "is_array", "(", "$", "pq", ")", ")", "{", "$", "pattern", "=", "$", "pq", "[", "0", "]", ";", "$", "data"...
Executes all pre-queries @throws \go\DB\Exceptions\Exception
[ "Executes", "all", "pre", "-", "queries" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/DB.php#L496-L509
190,232
naderman/composer-aws
src/Naderman/Composer/AWS/AwsPlugin.php
AwsPlugin.onPreFileDownload
public function onPreFileDownload(PreFileDownloadEvent $event) { $protocol = parse_url($event->getProcessedUrl(), PHP_URL_SCHEME); if ($protocol === 's3') { $s3RemoteFilesystem = new S3RemoteFilesystem( $this->io, $this->composer->getConfig(), ...
php
public function onPreFileDownload(PreFileDownloadEvent $event) { $protocol = parse_url($event->getProcessedUrl(), PHP_URL_SCHEME); if ($protocol === 's3') { $s3RemoteFilesystem = new S3RemoteFilesystem( $this->io, $this->composer->getConfig(), ...
[ "public", "function", "onPreFileDownload", "(", "PreFileDownloadEvent", "$", "event", ")", "{", "$", "protocol", "=", "parse_url", "(", "$", "event", "->", "getProcessedUrl", "(", ")", ",", "PHP_URL_SCHEME", ")", ";", "if", "(", "$", "protocol", "===", "'s3'...
Replace remote file system on S3 protocol download @param PreFileDownloadEvent $event
[ "Replace", "remote", "file", "system", "on", "S3", "protocol", "download" ]
0af448c3c51bc9e9d718bc2ef4865d71490d05da
https://github.com/naderman/composer-aws/blob/0af448c3c51bc9e9d718bc2ef4865d71490d05da/src/Naderman/Composer/AWS/AwsPlugin.php#L109-L122
190,233
vasa-c/go-db
goDB/Autoloader.php
Autoloader.register
public static function register() { if (!self::$autoloader) { self::$autoloader = new self(__NAMESPACE__, __DIR__); spl_autoload_register(self::$autoloader); } }
php
public static function register() { if (!self::$autoloader) { self::$autoloader = new self(__NAMESPACE__, __DIR__); spl_autoload_register(self::$autoloader); } }
[ "public", "static", "function", "register", "(", ")", "{", "if", "(", "!", "self", "::", "$", "autoloader", ")", "{", "self", "::", "$", "autoloader", "=", "new", "self", "(", "__NAMESPACE__", ",", "__DIR__", ")", ";", "spl_autoload_register", "(", "self...
Registers an autoloader for the library
[ "Registers", "an", "autoloader", "for", "the", "library" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Autoloader.php#L18-L24
190,234
vasa-c/go-db
goDB/Helpers/Config.php
Config.get
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] = inc...
php
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] = inc...
[ "public", "static", "function", "get", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "config", "[", "$", "name", "]", ")", ")", "{", "$", "filename", "=", "__DIR__", ".", "'/../_config/'", ".", "$", "name", ".", "'....
Returns a specified configuration @example \go\DB\Config::get('placeholders') @param string $name @return mixed @throws \RuntimeException
[ "Returns", "a", "specified", "configuration" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Config.php#L25-L35
190,235
vasa-c/go-db
goDB/Fakes/FakeEngine.php
FakeEngine.query
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); ...
php
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); ...
[ "public", "function", "query", "(", "$", "query", ")", "{", "$", "this", "->", "errorInfo", "=", "null", ";", "$", "this", "->", "errorCode", "=", "null", ";", "$", "query", "=", "trim", "(", "strtolower", "(", "$", "query", ")", ")", ";", "if", ...
Performs a query @param string $query @return \go\DB\Implementations\TestBase\Cursor
[ "Performs", "a", "query" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Fakes/FakeEngine.php#L47-L61
190,236
cybercog/laravel-ownership
src/Providers/OwnershipServiceProvider.php
OwnershipServiceProvider.bindUserModel
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')); }); }
php
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')); }); }
[ "protected", "function", "bindUserModel", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "CanBeOwnerContract", "::", "class", ",", "function", "(", "ApplicationContract", "$", "app", ")", "{", "$", "config", "=", "$", "app", "->", "make", "(...
Bind User model from config to Owner contract. @return void
[ "Bind", "User", "model", "from", "config", "to", "Owner", "contract", "." ]
c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22
https://github.com/cybercog/laravel-ownership/blob/c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22/src/Providers/OwnershipServiceProvider.php#L47-L54
190,237
cybercog/laravel-ownership
src/Traits/HasMorphOwner.php
HasMorphOwner.withDefaultOwner
public function withDefaultOwner(CanBeOwnerContract $owner = null) { $this->defaultOwner = $owner ?: $this->resolveDefaultOwner(); if (isset($this->withDefaultOwnerOnCreate)) { $this->withDefaultOwnerOnCreate = false; } return $this; }
php
public function withDefaultOwner(CanBeOwnerContract $owner = null) { $this->defaultOwner = $owner ?: $this->resolveDefaultOwner(); if (isset($this->withDefaultOwnerOnCreate)) { $this->withDefaultOwnerOnCreate = false; } return $this; }
[ "public", "function", "withDefaultOwner", "(", "CanBeOwnerContract", "$", "owner", "=", "null", ")", "{", "$", "this", "->", "defaultOwner", "=", "$", "owner", "?", ":", "$", "this", "->", "resolveDefaultOwner", "(", ")", ";", "if", "(", "isset", "(", "$...
Set owner as default for entity. @param null|\Cog\Contracts\Ownership\CanBeOwner $owner @return $this
[ "Set", "owner", "as", "default", "for", "entity", "." ]
c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22
https://github.com/cybercog/laravel-ownership/blob/c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22/src/Traits/HasMorphOwner.php#L88-L96
190,238
cybercog/laravel-ownership
src/Traits/HasMorphOwner.php
HasMorphOwner.withoutDefaultOwner
public function withoutDefaultOwner() { $this->defaultOwner = null; if (isset($this->withDefaultOwnerOnCreate)) { $this->withDefaultOwnerOnCreate = false; } return $this; }
php
public function withoutDefaultOwner() { $this->defaultOwner = null; if (isset($this->withDefaultOwnerOnCreate)) { $this->withDefaultOwnerOnCreate = false; } return $this; }
[ "public", "function", "withoutDefaultOwner", "(", ")", "{", "$", "this", "->", "defaultOwner", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "withDefaultOwnerOnCreate", ")", ")", "{", "$", "this", "->", "withDefaultOwnerOnCreate", "=", "false...
Remove default owner for entity. @return $this
[ "Remove", "default", "owner", "for", "entity", "." ]
c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22
https://github.com/cybercog/laravel-ownership/blob/c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22/src/Traits/HasMorphOwner.php#L103-L111
190,239
cybercog/laravel-ownership
src/Traits/HasMorphOwner.php
HasMorphOwner.isOwnedByDefaultOwner
public function isOwnedByDefaultOwner() { $owner = $this->resolveDefaultOwner(); if (!$owner) { throw InvalidDefaultOwner::isNull($this); } return $this->isOwnedBy($owner); }
php
public function isOwnedByDefaultOwner() { $owner = $this->resolveDefaultOwner(); if (!$owner) { throw InvalidDefaultOwner::isNull($this); } return $this->isOwnedBy($owner); }
[ "public", "function", "isOwnedByDefaultOwner", "(", ")", "{", "$", "owner", "=", "$", "this", "->", "resolveDefaultOwner", "(", ")", ";", "if", "(", "!", "$", "owner", ")", "{", "throw", "InvalidDefaultOwner", "::", "isNull", "(", "$", "this", ")", ";", ...
Determine if model owned by owner resolved as default. @return bool @throws \Cog\Contracts\Ownership\Exceptions\InvalidDefaultOwner
[ "Determine", "if", "model", "owned", "by", "owner", "resolved", "as", "default", "." ]
c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22
https://github.com/cybercog/laravel-ownership/blob/c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22/src/Traits/HasMorphOwner.php#L200-L208
190,240
cybercog/laravel-ownership
src/Traits/HasOwner.php
HasOwner.changeOwnerTo
public function changeOwnerTo(CanBeOwnerContract $owner) { $allowedOwnerType = $this->getOwnerModel(); if (!$owner instanceof $allowedOwnerType) { throw InvalidOwnerType::notAllowed($this, $owner); } return $this->ownedBy()->associate($owner); }
php
public function changeOwnerTo(CanBeOwnerContract $owner) { $allowedOwnerType = $this->getOwnerModel(); if (!$owner instanceof $allowedOwnerType) { throw InvalidOwnerType::notAllowed($this, $owner); } return $this->ownedBy()->associate($owner); }
[ "public", "function", "changeOwnerTo", "(", "CanBeOwnerContract", "$", "owner", ")", "{", "$", "allowedOwnerType", "=", "$", "this", "->", "getOwnerModel", "(", ")", ";", "if", "(", "!", "$", "owner", "instanceof", "$", "allowedOwnerType", ")", "{", "throw",...
Changes owner of the model. @param \Cog\Contracts\Ownership\CanBeOwner $owner @return $this @throws \Cog\Contracts\Ownership\Exceptions\InvalidOwnerType
[ "Changes", "owner", "of", "the", "model", "." ]
c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22
https://github.com/cybercog/laravel-ownership/blob/c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22/src/Traits/HasOwner.php#L142-L150
190,241
vasa-c/go-db
goDB/Storage.php
Storage.setInstance
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 '. ...
php
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 '. ...
[ "public", "static", "function", "setInstance", "(", "$", "instance", ")", "{", "if", "(", "$", "instance", "instanceof", "self", ")", "{", "self", "::", "$", "instance", "=", "$", "instance", ";", "}", "elseif", "(", "is_array", "(", "$", "instance", "...
Sets a storage instance as main @param mixed $instance a storage instance or its parameters @return \go\DB\Storage @todo why trigger_error() instead exception?
[ "Sets", "a", "storage", "instance", "as", "main" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L40-L52
190,242
vasa-c/go-db
goDB/Storage.php
Storage.query
public static function query($pattern, $data = null, $fetch = null, $prefix = null) { return self::getInstance()->__invoke($pattern, $data, $fetch, $prefix); }
php
public static function query($pattern, $data = null, $fetch = null, $prefix = null) { return self::getInstance()->__invoke($pattern, $data, $fetch, $prefix); }
[ "public", "static", "function", "query", "(", "$", "pattern", ",", "$", "data", "=", "null", ",", "$", "fetch", "=", "null", ",", "$", "prefix", "=", "null", ")", "{", "return", "self", "::", "getInstance", "(", ")", "->", "__invoke", "(", "$", "pa...
A query to the main database of the main storage @param string $pattern @param array $data [optional] @param string $fetch [optional] @param string $prefix [optional] @return \go\DB\Result @throws \go\DB\Exceptions\StorageDBCentral main storage is not exists @throws \go\DB\Exceptions\Connect @throws \go\DB\Exceptions\...
[ "A", "query", "to", "the", "main", "database", "of", "the", "main", "storage" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L70-L73
190,243
vasa-c/go-db
goDB/Storage.php
Storage.get
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]; }
php
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]; }
[ "public", "function", "get", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "mainname", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "dbs", "[", "$"...
Returns a database instance by its name @param string $name [optional] the name (main database by default) @return \go\DB\DB @throws \go\DB\Exceptions\StorageNotFound this name does not exists in the storage
[ "Returns", "a", "database", "instance", "by", "its", "name" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L103-L112
190,244
vasa-c/go-db
goDB/Storage.php
Storage.create
public function create(array $params, $name = null) { if ($name === null) { $name = $this->mainname; } $db = DB::create($params); $this->set($db, $name); return $db; }
php
public function create(array $params, $name = null) { if ($name === null) { $name = $this->mainname; } $db = DB::create($params); $this->set($db, $name); return $db; }
[ "public", "function", "create", "(", "array", "$", "params", ",", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "mainname", ";", "}", "$", "db", "=", "DB", "::", "creat...
Creates a database instance and saves it in the storage @param array $params the connection parameters @param string $name [optional] the name in the storage (main by default) @return \go\DB\DB the database instance @throws \go\DB\Exceptions\StorageEngaged this name is alreagy engaged @throws \go\DB\Exceptions\Config ...
[ "Creates", "a", "database", "instance", "and", "saves", "it", "in", "the", "storage" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L128-L136
190,245
vasa-c/go-db
goDB/Storage.php
Storage.set
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; }
php
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; }
[ "public", "function", "set", "(", "DB", "$", "db", ",", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "mainname", ";", "}", "if", "(", "isset", "(", "$", "this", "->"...
Saves a database in the storage @param \go\DB\DB $db @param string $name [optional] @throws \go\DB\Exceptions\StorageEngaged this name is alreagy engaged
[ "Saves", "a", "database", "in", "the", "storage" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L146-L155
190,246
vasa-c/go-db
goDB/Storage.php
Storage.fill
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 { ...
php
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 { ...
[ "public", "function", "fill", "(", "array", "$", "mparams", ")", "{", "$", "assocs", "=", "array", "(", ")", ";", "foreach", "(", "$", "mparams", "as", "$", "name", "=>", "$", "params", ")", "{", "if", "(", "is_array", "(", "$", "params", ")", ")...
Fills the storage by databases @param array $mparams parameters for create databases @throws \go\DB\Exceptions\StorageAssoc @throws \go\DB\Exceptions\StorageEngaged
[ "Fills", "the", "storage", "by", "databases" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L165-L180
190,247
vasa-c/go-db
goDB/Storage.php
Storage.exists
public function exists($name = null) { if ($name === null) { $name = $this->mainname; } return isset($this->dbs[$name]); }
php
public function exists($name = null) { if ($name === null) { $name = $this->mainname; } return isset($this->dbs[$name]); }
[ "public", "function", "exists", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "mainname", ";", "}", "return", "isset", "(", "$", "this", "->", "dbs", "[", "$", "na...
Checks if a name exists in the storage @param string $name [optional] @return bool
[ "Checks", "if", "a", "name", "exists", "in", "the", "storage" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Storage.php#L188-L194
190,248
vasa-c/go-db
goDB/Helpers/ParserPH.php
ParserPH.parse
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...
php
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...
[ "private", "function", "parse", "(", ")", "{", "if", "(", "!", "self", "::", "$", "placeholders", ")", "{", "self", "::", "loadConfig", "(", ")", ";", "}", "$", "this", "->", "type", "=", "''", ";", "$", "this", "->", "modifiers", "=", "self", ":...
Parses the placeholder
[ "Parses", "the", "placeholder" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/ParserPH.php#L70-L126
190,249
vasa-c/go-db
goDB/Helpers/ParserPH.php
ParserPH.loadConfig
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[$...
php
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[$...
[ "private", "static", "function", "loadConfig", "(", ")", "{", "$", "config", "=", "Config", "::", "get", "(", "'placeholders'", ")", ";", "self", "::", "$", "longs", "=", "$", "config", "[", "'longs'", "]", ";", "self", "::", "$", "longModifiers", "=",...
Loads the placeholders configuration
[ "Loads", "the", "placeholders", "configuration" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/ParserPH.php#L141-L155
190,250
vasa-c/go-db
goDB/Compat.php
Compat.getOpt
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; }
php
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; }
[ "public", "static", "function", "getOpt", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "self", "::", "$", "current", ")", ")", "{", "return", "self", "::", "$", "current", "[", "$...
Returns a compatibility option by its key @param string $key @param mixed $default [optional] @return mixed
[ "Returns", "a", "compatibility", "option", "by", "its", "key" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Compat.php#L43-L52
190,251
vasa-c/go-db
goDB/Helpers/Connector.php
Connector.connect
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); ...
php
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); ...
[ "public", "function", "connect", "(", ")", "{", "if", "(", "$", "this", "->", "connection", ")", "{", "$", "this", "->", "countConnections", "++", ";", "return", "false", ";", "}", "$", "connection", "=", "$", "this", "->", "implementation", "->", "con...
The connection requirement @return bool TRUE if connection has been established in this time @throws \go\DB\Exceptions\Connect a connect error
[ "The", "connection", "requirement" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Connector.php#L59-L72
190,252
vasa-c/go-db
goDB/Helpers/Connector.php
Connector.close
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 ...
php
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 ...
[ "public", "function", "close", "(", ")", "{", "if", "(", "!", "$", "this", "->", "connection", ")", "{", "return", "false", ";", "}", "$", "this", "->", "countConnections", "--", ";", "if", "(", "$", "this", "->", "countConnections", ">", "0", ")", ...
The closing requirement @return bool TRUE if connection has been closed in this time
[ "The", "closing", "requirement" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Connector.php#L80-L92
190,253
vasa-c/go-db
goDB/Helpers/Connector.php
Connector.deny
protected function deny() { if ($this->connection) { $this->implementation->close($this->connection); $this->connection = null; } $this->countLinks = 0; $this->countConnections = 0; return true; }
php
protected function deny() { if ($this->connection) { $this->implementation->close($this->connection); $this->connection = null; } $this->countLinks = 0; $this->countConnections = 0; return true; }
[ "protected", "function", "deny", "(", ")", "{", "if", "(", "$", "this", "->", "connection", ")", "{", "$", "this", "->", "implementation", "->", "close", "(", "$", "this", "->", "connection", ")", ";", "$", "this", "->", "connection", "=", "null", ";...
Closes all connection
[ "Closes", "all", "connection" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Connector.php#L164-L173
190,254
vasa-c/go-db
goDB/Table.php
Table.insert
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 =...
php
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 =...
[ "public", "function", "insert", "(", "array", "$", "set", ")", "{", "if", "(", "empty", "(", "$", "set", ")", ")", "{", "return", "null", ";", "}", "if", "(", "$", "this", "->", "accum", "!==", "null", ")", "{", "$", "this", "->", "accum", "[",...
Inserts a row to the table @param array $set the data for set (a field => a value) @return int ID of the row
[ "Inserts", "a", "row", "to", "the", "table" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Table.php#L70-L93
190,255
vasa-c/go-db
goDB/Table.php
Table.replace
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 (?l...
php
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 (?l...
[ "public", "function", "replace", "(", "array", "$", "set", ")", "{", "if", "(", "empty", "(", "$", "set", ")", ")", "{", "return", "null", ";", "}", "if", "(", "$", "this", "->", "map", ")", "{", "$", "set", "=", "$", "this", "->", "map", "->...
Replaces or inserts a row @param array $set @return int
[ "Replaces", "or", "inserts", "a", "row" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Table.php#L139-L153
190,256
vasa-c/go-db
goDB/Table.php
Table.select
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;...
php
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;...
[ "public", "function", "select", "(", "$", "cols", "=", "null", ",", "$", "where", "=", "true", ",", "$", "order", "=", "null", ",", "$", "limit", "=", "null", ")", "{", "if", "(", "$", "this", "->", "map", ")", "{", "$", "cols", "=", "$", "th...
Selects rows from the table @param mixed $cols [optional] @param mixed $where [optional] @param mixed $order [optional] @param mixed $limit [optional] @return \go\DB\Result
[ "Selects", "rows", "from", "the", "table" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Table.php#L226-L267
190,257
vasa-c/go-db
goDB/Table.php
Table.delete
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 $t...
php
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 $t...
[ "public", "function", "delete", "(", "$", "where", "=", "null", ")", "{", "if", "(", "$", "this", "->", "map", ")", "{", "$", "where", "=", "$", "this", "->", "map", "->", "where", "(", "$", "where", ")", ";", "}", "if", "(", "$", "this", "->...
Deletes rows from the table @param mixed $where @return int number of affected rows
[ "Deletes", "rows", "from", "the", "table" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Table.php#L276-L287
190,258
vasa-c/go-db
goDB/Table.php
Table.truncate
public function truncate() { if ($this->fake) { return $this->fake->truncate(); } $pattern = 'TRUNCATE TABLE ?t'; $data = array($this->name); $this->db->query($pattern, $data); }
php
public function truncate() { if ($this->fake) { return $this->fake->truncate(); } $pattern = 'TRUNCATE TABLE ?t'; $data = array($this->name); $this->db->query($pattern, $data); }
[ "public", "function", "truncate", "(", ")", "{", "if", "(", "$", "this", "->", "fake", ")", "{", "return", "$", "this", "->", "fake", "->", "truncate", "(", ")", ";", "}", "$", "pattern", "=", "'TRUNCATE TABLE ?t'", ";", "$", "data", "=", "array", ...
Truncates the table
[ "Truncates", "the", "table" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Table.php#L292-L300
190,259
vasa-c/go-db
goDB/Table.php
Table.flushAccumInsert
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->sizeA...
php
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->sizeA...
[ "public", "function", "flushAccumInsert", "(", ")", "{", "if", "(", "$", "this", "->", "accum", "===", "null", ")", "{", "return", "0", ";", "}", "$", "count", "=", "count", "(", "$", "this", "->", "accum", ")", ";", "if", "(", "$", "count", ">",...
Flushes the accumulated queries @return int
[ "Flushes", "the", "accumulated", "queries" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Table.php#L364-L377
190,260
cybercog/laravel-ownership
contracts/Exceptions/InvalidOwnerType.php
InvalidOwnerType.notAllowed
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))); }
php
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))); }
[ "public", "static", "function", "notAllowed", "(", "OwnableContract", "$", "ownable", ",", "CanBeOwnerContract", "$", "owner", ")", "{", "return", "new", "static", "(", "sprintf", "(", "'Model `%s` not allows owner of type `%s`.'", ",", "get_class", "(", "$", "ownab...
Owner of the provided type is not allowed to own this model. @param \Cog\Contracts\Ownership\Ownable $ownable @param \Cog\Contracts\Ownership\CanBeOwner $owner @return static
[ "Owner", "of", "the", "provided", "type", "is", "not", "allowed", "to", "own", "this", "model", "." ]
c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22
https://github.com/cybercog/laravel-ownership/blob/c7c9f3fa67e4f05caa36660198e2bf65d1eeaa22/contracts/Exceptions/InvalidOwnerType.php#L32-L35
190,261
vasa-c/go-db
goDB/Helpers/Templater.php
Templater.parse
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'); ...
php
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'); ...
[ "public", "function", "parse", "(", ")", "{", "if", "(", "$", "this", "->", "query", "!==", "null", ")", "{", "return", "$", "this", "->", "query", ";", "}", "$", "query", "=", "preg_replace_callback", "(", "'~{(.*?)}~'", ",", "array", "(", "$", "thi...
The query templating @return string the result query @throws \go\DB\Exceptions\Templater
[ "The", "query", "templating" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Templater.php#L51-L67
190,262
vasa-c/go-db
goDB/Helpers/Templater.php
Templater.placeholderClb
protected function placeholderClb($matches) { $placeholder = isset($matches[1]) ? $matches[1] : ''; if (isset($matches[3])) { $name = $matches[3]; if (empty($name)) { /* There is a named placeholder without name ("?set:") */ throw new UnknownPl...
php
protected function placeholderClb($matches) { $placeholder = isset($matches[1]) ? $matches[1] : ''; if (isset($matches[3])) { $name = $matches[3]; if (empty($name)) { /* There is a named placeholder without name ("?set:") */ throw new UnknownPl...
[ "protected", "function", "placeholderClb", "(", "$", "matches", ")", "{", "$", "placeholder", "=", "isset", "(", "$", "matches", "[", "1", "]", ")", "?", "$", "matches", "[", "1", "]", ":", "''", ";", "if", "(", "isset", "(", "$", "matches", "[", ...
Replaces a next placeholder in the pattern @param array $matches @return string @throws \go\DB\Exceptions\Templater
[ "Replaces", "a", "next", "placeholder", "in", "the", "pattern" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Templater.php#L97-L139
190,263
vasa-c/go-db
goDB/Helpers/Templater.php
Templater.valueModification
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->impl...
php
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->impl...
[ "private", "function", "valueModification", "(", "$", "value", ",", "array", "$", "modifiers", ")", "{", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "if", "(", "$", "modifiers", "[", "'n'", "]", "||", "Compat", "::", "getOpt", "(", "'type...
Converts a scalar value in conformity with the modifiers list @param mixed $value @param array $modifiers @return string
[ "Converts", "a", "scalar", "value", "in", "conformity", "with", "the", "modifiers", "list" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Helpers/Templater.php#L148-L179
190,264
vasa-c/go-db
goDB/Implementations/Base.php
Base.getImplementationForAdapter
public static function getImplementationForAdapter($adapter) { if (!isset(self::$cacheAdapters[$adapter])) { $classname = __NAMESPACE__.'\\'.ucfirst($adapter); self::$cacheAdapters[$adapter] = new $classname(); } return self::$cacheAdapters[$adapter]; }
php
public static function getImplementationForAdapter($adapter) { if (!isset(self::$cacheAdapters[$adapter])) { $classname = __NAMESPACE__.'\\'.ucfirst($adapter); self::$cacheAdapters[$adapter] = new $classname(); } return self::$cacheAdapters[$adapter]; }
[ "public", "static", "function", "getImplementationForAdapter", "(", "$", "adapter", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "cacheAdapters", "[", "$", "adapter", "]", ")", ")", "{", "$", "classname", "=", "__NAMESPACE__", ".", "'\\\\'", ...
Creates an instance for the specified adapter @param string $adapter @return \go\DB\Implementations\Base
[ "Creates", "an", "instance", "for", "the", "specified", "adapter" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Implementations/Base.php#L59-L66
190,265
vasa-c/go-db
goDB/Implementations/Base.php
Base.checkParams
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[...
php
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[...
[ "public", "function", "checkParams", "(", "array", "$", "params", ",", "&", "$", "error", "=", "null", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "paramsReq", "as", "$", "param", ")", "{", "if", "(", ...
Validates and normalizes connection parameters @param array $params @param string $error @return array normalized parameters or FALSE if parameters is invalid
[ "Validates", "and", "normalizes", "connection", "parameters" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Implementations/Base.php#L107-L125
190,266
vasa-c/go-db
goDB/Implementations/Base.php
Base.fetchObject
public function fetchObject($connection, $cursor) { $result = $this->fetchAssoc($connection, $cursor); return $result ? (object)$result : false; }
php
public function fetchObject($connection, $cursor) { $result = $this->fetchAssoc($connection, $cursor); return $result ? (object)$result : false; }
[ "public", "function", "fetchObject", "(", "$", "connection", ",", "$", "cursor", ")", "{", "$", "result", "=", "$", "this", "->", "fetchAssoc", "(", "$", "connection", ",", "$", "cursor", ")", ";", "return", "$", "result", "?", "(", "object", ")", "$...
Returns a next line as a object @param mixed $connection @param mixed $cursor @return object|false
[ "Returns", "a", "next", "line", "as", "a", "object" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Implementations/Base.php#L222-L226
190,267
vasa-c/go-db
goDB/Implementations/Base.php
Base.reprInt
public function reprInt($connection, $value) { $value = (int)$value; if ($value < 0) { $value = '('.$value.')'; } return $value; }
php
public function reprInt($connection, $value) { $value = (int)$value; if ($value < 0) { $value = '('.$value.')'; } return $value; }
[ "public", "function", "reprInt", "(", "$", "connection", ",", "$", "value", ")", "{", "$", "value", "=", "(", "int", ")", "$", "value", ";", "if", "(", "$", "value", "<", "0", ")", "{", "$", "value", "=", "'('", ".", "$", "value", ".", "')'", ...
Represents a integer number as a data @param mixed $connection @param string $value @return string
[ "Represents", "a", "integer", "number", "as", "a", "data" ]
c65eecde33df27be9252999e74021886710e0ddb
https://github.com/vasa-c/go-db/blob/c65eecde33df27be9252999e74021886710e0ddb/goDB/Implementations/Base.php#L279-L286
190,268
chartmogul/chartmogul-php
src/Service/UpdateTrait.php
UpdateTrait.update
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); }
php
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); }
[ "public", "static", "function", "update", "(", "array", "$", "id", "=", "[", "]", ",", "array", "$", "data", "=", "[", "]", ",", "ClientInterface", "$", "client", "=", "null", ")", "{", "return", "(", "new", "RequestService", "(", "$", "client", ")",...
Update a Resource @param array $data @param ClientInterface|null $client @return self
[ "Update", "a", "Resource" ]
1a2bcdf8b71600aaa4fb2ce40191f289fecc018e
https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Service/UpdateTrait.php#L19-L25
190,269
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withHolder
public function withHolder(Holder $holder): self { $obj = clone $this; $obj->_holder = $holder; return $obj; }
php
public function withHolder(Holder $holder): self { $obj = clone $this; $obj->_holder = $holder; return $obj; }
[ "public", "function", "withHolder", "(", "Holder", "$", "holder", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_holder", "=", "$", "holder", ";", "return", "$", "obj", ";", "}" ]
Get self with holder. @param Holder $holder @return self
[ "Get", "self", "with", "holder", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L157-L162
190,270
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withIssuer
public function withIssuer(AttCertIssuer $issuer): self { $obj = clone $this; $obj->_issuer = $issuer; return $obj; }
php
public function withIssuer(AttCertIssuer $issuer): self { $obj = clone $this; $obj->_issuer = $issuer; return $obj; }
[ "public", "function", "withIssuer", "(", "AttCertIssuer", "$", "issuer", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_issuer", "=", "$", "issuer", ";", "return", "$", "obj", ";", "}" ]
Get self with issuer. @param AttCertIssuer $issuer @return self
[ "Get", "self", "with", "issuer", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L170-L175
190,271
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withSignature
public function withSignature(SignatureAlgorithmIdentifier $algo): self { $obj = clone $this; $obj->_signature = $algo; return $obj; }
php
public function withSignature(SignatureAlgorithmIdentifier $algo): self { $obj = clone $this; $obj->_signature = $algo; return $obj; }
[ "public", "function", "withSignature", "(", "SignatureAlgorithmIdentifier", "$", "algo", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_signature", "=", "$", "algo", ";", "return", "$", "obj", ";", "}" ]
Get self with signature algorithm identifier. @param SignatureAlgorithmIdentifier $algo @return self
[ "Get", "self", "with", "signature", "algorithm", "identifier", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L183-L188
190,272
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withSerialNumber
public function withSerialNumber($serial): self { $obj = clone $this; $obj->_serialNumber = strval($serial); return $obj; }
php
public function withSerialNumber($serial): self { $obj = clone $this; $obj->_serialNumber = strval($serial); return $obj; }
[ "public", "function", "withSerialNumber", "(", "$", "serial", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_serialNumber", "=", "strval", "(", "$", "serial", ")", ";", "return", "$", "obj", ";", "}" ]
Get self with serial number. @param int|string $serial @return self
[ "Get", "self", "with", "serial", "number", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L196-L201
190,273
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withRandomSerialNumber
public function withRandomSerialNumber(int $size = 16): self { // ensure that first byte is always non-zero and having first bit unset $num = gmp_init(mt_rand(1, 0x7f), 10); for ($i = 1; $i < $size; ++$i) { $num <<= 8; $num += mt_rand(0, 0xff); } retur...
php
public function withRandomSerialNumber(int $size = 16): self { // ensure that first byte is always non-zero and having first bit unset $num = gmp_init(mt_rand(1, 0x7f), 10); for ($i = 1; $i < $size; ++$i) { $num <<= 8; $num += mt_rand(0, 0xff); } retur...
[ "public", "function", "withRandomSerialNumber", "(", "int", "$", "size", "=", "16", ")", ":", "self", "{", "// ensure that first byte is always non-zero and having first bit unset", "$", "num", "=", "gmp_init", "(", "mt_rand", "(", "1", ",", "0x7f", ")", ",", "10"...
Get self with random positive serial number. @param int $size Number of random bytes @return self
[ "Get", "self", "with", "random", "positive", "serial", "number", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L209-L218
190,274
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withValidity
public function withValidity(AttCertValidityPeriod $validity): self { $obj = clone $this; $obj->_attrCertValidityPeriod = $validity; return $obj; }
php
public function withValidity(AttCertValidityPeriod $validity): self { $obj = clone $this; $obj->_attrCertValidityPeriod = $validity; return $obj; }
[ "public", "function", "withValidity", "(", "AttCertValidityPeriod", "$", "validity", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_attrCertValidityPeriod", "=", "$", "validity", ";", "return", "$", "obj", ";", "}" ]
Get self with validity period. @param AttCertValidityPeriod $validity @return self
[ "Get", "self", "with", "validity", "period", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L226-L231
190,275
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withAttributes
public function withAttributes(Attributes $attribs): self { $obj = clone $this; $obj->_attributes = $attribs; return $obj; }
php
public function withAttributes(Attributes $attribs): self { $obj = clone $this; $obj->_attributes = $attribs; return $obj; }
[ "public", "function", "withAttributes", "(", "Attributes", "$", "attribs", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_attributes", "=", "$", "attribs", ";", "return", "$", "obj", ";", "}" ]
Get self with attributes. @param Attributes $attribs @return self
[ "Get", "self", "with", "attributes", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L239-L244
190,276
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withIssuerUniqueID
public function withIssuerUniqueID(UniqueIdentifier $uid): self { $obj = clone $this; $obj->_issuerUniqueID = $uid; return $obj; }
php
public function withIssuerUniqueID(UniqueIdentifier $uid): self { $obj = clone $this; $obj->_issuerUniqueID = $uid; return $obj; }
[ "public", "function", "withIssuerUniqueID", "(", "UniqueIdentifier", "$", "uid", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_issuerUniqueID", "=", "$", "uid", ";", "return", "$", "obj", ";", "}" ]
Get self with issuer unique identifier. @param UniqueIdentifier $uid @return self
[ "Get", "self", "with", "issuer", "unique", "identifier", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L252-L257
190,277
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.withExtensions
public function withExtensions(Extensions $extensions): self { $obj = clone $this; $obj->_extensions = $extensions; return $obj; }
php
public function withExtensions(Extensions $extensions): self { $obj = clone $this; $obj->_extensions = $extensions; return $obj; }
[ "public", "function", "withExtensions", "(", "Extensions", "$", "extensions", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_extensions", "=", "$", "extensions", ";", "return", "$", "obj", ";", "}" ]
Get self with extensions. @param Extensions $extensions @return self
[ "Get", "self", "with", "extensions", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L265-L270
190,278
sop/x509
lib/X509/AttributeCertificate/AttributeCertificateInfo.php
AttributeCertificateInfo.sign
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"; } ...
php
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"; } ...
[ "public", "function", "sign", "(", "SignatureAlgorithmIdentifier", "$", "algo", ",", "PrivateKeyInfo", "$", "privkey_info", ",", "Crypto", "$", "crypto", "=", "null", ")", ":", "AttributeCertificate", "{", "$", "crypto", "=", "$", "crypto", "?", ":", "Crypto",...
Create signed attribute certificate. @param SignatureAlgorithmIdentifier $algo Signature algorithm @param PrivateKeyInfo $privkey_info Private key @param Crypto|null $crypto Crypto engine, use default if not set @return AttributeCertificate
[ "Create", "signed", "attribute", "certificate", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificateInfo.php#L443-L455
190,279
sop/x509
lib/X509/Certificate/Extension/UnknownExtension.php
UnknownExtension.fromRawString
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; }
php
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; }
[ "public", "static", "function", "fromRawString", "(", "string", "$", "oid", ",", "bool", "$", "critical", ",", "string", "$", "data", ")", ":", "self", "{", "$", "obj", "=", "new", "self", "(", "$", "oid", ",", "$", "critical", ",", "new", "OctetStri...
Create instance from a raw encoded extension value. @param string $oid @param bool $critical @param string $data @return self
[ "Create", "instance", "from", "a", "raw", "encoded", "extension", "value", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/UnknownExtension.php#L50-L57
190,280
sop/x509
lib/X509/Certificate/Extension/Target/Targets.php
Targets._allOfType
protected function _allOfType(int $type): array { return array_values( array_filter($this->_targets, function (Target $target) use ($type) { return $target->type() == $type; })); }
php
protected function _allOfType(int $type): array { return array_values( array_filter($this->_targets, function (Target $target) use ($type) { return $target->type() == $type; })); }
[ "protected", "function", "_allOfType", "(", "int", "$", "type", ")", ":", "array", "{", "return", "array_values", "(", "array_filter", "(", "$", "this", "->", "_targets", ",", "function", "(", "Target", "$", "target", ")", "use", "(", "$", "type", ")", ...
Get all targets of given type. @param int $type @return Target[]
[ "Get", "all", "targets", "of", "given", "type", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/Target/Targets.php#L65-L72
190,281
sop/x509
lib/X509/Certificate/Extension/Target/Targets.php
Targets.hasTarget
public function hasTarget(Target $target): bool { foreach ($this->_allOfType($target->type()) as $t) { if ($target->equals($t)) { return true; } } return false; }
php
public function hasTarget(Target $target): bool { foreach ($this->_allOfType($target->type()) as $t) { if ($target->equals($t)) { return true; } } return false; }
[ "public", "function", "hasTarget", "(", "Target", "$", "target", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "_allOfType", "(", "$", "target", "->", "type", "(", ")", ")", "as", "$", "t", ")", "{", "if", "(", "$", "target", "->", "e...
Check whether given target is present. @param Target $target @return boolean
[ "Check", "whether", "given", "target", "is", "present", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/Target/Targets.php#L100-L108
190,282
phpsec/phpSec
lib/phpSec/Core.php
Core.genUid
public function genUid() { $rand = $this['crypt/rand']; $hex = bin2hex($rand->Bytes(32)); $str = substr($hex,0,16) . '-' . substr($hex,16,8) . '-' . substr($hex,24,8) . '-' . substr($hex,32,8) . '-' . substr($hex,40,24); return $str; }
php
public function genUid() { $rand = $this['crypt/rand']; $hex = bin2hex($rand->Bytes(32)); $str = substr($hex,0,16) . '-' . substr($hex,16,8) . '-' . substr($hex,24,8) . '-' . substr($hex,32,8) . '-' . substr($hex,40,24); return $str; }
[ "public", "function", "genUid", "(", ")", "{", "$", "rand", "=", "$", "this", "[", "'crypt/rand'", "]", ";", "$", "hex", "=", "bin2hex", "(", "$", "rand", "->", "Bytes", "(", "32", ")", ")", ";", "$", "str", "=", "substr", "(", "$", "hex", ",",...
Returns a unique identifier. @return string Returns a unique identifier.
[ "Returns", "a", "unique", "identifier", "." ]
653e9cada38ae7f6debc3cce0d3a17402c715588
https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Core.php#L189-L195
190,283
phpsec/phpSec
lib/phpSec/Crypt/Rand.php
Rand.bytes
public function bytes($len) { /* Code inspired by this blogpost by Enrico Zimuel * http://www.zimuel.it/en/strong-cryptography-in-php/ */ $strong = false; if(function_exists('openssl_random_pseudo_bytes')) { $rnd = openssl_random_pseudo_bytes($len, $strong); if($strong === true) { r...
php
public function bytes($len) { /* Code inspired by this blogpost by Enrico Zimuel * http://www.zimuel.it/en/strong-cryptography-in-php/ */ $strong = false; if(function_exists('openssl_random_pseudo_bytes')) { $rnd = openssl_random_pseudo_bytes($len, $strong); if($strong === true) { r...
[ "public", "function", "bytes", "(", "$", "len", ")", "{", "/* Code inspired by this blogpost by Enrico Zimuel\n * http://www.zimuel.it/en/strong-cryptography-in-php/ */", "$", "strong", "=", "false", ";", "if", "(", "function_exists", "(", "'openssl_random_pseudo_bytes'", "...
Generate pseudorandom bytes. @param integer $len @return binary
[ "Generate", "pseudorandom", "bytes", "." ]
653e9cada38ae7f6debc3cce0d3a17402c715588
https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Rand.php#L25-L52
190,284
phpsec/phpSec
lib/phpSec/Crypt/Rand.php
Rand.arrayRand
public function arrayRand($array, $num = 1) { $keys = array_keys($array); $numKeys = sizeof($keys); if($num == 1) { return $keys[$this->int(0, $numKeys-1)]; } for($i=0; $i < $num; $i++) { $picked[] = $keys[$this->int(0, $numKeys-1)]; } return $picked; }
php
public function arrayRand($array, $num = 1) { $keys = array_keys($array); $numKeys = sizeof($keys); if($num == 1) { return $keys[$this->int(0, $numKeys-1)]; } for($i=0; $i < $num; $i++) { $picked[] = $keys[$this->int(0, $numKeys-1)]; } return $picked; }
[ "public", "function", "arrayRand", "(", "$", "array", ",", "$", "num", "=", "1", ")", "{", "$", "keys", "=", "array_keys", "(", "$", "array", ")", ";", "$", "numKeys", "=", "sizeof", "(", "$", "keys", ")", ";", "if", "(", "$", "num", "==", "1",...
Return one or more random random keys from an array. @param array $array Input array. @param integer $num Number of keys to pick. @return mixed String with the key, or array containing multiple keys.
[ "Return", "one", "or", "more", "random", "random", "keys", "from", "an", "array", "." ]
653e9cada38ae7f6debc3cce0d3a17402c715588
https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Rand.php#L115-L126
190,285
sop/x509
lib/X509/CertificationRequest/CertificationRequestInfo.php
CertificationRequestInfo.withSubject
public function withSubject(Name $subject): self { $obj = clone $this; $obj->_subject = $subject; return $obj; }
php
public function withSubject(Name $subject): self { $obj = clone $this; $obj->_subject = $subject; return $obj; }
[ "public", "function", "withSubject", "(", "Name", "$", "subject", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_subject", "=", "$", "subject", ";", "return", "$", "obj", ";", "}" ]
Get self with subject. @param Name $subject @return self
[ "Get", "self", "with", "subject", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationRequest/CertificationRequestInfo.php#L114-L119
190,286
sop/x509
lib/X509/CertificationRequest/CertificationRequestInfo.php
CertificationRequestInfo.withExtensionRequest
public function withExtensionRequest(Extensions $extensions): self { $obj = clone $this; if (!isset($obj->_attributes)) { $obj->_attributes = new Attributes(); } $obj->_attributes = $obj->_attributes->withUnique( Attribute::fromAttributeValues( ...
php
public function withExtensionRequest(Extensions $extensions): self { $obj = clone $this; if (!isset($obj->_attributes)) { $obj->_attributes = new Attributes(); } $obj->_attributes = $obj->_attributes->withUnique( Attribute::fromAttributeValues( ...
[ "public", "function", "withExtensionRequest", "(", "Extensions", "$", "extensions", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "if", "(", "!", "isset", "(", "$", "obj", "->", "_attributes", ")", ")", "{", "$", "obj", "->", "_a...
Get self with extension request attribute. @param Extensions $extensions Extensions to request @return self
[ "Get", "self", "with", "extension", "request", "attribute", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationRequest/CertificationRequestInfo.php#L183-L193
190,287
sop/x509
lib/X509/CertificationRequest/CertificationRequestInfo.php
CertificationRequestInfo.sign
public function sign(SignatureAlgorithmIdentifier $algo, PrivateKeyInfo $privkey_info, Crypto $crypto = null): CertificationRequest { $crypto = $crypto ?: Crypto::getDefault(); $data = $this->toASN1()->toDER(); $signature = $crypto->sign($data, $privkey_info, $algo); return n...
php
public function sign(SignatureAlgorithmIdentifier $algo, PrivateKeyInfo $privkey_info, Crypto $crypto = null): CertificationRequest { $crypto = $crypto ?: Crypto::getDefault(); $data = $this->toASN1()->toDER(); $signature = $crypto->sign($data, $privkey_info, $algo); return n...
[ "public", "function", "sign", "(", "SignatureAlgorithmIdentifier", "$", "algo", ",", "PrivateKeyInfo", "$", "privkey_info", ",", "Crypto", "$", "crypto", "=", "null", ")", ":", "CertificationRequest", "{", "$", "crypto", "=", "$", "crypto", "?", ":", "Crypto",...
Create signed CertificationRequest. @param SignatureAlgorithmIdentifier $algo Algorithm used for signing @param PrivateKeyInfo $privkey_info Private key used for signing @param Crypto|null $crypto Crypto engine, use default if not set @return CertificationRequest
[ "Create", "signed", "CertificationRequest", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationRequest/CertificationRequestInfo.php#L219-L226
190,288
sop/x509
lib/X509/AttributeCertificate/Attributes.php
Attributes.fromAttributeValues
public static function fromAttributeValues(AttributeValue ...$values): self { $attribs = array_map( function (AttributeValue $value) { return $value->toAttribute(); }, $values); return new self(...$attribs); }
php
public static function fromAttributeValues(AttributeValue ...$values): self { $attribs = array_map( function (AttributeValue $value) { return $value->toAttribute(); }, $values); return new self(...$attribs); }
[ "public", "static", "function", "fromAttributeValues", "(", "AttributeValue", "...", "$", "values", ")", ":", "self", "{", "$", "attribs", "=", "array_map", "(", "function", "(", "AttributeValue", "$", "value", ")", "{", "return", "$", "value", "->", "toAttr...
Initialize from attribute values. @param AttributeValue ...$values @return self
[ "Initialize", "from", "attribute", "values", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Attributes.php#L64-L71
190,289
sop/x509
lib/X509/AttributeCertificate/Attributes.php
Attributes.roles
public function roles(): array { return array_merge(array(), ...array_map( function (Attribute $attr) { return $attr->values(); }, $this->allOf(AttributeType::OID_ROLE))); }
php
public function roles(): array { return array_merge(array(), ...array_map( function (Attribute $attr) { return $attr->values(); }, $this->allOf(AttributeType::OID_ROLE))); }
[ "public", "function", "roles", "(", ")", ":", "array", "{", "return", "array_merge", "(", "array", "(", ")", ",", "...", "array_map", "(", "function", "(", "Attribute", "$", "attr", ")", "{", "return", "$", "attr", "->", "values", "(", ")", ";", "}",...
Get all 'Role' attribute values. @return RoleAttributeValue[]
[ "Get", "all", "Role", "attribute", "values", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Attributes.php#L203-L210
190,290
sop/x509
lib/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php
IetfAttrSyntax.withPolicyAuthority
public function withPolicyAuthority(GeneralNames $names): self { $obj = clone $this; $obj->_policyAuthority = $names; return $obj; }
php
public function withPolicyAuthority(GeneralNames $names): self { $obj = clone $this; $obj->_policyAuthority = $names; return $obj; }
[ "public", "function", "withPolicyAuthority", "(", "GeneralNames", "$", "names", ")", ":", "self", "{", "$", "obj", "=", "clone", "$", "this", ";", "$", "obj", "->", "_policyAuthority", "=", "$", "names", ";", "return", "$", "obj", ";", "}" ]
Get self with policy authority. @param GeneralNames $names @return self
[ "Get", "self", "with", "policy", "authority", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php#L85-L90
190,291
sop/x509
lib/X509/AttributeCertificate/AttributeCertificate.php
AttributeCertificate.isHeldBy
public function isHeldBy(Certificate $cert): bool { if (!$this->_acinfo->holder()->identifiesPKC($cert)) { return false; } return true; }
php
public function isHeldBy(Certificate $cert): bool { if (!$this->_acinfo->holder()->identifiesPKC($cert)) { return false; } return true; }
[ "public", "function", "isHeldBy", "(", "Certificate", "$", "cert", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "_acinfo", "->", "holder", "(", ")", "->", "identifiesPKC", "(", "$", "cert", ")", ")", "{", "return", "false", ";", "}", "...
Check whether attribute certificate is issued to the subject identified by given public key certificate. @param Certificate $cert Certificate @return boolean
[ "Check", "whether", "attribute", "certificate", "is", "issued", "to", "the", "subject", "identified", "by", "given", "public", "key", "certificate", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificate.php#L176-L182
190,292
sop/x509
lib/X509/AttributeCertificate/AttributeCertificate.php
AttributeCertificate.isIssuedBy
public function isIssuedBy(Certificate $cert): bool { if (!$this->_acinfo->issuer()->identifiesPKC($cert)) { return false; } return true; }
php
public function isIssuedBy(Certificate $cert): bool { if (!$this->_acinfo->issuer()->identifiesPKC($cert)) { return false; } return true; }
[ "public", "function", "isIssuedBy", "(", "Certificate", "$", "cert", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "_acinfo", "->", "issuer", "(", ")", "->", "identifiesPKC", "(", "$", "cert", ")", ")", "{", "return", "false", ";", "}", ...
Check whether attribute certificate is issued by given public key certificate. @param Certificate $cert Certificate @return boolean
[ "Check", "whether", "attribute", "certificate", "is", "issued", "by", "given", "public", "key", "certificate", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/AttributeCertificate.php#L191-L197
190,293
sop/x509
lib/X509/AttributeCertificate/Attribute/RoleAttributeValue.php
RoleAttributeValue.fromString
public static function fromString(string $role_name, GeneralNames $authority = null): self { return new self(new UniformResourceIdentifier($role_name), $authority); }
php
public static function fromString(string $role_name, GeneralNames $authority = null): self { return new self(new UniformResourceIdentifier($role_name), $authority); }
[ "public", "static", "function", "fromString", "(", "string", "$", "role_name", ",", "GeneralNames", "$", "authority", "=", "null", ")", ":", "self", "{", "return", "new", "self", "(", "new", "UniformResourceIdentifier", "(", "$", "role_name", ")", ",", "$", ...
Initialize from a role string. @param string $role_name Role name in URI format @param GeneralNames|null $authority Issuing authority @return self
[ "Initialize", "from", "a", "role", "string", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Attribute/RoleAttributeValue.php#L60-L64
190,294
sop/x509
lib/X509/AttributeCertificate/Validation/ACValidator.php
ACValidator.validate
public function validate(): AttributeCertificate { $this->_validateHolder(); $issuer = $this->_verifyIssuer(); $this->_validateIssuerProfile($issuer); $this->_validateTime(); $this->_validateTargeting(); return $this->_ac; }
php
public function validate(): AttributeCertificate { $this->_validateHolder(); $issuer = $this->_verifyIssuer(); $this->_validateIssuerProfile($issuer); $this->_validateTime(); $this->_validateTargeting(); return $this->_ac; }
[ "public", "function", "validate", "(", ")", ":", "AttributeCertificate", "{", "$", "this", "->", "_validateHolder", "(", ")", ";", "$", "issuer", "=", "$", "this", "->", "_verifyIssuer", "(", ")", ";", "$", "this", "->", "_validateIssuerProfile", "(", "$",...
Validate attribute certificate. @throws ACValidationException If validation fails @return AttributeCertificate Validated AC
[ "Validate", "attribute", "certificate", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L66-L74
190,295
sop/x509
lib/X509/AttributeCertificate/Validation/ACValidator.php
ACValidator._validateHolder
private function _validateHolder(): Certificate { $path = $this->_config->holderPath(); $config = PathValidationConfig::defaultConfig()->withMaxLength( count($path))->withDateTime($this->_config->evaluationTime()); try { $holder = $path->validate($config, $this->_cryp...
php
private function _validateHolder(): Certificate { $path = $this->_config->holderPath(); $config = PathValidationConfig::defaultConfig()->withMaxLength( count($path))->withDateTime($this->_config->evaluationTime()); try { $holder = $path->validate($config, $this->_cryp...
[ "private", "function", "_validateHolder", "(", ")", ":", "Certificate", "{", "$", "path", "=", "$", "this", "->", "_config", "->", "holderPath", "(", ")", ";", "$", "config", "=", "PathValidationConfig", "::", "defaultConfig", "(", ")", "->", "withMaxLength"...
Validate AC holder's certification. @throws ACValidationException @return Certificate Certificate of the AC's holder
[ "Validate", "AC", "holder", "s", "certification", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L82-L97
190,296
sop/x509
lib/X509/AttributeCertificate/Validation/ACValidator.php
ACValidator._verifyIssuer
private function _verifyIssuer(): Certificate { $path = $this->_config->issuerPath(); $config = PathValidationConfig::defaultConfig()->withMaxLength( count($path))->withDateTime($this->_config->evaluationTime()); try { $issuer = $path->validate($config, $this->_crypto...
php
private function _verifyIssuer(): Certificate { $path = $this->_config->issuerPath(); $config = PathValidationConfig::defaultConfig()->withMaxLength( count($path))->withDateTime($this->_config->evaluationTime()); try { $issuer = $path->validate($config, $this->_crypto...
[ "private", "function", "_verifyIssuer", "(", ")", ":", "Certificate", "{", "$", "path", "=", "$", "this", "->", "_config", "->", "issuerPath", "(", ")", ";", "$", "config", "=", "PathValidationConfig", "::", "defaultConfig", "(", ")", "->", "withMaxLength", ...
Verify AC's signature and issuer's certification. @throws ACValidationException @return Certificate Certificate of the AC's issuer
[ "Verify", "AC", "s", "signature", "and", "issuer", "s", "certification", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L105-L124
190,297
sop/x509
lib/X509/AttributeCertificate/Validation/ACValidator.php
ACValidator._validateIssuerProfile
private function _validateIssuerProfile(Certificate $cert) { $exts = $cert->tbsCertificate()->extensions(); if ($exts->hasKeyUsage() && !$exts->keyUsage()->isDigitalSignature()) { throw new ACValidationException( "Issuer PKC's Key Usage extension doesn't permit" . ...
php
private function _validateIssuerProfile(Certificate $cert) { $exts = $cert->tbsCertificate()->extensions(); if ($exts->hasKeyUsage() && !$exts->keyUsage()->isDigitalSignature()) { throw new ACValidationException( "Issuer PKC's Key Usage extension doesn't permit" . ...
[ "private", "function", "_validateIssuerProfile", "(", "Certificate", "$", "cert", ")", "{", "$", "exts", "=", "$", "cert", "->", "tbsCertificate", "(", ")", "->", "extensions", "(", ")", ";", "if", "(", "$", "exts", "->", "hasKeyUsage", "(", ")", "&&", ...
Validate AC issuer's profile. @link https://tools.ietf.org/html/rfc5755#section-4.5 @param Certificate $cert @throws ACValidationException
[ "Validate", "AC", "issuer", "s", "profile", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L133-L144
190,298
sop/x509
lib/X509/AttributeCertificate/Validation/ACValidator.php
ACValidator._validateTime
private function _validateTime() { $t = $this->_config->evaluationTime(); $validity = $this->_ac->acinfo()->validityPeriod(); if ($validity->notBeforeTime()->diff($t)->invert) { throw new ACValidationException("Validity period has not started."); } if ($t->diff($v...
php
private function _validateTime() { $t = $this->_config->evaluationTime(); $validity = $this->_ac->acinfo()->validityPeriod(); if ($validity->notBeforeTime()->diff($t)->invert) { throw new ACValidationException("Validity period has not started."); } if ($t->diff($v...
[ "private", "function", "_validateTime", "(", ")", "{", "$", "t", "=", "$", "this", "->", "_config", "->", "evaluationTime", "(", ")", ";", "$", "validity", "=", "$", "this", "->", "_ac", "->", "acinfo", "(", ")", "->", "validityPeriod", "(", ")", ";"...
Validate AC's validity period. @throws ACValidationException
[ "Validate", "AC", "s", "validity", "period", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L151-L161
190,299
sop/x509
lib/X509/AttributeCertificate/Validation/ACValidator.php
ACValidator._validateTargeting
private function _validateTargeting() { $exts = $this->_ac->acinfo()->extensions(); // if target information extension is not present if (!$exts->has(Extension::OID_TARGET_INFORMATION)) { return; } $ext = $exts->get(Extension::OID_TARGET_INFORMATION); if (...
php
private function _validateTargeting() { $exts = $this->_ac->acinfo()->extensions(); // if target information extension is not present if (!$exts->has(Extension::OID_TARGET_INFORMATION)) { return; } $ext = $exts->get(Extension::OID_TARGET_INFORMATION); if (...
[ "private", "function", "_validateTargeting", "(", ")", "{", "$", "exts", "=", "$", "this", "->", "_ac", "->", "acinfo", "(", ")", "->", "extensions", "(", ")", ";", "// if target information extension is not present", "if", "(", "!", "$", "exts", "->", "has"...
Validate AC's target information. @throws ACValidationException
[ "Validate", "AC", "s", "target", "information", "." ]
405cf31f253225b45f0868c5ea4ef2e1a7b75f87
https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L168-L181