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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
189,000 | delatbabel/elocryptfive | src/Elocrypt.php | Elocrypt.doEncryptAttribute | protected function doEncryptAttribute($key)
{
if ($this->shouldEncrypt($key) && ! $this->isEncrypted($this->attributes[$key])) {
try {
$this->attributes[$key] = $this->encryptedAttribute($this->attributes[$key]);
} catch (EncryptException $e) {
}
}... | php | protected function doEncryptAttribute($key)
{
if ($this->shouldEncrypt($key) && ! $this->isEncrypted($this->attributes[$key])) {
try {
$this->attributes[$key] = $this->encryptedAttribute($this->attributes[$key]);
} catch (EncryptException $e) {
}
}... | [
"protected",
"function",
"doEncryptAttribute",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldEncrypt",
"(",
"$",
"key",
")",
"&&",
"!",
"$",
"this",
"->",
"isEncrypted",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"key",
"]",
")... | Encrypt a stored attribute.
@param string $key
@return void | [
"Encrypt",
"a",
"stored",
"attribute",
"."
] | 5ff5b7a7f38a881596f60f064a9883ecc3942c37 | https://github.com/delatbabel/elocryptfive/blob/5ff5b7a7f38a881596f60f064a9883ecc3942c37/src/Elocrypt.php#L141-L149 |
189,001 | delatbabel/elocryptfive | src/Elocrypt.php | Elocrypt.doDecryptAttribute | protected function doDecryptAttribute($key, $value)
{
if ($this->shouldEncrypt($key) && $this->isEncrypted($value)) {
try {
return $this->decryptedAttribute($value);
} catch (DecryptException $e) {
}
}
return $value;
} | php | protected function doDecryptAttribute($key, $value)
{
if ($this->shouldEncrypt($key) && $this->isEncrypted($value)) {
try {
return $this->decryptedAttribute($value);
} catch (DecryptException $e) {
}
}
return $value;
} | [
"protected",
"function",
"doDecryptAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldEncrypt",
"(",
"$",
"key",
")",
"&&",
"$",
"this",
"->",
"isEncrypted",
"(",
"$",
"value",
")",
")",
"{",
"try",
"{",
... | Decrypt an attribute if required.
@param string $key
@param mixed $value
@return mixed | [
"Decrypt",
"an",
"attribute",
"if",
"required",
"."
] | 5ff5b7a7f38a881596f60f064a9883ecc3942c37 | https://github.com/delatbabel/elocryptfive/blob/5ff5b7a7f38a881596f60f064a9883ecc3942c37/src/Elocrypt.php#L159-L169 |
189,002 | delatbabel/elocryptfive | src/Elocrypt.php | Elocrypt.doDecryptAttributes | public function doDecryptAttributes($attributes)
{
foreach ($attributes as $key => $value) {
$attributes[$key] = $this->doDecryptAttribute($key, $value);
}
return $attributes;
} | php | public function doDecryptAttributes($attributes)
{
foreach ($attributes as $key => $value) {
$attributes[$key] = $this->doDecryptAttribute($key, $value);
}
return $attributes;
} | [
"public",
"function",
"doDecryptAttributes",
"(",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"attributes",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"doDecryptAttribute",
"(",
... | Decrypt each attribute in the array as required.
@param array $attributes
@return array | [
"Decrypt",
"each",
"attribute",
"in",
"the",
"array",
"as",
"required",
"."
] | 5ff5b7a7f38a881596f60f064a9883ecc3942c37 | https://github.com/delatbabel/elocryptfive/blob/5ff5b7a7f38a881596f60f064a9883ecc3942c37/src/Elocrypt.php#L178-L185 |
189,003 | JDare/ClankBundle | Event/AcmeClientEventListener.php | AcmeClientEventListener.onClientError | public function onClientError(ClientErrorEvent $event)
{
$conn = $event->getConnection();
$e = $event->getException();
echo "connection error occurred: " . $e->getMessage() . PHP_EOL;
} | php | public function onClientError(ClientErrorEvent $event)
{
$conn = $event->getConnection();
$e = $event->getException();
echo "connection error occurred: " . $e->getMessage() . PHP_EOL;
} | [
"public",
"function",
"onClientError",
"(",
"ClientErrorEvent",
"$",
"event",
")",
"{",
"$",
"conn",
"=",
"$",
"event",
"->",
"getConnection",
"(",
")",
";",
"$",
"e",
"=",
"$",
"event",
"->",
"getException",
"(",
")",
";",
"echo",
"\"connection error occu... | Called whenever a client errors
@param ClientErrorEvent $event | [
"Called",
"whenever",
"a",
"client",
"errors"
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Event/AcmeClientEventListener.php#L37-L43 |
189,004 | JDare/ClankBundle | Server/Type/WebSocketServerType.php | WebSocketServerType.setupServer | private function setupServer()
{
$this->setupApp();
/** @var $loop \React\EventLoop\LoopInterface */
$this->loop = \React\EventLoop\Factory::create();
$this->socket = new \React\Socket\Server($this->loop);
if ($this->host)
{
$this->socket->list... | php | private function setupServer()
{
$this->setupApp();
/** @var $loop \React\EventLoop\LoopInterface */
$this->loop = \React\EventLoop\Factory::create();
$this->socket = new \React\Socket\Server($this->loop);
if ($this->host)
{
$this->socket->list... | [
"private",
"function",
"setupServer",
"(",
")",
"{",
"$",
"this",
"->",
"setupApp",
"(",
")",
";",
"/** @var $loop \\React\\EventLoop\\LoopInterface */",
"$",
"this",
"->",
"loop",
"=",
"\\",
"React",
"\\",
"EventLoop",
"\\",
"Factory",
"::",
"create",
"(",
")... | Sets up loop and server manually to allow periodic timer calls. | [
"Sets",
"up",
"loop",
"and",
"server",
"manually",
"to",
"allow",
"periodic",
"timer",
"calls",
"."
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Server/Type/WebSocketServerType.php#L42-L62 |
189,005 | JDare/ClankBundle | Server/Type/WebSocketServerType.php | WebSocketServerType.setupApp | private function setupApp()
{
if ($this->session instanceof \SessionHandlerInterface)
{
$serverStack = new SessionProvider(
new WampServer(
$this->getContainer()->get("jdare_clank.clank_app")
),
$this->session
... | php | private function setupApp()
{
if ($this->session instanceof \SessionHandlerInterface)
{
$serverStack = new SessionProvider(
new WampServer(
$this->getContainer()->get("jdare_clank.clank_app")
),
$this->session
... | [
"private",
"function",
"setupApp",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"session",
"instanceof",
"\\",
"SessionHandlerInterface",
")",
"{",
"$",
"serverStack",
"=",
"new",
"SessionProvider",
"(",
"new",
"WampServer",
"(",
"$",
"this",
"->",
"getConta... | Sets up clank app to bootstrap Ratchet and handle socket requests | [
"Sets",
"up",
"clank",
"app",
"to",
"bootstrap",
"Ratchet",
"and",
"handle",
"socket",
"requests"
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Server/Type/WebSocketServerType.php#L80-L101 |
189,006 | JDare/ClankBundle | Topic/AcmeTopic.php | AcmeTopic.onSubscribe | public function onSubscribe(Conn $conn, $topic)
{
$topic->broadcast($conn->resourceId . " has joined " . $topic->getId());
} | php | public function onSubscribe(Conn $conn, $topic)
{
$topic->broadcast($conn->resourceId . " has joined " . $topic->getId());
} | [
"public",
"function",
"onSubscribe",
"(",
"Conn",
"$",
"conn",
",",
"$",
"topic",
")",
"{",
"$",
"topic",
"->",
"broadcast",
"(",
"$",
"conn",
"->",
"resourceId",
".",
"\" has joined \"",
".",
"$",
"topic",
"->",
"getId",
"(",
")",
")",
";",
"}"
] | This will receive any Subscription requests for this exact topic.
@param \Ratchet\ConnectionInterface $conn
@param $topic
@return mixed|void | [
"This",
"will",
"receive",
"any",
"Subscription",
"requests",
"for",
"this",
"exact",
"topic",
"."
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Topic/AcmeTopic.php#L19-L22 |
189,007 | JDare/ClankBundle | Topic/AcmeTopic.php | AcmeTopic.onUnSubscribe | public function onUnSubscribe(Conn $conn, $topic)
{
$topic->broadcast($conn->resourceId . " has left " . $topic->getId());
} | php | public function onUnSubscribe(Conn $conn, $topic)
{
$topic->broadcast($conn->resourceId . " has left " . $topic->getId());
} | [
"public",
"function",
"onUnSubscribe",
"(",
"Conn",
"$",
"conn",
",",
"$",
"topic",
")",
"{",
"$",
"topic",
"->",
"broadcast",
"(",
"$",
"conn",
"->",
"resourceId",
".",
"\" has left \"",
".",
"$",
"topic",
"->",
"getId",
"(",
")",
")",
";",
"}"
] | This will receive any UnSubscription requests for this exact topic.
@param \Ratchet\ConnectionInterface $conn
@param $topic
@return mixed|void | [
"This",
"will",
"receive",
"any",
"UnSubscription",
"requests",
"for",
"this",
"exact",
"topic",
"."
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Topic/AcmeTopic.php#L31-L34 |
189,008 | JDare/ClankBundle | Topic/AcmeTopic.php | AcmeTopic.onPublish | public function onPublish(Conn $conn, $topic, $event, array $exclude, array $eligible)
{
/*
* $topic contains the FULL uri, so if anything extra was added to that, you can find out the full path based on that.
*/
$topic->broadcast(array(
"sender" => $conn->resourceId,
... | php | public function onPublish(Conn $conn, $topic, $event, array $exclude, array $eligible)
{
/*
* $topic contains the FULL uri, so if anything extra was added to that, you can find out the full path based on that.
*/
$topic->broadcast(array(
"sender" => $conn->resourceId,
... | [
"public",
"function",
"onPublish",
"(",
"Conn",
"$",
"conn",
",",
"$",
"topic",
",",
"$",
"event",
",",
"array",
"$",
"exclude",
",",
"array",
"$",
"eligible",
")",
"{",
"/*\n * $topic contains the FULL uri, so if anything extra was added to that, you can find o... | This will receive any Publish requests for this exact topic.
@param \Ratchet\ConnectionInterface $conn
@param $topic
@param $event
@param array $exclude
@param array $eligible
@return mixed|void | [
"This",
"will",
"receive",
"any",
"Publish",
"requests",
"for",
"this",
"exact",
"topic",
"."
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Topic/AcmeTopic.php#L47-L58 |
189,009 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.login | public static function login($ck, $cs, $username, $password, $proxy = '') {
$to = new self($ck, $cs);
$username = self::validateString('$username', $username);
$password = self::validateString('$password', $password);
$proxy = self::validateString('$proxy', $proxy);
$ch =... | php | public static function login($ck, $cs, $username, $password, $proxy = '') {
$to = new self($ck, $cs);
$username = self::validateString('$username', $username);
$password = self::validateString('$password', $password);
$proxy = self::validateString('$proxy', $proxy);
$ch =... | [
"public",
"static",
"function",
"login",
"(",
"$",
"ck",
",",
"$",
"cs",
",",
"$",
"username",
",",
"$",
"password",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"to",
"=",
"new",
"self",
"(",
"$",
"ck",
",",
"$",
"cs",
")",
";",
"$",
"userna... | Execute direct OAuth login.
@param string $ck consumer_key.
@param string $cs consumer_secret.
@param string $username screen_name or email.
@param string $password
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return TwistOAuth
@throws TwistException | [
"Execute",
"direct",
"OAuth",
"login",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L55-L67 |
189,010 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.getAuthenticateUrl | public function getAuthenticateUrl($force_login = false) {
$params = http_build_query(array(
'oauth_token' => $this->ot,
'force_login' => $force_login ? 1 : null,
), '', '&');
return 'https://api.twitter.com/oauth/authenticate?' . $params;
} | php | public function getAuthenticateUrl($force_login = false) {
$params = http_build_query(array(
'oauth_token' => $this->ot,
'force_login' => $force_login ? 1 : null,
), '', '&');
return 'https://api.twitter.com/oauth/authenticate?' . $params;
} | [
"public",
"function",
"getAuthenticateUrl",
"(",
"$",
"force_login",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"http_build_query",
"(",
"array",
"(",
"'oauth_token'",
"=>",
"$",
"this",
"->",
"ot",
",",
"'force_login'",
"=>",
"$",
"force_login",
"?",
"1",
... | Get URL for authentication.
@param bool [$force_login]
@return string URL | [
"Get",
"URL",
"for",
"authentication",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L316-L322 |
189,011 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.getAuthorizeUrl | public function getAuthorizeUrl($force_login = false) {
$params = http_build_query(array(
'oauth_token' => $this->ot,
'force_login' => $force_login ? 1 : null,
), '', '&');
return 'https://api.twitter.com/oauth/authorize?' . $params;
} | php | public function getAuthorizeUrl($force_login = false) {
$params = http_build_query(array(
'oauth_token' => $this->ot,
'force_login' => $force_login ? 1 : null,
), '', '&');
return 'https://api.twitter.com/oauth/authorize?' . $params;
} | [
"public",
"function",
"getAuthorizeUrl",
"(",
"$",
"force_login",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"http_build_query",
"(",
"array",
"(",
"'oauth_token'",
"=>",
"$",
"this",
"->",
"ot",
",",
"'force_login'",
"=>",
"$",
"force_login",
"?",
"1",
"... | Get URL for authorization.
@param bool [$force_login]
@return string URL | [
"Get",
"URL",
"for",
"authorization",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L330-L336 |
189,012 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.get | public function get($url, $params = array(), $proxy = '') {
$ch = $this->curlGet($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | php | public function get($url, $params = array(), $proxy = '') {
$ch = $this->curlGet($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlGet",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",
"proxy",
")",
";",
... | Execute GET request.
@param string $url full or partial endpoint URL.
e.g. "statuses/show", "https://api.twitter.com/1.1/statuses/show.json"
@param mixed [$params] 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return mixed
@throws TwistException | [
"Execute",
"GET",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L349-L353 |
189,013 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.getOut | public function getOut($url, $params = array(), $proxy = '') {
$ch = $this->curlGetOut($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | php | public function getOut($url, $params = array(), $proxy = '') {
$ch = $this->curlGetOut($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | [
"public",
"function",
"getOut",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlGetOut",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",
"proxy",
")",
... | Execute GET OAuth Echo request.
@param string $url full URL.
@param mixed [$params] 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return mixed
@throws TwistException | [
"Execute",
"GET",
"OAuth",
"Echo",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L365-L369 |
189,014 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.streaming | public function streaming($url, $callback, $params = array(), $proxy = '') {
curl_exec($ch = $this->curlStreaming($url, $callback, $params, $proxy));
// throw exception unless $callback returned true
self::checkCurlError($ch);
} | php | public function streaming($url, $callback, $params = array(), $proxy = '') {
curl_exec($ch = $this->curlStreaming($url, $callback, $params, $proxy));
// throw exception unless $callback returned true
self::checkCurlError($ch);
} | [
"public",
"function",
"streaming",
"(",
"$",
"url",
",",
"$",
"callback",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"curl_exec",
"(",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlStreaming",
"(",
"$",
"url",
"... | Execute streaming POST request.
@param string $url full or partial endpoint URL.
e.g. "statuses/sample", "https://stream.twitter.com/1.1/statuses/sample.json"
@param callable $callback function for processing each message.
if it returns true, your connection will be aborted.
@param mixed [$params] 1-demensio... | [
"Execute",
"streaming",
"POST",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L383-L387 |
189,015 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.post | public function post($url, $params = array(), $proxy = '') {
$ch = $this->curlPost($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | php | public function post($url, $params = array(), $proxy = '') {
$ch = $this->curlPost($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlPost",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",
"proxy",
")",
";"... | Execute POST request.
@param string $url full or partial endpoint URL.
e.g. "statuses/update", "https://api.twitter.com/1.1/statuses/update.json"
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return mixed
@throws TwistException | [
"Execute",
"POST",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L400-L404 |
189,016 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.postOut | public function postOut($url, $params = array(), $proxy = '') {
$ch = $this->curlPostOut($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | php | public function postOut($url, $params = array(), $proxy = '') {
$ch = $this->curlPostOut($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | [
"public",
"function",
"postOut",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlPostOut",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",
"proxy",
")",... | Execute POST OAuth Echo request.
@param string $url full URL.
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return mixed
@throws TwistException | [
"Execute",
"POST",
"OAuth",
"Echo",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L416-L420 |
189,017 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.postMultipart | public function postMultipart($url, $params = array(), $proxy = '') {
$ch = $this->curlPostMultipart($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | php | public function postMultipart($url, $params = array(), $proxy = '') {
$ch = $this->curlPostMultipart($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | [
"public",
"function",
"postMultipart",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlPostMultipart",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",
"pr... | Execute multipart POST request.
@param string $url full or partial endpoint URL.
e.g. "statuses/update_with_media", "https://api.twitter.com/1.1/statuses/update_with_media.json"
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@ret... | [
"Execute",
"multipart",
"POST",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L479-L483 |
189,018 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.postMultipartOut | public function postMultipartOut($url, $params = array(), $proxy = '') {
$ch = $this->curlPostMultipartOut($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | php | public function postMultipartOut($url, $params = array(), $proxy = '') {
$ch = $this->curlPostMultipartOut($url, $params, $proxy);
$response = curl_exec($ch);
return self::decode($ch, $response);
} | [
"public",
"function",
"postMultipartOut",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->",
"curlPostMultipartOut",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",... | Execute multipart POST OAuth Echo request.
@param string $url full URL.
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return mixed
@throws TwistException | [
"Execute",
"multipart",
"POST",
"OAuth",
"Echo",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L495-L499 |
189,019 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlGet | public function curlGet($url, $params = array(), $proxy = '') {
return self::curlGetAction($url, $params, false, $proxy);
} | php | public function curlGet($url, $params = array(), $proxy = '') {
return self::curlGetAction($url, $params, false, $proxy);
} | [
"public",
"function",
"curlGet",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"return",
"self",
"::",
"curlGetAction",
"(",
"$",
"url",
",",
"$",
"params",
",",
"false",
",",
"$",
"proxy",
"... | Prepare cURL resource for GET request.
@param string $url full or partial endpoint URL.
e.g. "statuses/show", "https://api.twitter.com/1.1/statuses/show.json"
@param mixed [$params] 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return resource cUR... | [
"Prepare",
"cURL",
"resource",
"for",
"GET",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L512-L514 |
189,020 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlGetOut | public function curlGetOut($url, $params = array(), $proxy = '') {
return self::curlGetAction($url, $params, true, $proxy);
} | php | public function curlGetOut($url, $params = array(), $proxy = '') {
return self::curlGetAction($url, $params, true, $proxy);
} | [
"public",
"function",
"curlGetOut",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"return",
"self",
"::",
"curlGetAction",
"(",
"$",
"url",
",",
"$",
"params",
",",
"true",
",",
"$",
"proxy",
... | Prepare cURL resource for GET OAuth Echo request.
@param string $url full URL.
@param mixed [$params] 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return resource cURL
@throws TwistException | [
"Prepare",
"cURL",
"resource",
"for",
"GET",
"OAuth",
"Echo",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L526-L528 |
189,021 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlStreaming | public function curlStreaming($url, $callback, $params = array(), $proxy = '') {
static $decode;
if (!$decode) {
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
$decode = function ($ch, $response) {
static $rm;
if (!$rm) {
... | php | public function curlStreaming($url, $callback, $params = array(), $proxy = '') {
static $decode;
if (!$decode) {
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
$decode = function ($ch, $response) {
static $rm;
if (!$rm) {
... | [
"public",
"function",
"curlStreaming",
"(",
"$",
"url",
",",
"$",
"callback",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"static",
"$",
"decode",
";",
"if",
"(",
"!",
"$",
"decode",
")",
"{",
"if",
"(",
... | Prepare cURL resource for streaming POST request.
@param string $url full or partial endpoint URL.
e.g. "statuses/sample", "https://stream.twitter.com/1.1/statuses/sample.json"
@param callable $callback function for processing each message.
if it returns true, your connection will be aborted.
@param mixed [$... | [
"Prepare",
"cURL",
"resource",
"for",
"streaming",
"POST",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L542-L603 |
189,022 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlPost | public function curlPost($url, $params = array(), $proxy = '') {
return self::curlPostAction($url, $params, false, $proxy);
} | php | public function curlPost($url, $params = array(), $proxy = '') {
return self::curlPostAction($url, $params, false, $proxy);
} | [
"public",
"function",
"curlPost",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"return",
"self",
"::",
"curlPostAction",
"(",
"$",
"url",
",",
"$",
"params",
",",
"false",
",",
"$",
"proxy",
... | Prepare cURL resource for POST request.
@param string $url full or partial endpoint URL.
e.g. "statuses/update_with_media", "https://api.twitter.com/1.1/statuses/update_with_media.json"
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8... | [
"Prepare",
"cURL",
"resource",
"for",
"POST",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L616-L618 |
189,023 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlPostOut | public function curlPostOut($url, $params = array(), $proxy = '') {
return self::curlPostAction($url, $params, true, $proxy);
} | php | public function curlPostOut($url, $params = array(), $proxy = '') {
return self::curlPostAction($url, $params, true, $proxy);
} | [
"public",
"function",
"curlPostOut",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"return",
"self",
"::",
"curlPostAction",
"(",
"$",
"url",
",",
"$",
"params",
",",
"true",
",",
"$",
"proxy",... | Prepare cURL resource for POST OAuth Echo request.
@param string $url full URL.
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return resource cURL
@throws TwistException | [
"Prepare",
"cURL",
"resource",
"for",
"POST",
"OAuth",
"Echo",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L630-L632 |
189,024 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlPostMultipart | public function curlPostMultipart($url, $params = array(), $proxy = '') {
return self::curlPostMultipartAction($url, $params, false, $proxy);
} | php | public function curlPostMultipart($url, $params = array(), $proxy = '') {
return self::curlPostMultipartAction($url, $params, false, $proxy);
} | [
"public",
"function",
"curlPostMultipart",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"return",
"self",
"::",
"curlPostMultipartAction",
"(",
"$",
"url",
",",
"$",
"params",
",",
"false",
",",
... | Prepare cURL resource for multipart POST request.
@param string $url full or partial endpoint URL.
e.g. "statuses/update_with_media", "https://api.twitter.com/1.1/statuses/update_with_media.json"
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222... | [
"Prepare",
"cURL",
"resource",
"for",
"multipart",
"POST",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L722-L724 |
189,025 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlPostMultipartOut | public function curlPostMultipartOut($url, $params = array(), $proxy = '') {
return self::curlPostMultipartAction($url, $params, true, $proxy);
} | php | public function curlPostMultipartOut($url, $params = array(), $proxy = '') {
return self::curlPostMultipartAction($url, $params, true, $proxy);
} | [
"public",
"function",
"curlPostMultipartOut",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"proxy",
"=",
"''",
")",
"{",
"return",
"self",
"::",
"curlPostMultipartAction",
"(",
"$",
"url",
",",
"$",
"params",
",",
"true",
",",... | Prepare cURL resource for multipart POST OAuth Echo request.
@param string $url full URL.
@param mixed $params 1-demensional array or query string.
@param string [$proxy] full proxy URL.
e.g. https://111.222.333.444:8080
@return resource cURL | [
"Prepare",
"cURL",
"resource",
"for",
"multipart",
"POST",
"OAuth",
"Echo",
"request",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L735-L737 |
189,026 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlInit | private static function curlInit($proxy) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_FOLLOWLOCATION => !ini_get('safe_mode') && (string)ini_get('open_basedir') === '',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => true,
CUR... | php | private static function curlInit($proxy) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_FOLLOWLOCATION => !ini_get('safe_mode') && (string)ini_get('open_basedir') === '',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => true,
CUR... | [
"private",
"static",
"function",
"curlInit",
"(",
"$",
"proxy",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt_array",
"(",
"$",
"ch",
",",
"array",
"(",
"CURLOPT_FOLLOWLOCATION",
"=>",
"!",
"ini_get",
"(",
"'safe_mode'",
")",
"&&",
"... | Initialize cURL resource.
@proxy string $proxy
@return resource cURL | [
"Initialize",
"cURL",
"resource",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L745-L785 |
189,027 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.curlSetOptForVerifier | private static function curlSetOptForVerifier($ch, $to, $authenticity_token, $username, $password) {
$params = array(
'session[username_or_email]' => $username,
'session[password]' => $password,
'authenticity_token' => $authenticity_token,
);
... | php | private static function curlSetOptForVerifier($ch, $to, $authenticity_token, $username, $password) {
$params = array(
'session[username_or_email]' => $username,
'session[password]' => $password,
'authenticity_token' => $authenticity_token,
);
... | [
"private",
"static",
"function",
"curlSetOptForVerifier",
"(",
"$",
"ch",
",",
"$",
"to",
",",
"$",
"authenticity_token",
",",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'session[username_or_email]'",
"=>",
"$",
"user... | Set cURL options for oauth_verifier.
@param resource $ch
@param TwistOAuth $to
@param string $authenticity_token
@param string $username
@param string $password | [
"Set",
"cURL",
"options",
"for",
"oauth_verifier",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L1004-L1015 |
189,028 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.validateParams | private static function validateParams($name, $params, array $others) {
if (is_array($params)) {
foreach ($params + $others as $key => $value) {
if ($key === '' || $value === null) {
unset($params[$key]);
continue;
}
... | php | private static function validateParams($name, $params, array $others) {
if (is_array($params)) {
foreach ($params + $others as $key => $value) {
if ($key === '' || $value === null) {
unset($params[$key]);
continue;
}
... | [
"private",
"static",
"function",
"validateParams",
"(",
"$",
"name",
",",
"$",
"params",
",",
"array",
"$",
"others",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"foreach",
"(",
"$",
"params",
"+",
"$",
"others",
"as",
"$",
... | Force parameters 1-demensional array or query string.
@param string $name
@param mixed $params
@param array $others additional params
@return array filterd parameters | [
"Force",
"parameters",
"1",
"-",
"demensional",
"array",
"or",
"query",
"string",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L1130-L1152 |
189,029 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.parseAuthenticityToken | private static function parseAuthenticityToken($ch, $response) {
static $pattern = '@<input name="authenticity_token" type="hidden" value="([^"]++)">@';
if (!preg_match($pattern, $response, $matches)) {
throw new TwistException('Failed to get authenticity_token.', curl_getinfo($ch, CURLIN... | php | private static function parseAuthenticityToken($ch, $response) {
static $pattern = '@<input name="authenticity_token" type="hidden" value="([^"]++)">@';
if (!preg_match($pattern, $response, $matches)) {
throw new TwistException('Failed to get authenticity_token.', curl_getinfo($ch, CURLIN... | [
"private",
"static",
"function",
"parseAuthenticityToken",
"(",
"$",
"ch",
",",
"$",
"response",
")",
"{",
"static",
"$",
"pattern",
"=",
"'@<input name=\"authenticity_token\" type=\"hidden\" value=\"([^\"]++)\">@'",
";",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"patte... | Parse authenticity_token.
@param resource $ch
@param string $response
@return string authenticity_token
@throws TwistException | [
"Parse",
"authenticity_token",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L1228-L1234 |
189,030 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.parseVerifier | private static function parseVerifier($ch, $response) {
static $pattern = '@<code>([^<]++)</code>@';
if (!preg_match($pattern, $response, $matches)) {
$info = curl_getinfo($ch);
throw new TwistException('Wrong username or password.', $info['http_code']);
}
r... | php | private static function parseVerifier($ch, $response) {
static $pattern = '@<code>([^<]++)</code>@';
if (!preg_match($pattern, $response, $matches)) {
$info = curl_getinfo($ch);
throw new TwistException('Wrong username or password.', $info['http_code']);
}
r... | [
"private",
"static",
"function",
"parseVerifier",
"(",
"$",
"ch",
",",
"$",
"response",
")",
"{",
"static",
"$",
"pattern",
"=",
"'@<code>([^<]++)</code>@'",
";",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"response",
",",
"$",
"matches",... | Parse oauth_verifier.
@param resource $ch cURL resource
@param string $response
@return string oauth_verifier
@throws TwistException | [
"Parse",
"oauth_verifier",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L1244-L1251 |
189,031 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.getAuthorization | private function getAuthorization($url, $method, &$params, $flags) {
$oauth = array(
'oauth_consumer_key' => $this->ck,
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => time(),
'oauth_version' => '1.0a',
'oauth_no... | php | private function getAuthorization($url, $method, &$params, $flags) {
$oauth = array(
'oauth_consumer_key' => $this->ck,
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => time(),
'oauth_version' => '1.0a',
'oauth_no... | [
"private",
"function",
"getAuthorization",
"(",
"$",
"url",
",",
"$",
"method",
",",
"&",
"$",
"params",
",",
"$",
"flags",
")",
"{",
"$",
"oauth",
"=",
"array",
"(",
"'oauth_consumer_key'",
"=>",
"$",
"this",
"->",
"ck",
",",
"'oauth_signature_method'",
... | Prepare headers for authorization.
@param string $url endpoint URL
@param string $method GET or POST
@param array &$params 1-demensional array
@param int $flags self::MODE_*
@return array headers | [
"Prepare",
"headers",
"for",
"authorization",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L1262-L1306 |
189,032 | mpyw/TwistOAuth | src/TwistOAuth.php | TwistOAuth.getOAuthEcho | private function getOAuthEcho() {
$url = 'https://api.twitter.com/1.1/account/verify_credentials.json';
$params = array();
$headers = $this->getAuthorization($url, 'GET', $params, 0);
return array(
'X-Auth-Service-Provider: ' . $url,
'X-Verify-Credentia... | php | private function getOAuthEcho() {
$url = 'https://api.twitter.com/1.1/account/verify_credentials.json';
$params = array();
$headers = $this->getAuthorization($url, 'GET', $params, 0);
return array(
'X-Auth-Service-Provider: ' . $url,
'X-Verify-Credentia... | [
"private",
"function",
"getOAuthEcho",
"(",
")",
"{",
"$",
"url",
"=",
"'https://api.twitter.com/1.1/account/verify_credentials.json'",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"headers",
"=",
"$",
"this",
"->",
"getAuthorization",
"(",
"$",
"url",
... | Prepare headers for OAuth Echo.
@return array headers | [
"Prepare",
"headers",
"for",
"OAuth",
"Echo",
"."
] | a04476047924685104f4a3c83f0d92a63ac1752c | https://github.com/mpyw/TwistOAuth/blob/a04476047924685104f4a3c83f0d92a63ac1752c/src/TwistOAuth.php#L1313-L1321 |
189,033 | JDare/ClankBundle | Server/EntryPoint.php | EntryPoint.launch | public function launch()
{
foreach($this->getServers() as $server)
{
$server = $this->getContainer()->get($server);
if (!$server)
{
throw new \Exception("Unable to find Server Service.");
}
if (!($server instanceof ServerTy... | php | public function launch()
{
foreach($this->getServers() as $server)
{
$server = $this->getContainer()->get($server);
if (!$server)
{
throw new \Exception("Unable to find Server Service.");
}
if (!($server instanceof ServerTy... | [
"public",
"function",
"launch",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getServers",
"(",
")",
"as",
"$",
"server",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"$",
"server",
")",
";",
"... | Launches the relevant servers needed by Clank. | [
"Launches",
"the",
"relevant",
"servers",
"needed",
"by",
"Clank",
"."
] | 3661c4583cef2f464ba8f34948ef1a5fdee629f0 | https://github.com/JDare/ClankBundle/blob/3661c4583cef2f464ba8f34948ef1a5fdee629f0/Server/EntryPoint.php#L36-L58 |
189,034 | petkopara/PetkoparaCrudGeneratorBundle | Command/CrudGeneratorCommand.php | CrudGeneratorCommand.generateFilter | protected function generateFilter($bundle, $entity, $metadata, $forceOverwrite = false, $type = self::FILTER_TYPE_INPUT)
{
$this->getFilterGenerator($bundle)->generate($bundle, $entity, $metadata[0], $forceOverwrite, $type);
} | php | protected function generateFilter($bundle, $entity, $metadata, $forceOverwrite = false, $type = self::FILTER_TYPE_INPUT)
{
$this->getFilterGenerator($bundle)->generate($bundle, $entity, $metadata[0], $forceOverwrite, $type);
} | [
"protected",
"function",
"generateFilter",
"(",
"$",
"bundle",
",",
"$",
"entity",
",",
"$",
"metadata",
",",
"$",
"forceOverwrite",
"=",
"false",
",",
"$",
"type",
"=",
"self",
"::",
"FILTER_TYPE_INPUT",
")",
"{",
"$",
"this",
"->",
"getFilterGenerator",
... | Tries to generate filtlers if they don't exist yet and if we need write operations on entities.
@param string $entity | [
"Tries",
"to",
"generate",
"filtlers",
"if",
"they",
"don",
"t",
"exist",
"yet",
"and",
"if",
"we",
"need",
"write",
"operations",
"on",
"entities",
"."
] | 5033fd552243317510ce08c66087785d72604754 | https://github.com/petkopara/PetkoparaCrudGeneratorBundle/blob/5033fd552243317510ce08c66087785d72604754/Command/CrudGeneratorCommand.php#L330-L333 |
189,035 | moltin/php-sdk | src/Resources/Integrations.php | Integrations.getLogs | public function getLogs($integrationID = false, $jobID = false)
{
$uri = "logs"; // get all logs by default
if (!empty($integrationID) && !empty($jobID)) {
$uri = $integrationID . "/jobs/" . $jobID . "/logs"; // get logs for a given job
}
return $this->call('GET', false, ... | php | public function getLogs($integrationID = false, $jobID = false)
{
$uri = "logs"; // get all logs by default
if (!empty($integrationID) && !empty($jobID)) {
$uri = $integrationID . "/jobs/" . $jobID . "/logs"; // get logs for a given job
}
return $this->call('GET', false, ... | [
"public",
"function",
"getLogs",
"(",
"$",
"integrationID",
"=",
"false",
",",
"$",
"jobID",
"=",
"false",
")",
"{",
"$",
"uri",
"=",
"\"logs\"",
";",
"// get all logs by default",
"if",
"(",
"!",
"empty",
"(",
"$",
"integrationID",
")",
"&&",
"!",
"empt... | Return all logs
@param string $integrationID
@return Moltin\Response | [
"Return",
"all",
"logs"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resources/Integrations.php#L28-L35 |
189,036 | petkopara/PetkoparaCrudGeneratorBundle | Generator/Guesser/MetadataGuesser.php | MetadataGuesser.guessChoiceLabelFromClass | public function guessChoiceLabelFromClass($entity)
{
$metadata = $this->metadataFactory->getClassMetadata($entity)->getMetadata();
foreach ($metadata[0]->fieldMappings as $fieldName => $field) {
if ($field['type'] == 'string') {
return $fieldName;
}
}
... | php | public function guessChoiceLabelFromClass($entity)
{
$metadata = $this->metadataFactory->getClassMetadata($entity)->getMetadata();
foreach ($metadata[0]->fieldMappings as $fieldName => $field) {
if ($field['type'] == 'string') {
return $fieldName;
}
}
... | [
"public",
"function",
"guessChoiceLabelFromClass",
"(",
"$",
"entity",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"metadataFactory",
"->",
"getClassMetadata",
"(",
"$",
"entity",
")",
"->",
"getMetadata",
"(",
")",
";",
"foreach",
"(",
"$",
"metadata... | Trying to find string field in relation entity.
@param type $entity
@return string | [
"Trying",
"to",
"find",
"string",
"field",
"in",
"relation",
"entity",
"."
] | 5033fd552243317510ce08c66087785d72604754 | https://github.com/petkopara/PetkoparaCrudGeneratorBundle/blob/5033fd552243317510ce08c66087785d72604754/Generator/Guesser/MetadataGuesser.php#L31-L41 |
189,037 | moltin/php-sdk | src/Entities/Cart.php | Cart.getReference | public function getReference($client = false)
{
if (empty($this->reference)) {
$reference = $this->createReference();
if ($client) {
if (isset($_COOKIE[$client->getCookieCartName()])) {
$reference = $_COOKIE[$client->getCookieCartName()];
... | php | public function getReference($client = false)
{
if (empty($this->reference)) {
$reference = $this->createReference();
if ($client) {
if (isset($_COOKIE[$client->getCookieCartName()])) {
$reference = $_COOKIE[$client->getCookieCartName()];
... | [
"public",
"function",
"getReference",
"(",
"$",
"client",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"reference",
")",
")",
"{",
"$",
"reference",
"=",
"$",
"this",
"->",
"createReference",
"(",
")",
";",
"if",
"(",
"$",
"c... | Get the cart reference
If it isn't set or does not exist in storage, we will create a new one and add it
@return string | [
"Get",
"the",
"cart",
"reference",
"If",
"it",
"isn",
"t",
"set",
"or",
"does",
"not",
"exist",
"in",
"storage",
"we",
"will",
"create",
"a",
"new",
"one",
"and",
"add",
"it"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Entities/Cart.php#L50-L67 |
189,038 | moltin/php-sdk | src/Entities/Cart.php | Cart.addProduct | public function addProduct($id, $qty = 1, $spec = [])
{
$body = [
'data' => [
'type' => 'cart_item',
'id' => $id,
'quantity' => $qty
]
];
return $this->call('POST', $body, $this->getReference() . '/items');
} | php | public function addProduct($id, $qty = 1, $spec = [])
{
$body = [
'data' => [
'type' => 'cart_item',
'id' => $id,
'quantity' => $qty
]
];
return $this->call('POST', $body, $this->getReference() . '/items');
} | [
"public",
"function",
"addProduct",
"(",
"$",
"id",
",",
"$",
"qty",
"=",
"1",
",",
"$",
"spec",
"=",
"[",
"]",
")",
"{",
"$",
"body",
"=",
"[",
"'data'",
"=>",
"[",
"'type'",
"=>",
"'cart_item'",
",",
"'id'",
"=>",
"$",
"id",
",",
"'quantity'",
... | Add a Product to the Cart
@param string $id the Product ID
@param int $qty the quantity to add to the cart
@param array $spec the product spec (variations, inputs, singles etc)
@return Moltin\Response | [
"Add",
"a",
"Product",
"to",
"the",
"Cart"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Entities/Cart.php#L77-L87 |
189,039 | moltin/php-sdk | src/Entities/Cart.php | Cart.addCustomItem | public function addCustomItem($name, $sku, $description, $price, $qty = 1)
{
$body = [
'data' => [
'type' => 'custom_item',
'name' => $name,
'sku' => $sku,
'description' => $description,
'quantity' => $qty,
... | php | public function addCustomItem($name, $sku, $description, $price, $qty = 1)
{
$body = [
'data' => [
'type' => 'custom_item',
'name' => $name,
'sku' => $sku,
'description' => $description,
'quantity' => $qty,
... | [
"public",
"function",
"addCustomItem",
"(",
"$",
"name",
",",
"$",
"sku",
",",
"$",
"description",
",",
"$",
"price",
",",
"$",
"qty",
"=",
"1",
")",
"{",
"$",
"body",
"=",
"[",
"'data'",
"=>",
"[",
"'type'",
"=>",
"'custom_item'",
",",
"'name'",
"... | Add a Custom Item to the Cart
@param string $name the custom item name
@param string $sku the custom item sku
@param string $description the custom item description
@param int $price
@param int $qty the quantity to add to the cart
@return Moltin\Response | [
"Add",
"a",
"Custom",
"Item",
"to",
"the",
"Cart"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Entities/Cart.php#L99-L114 |
189,040 | moltin/php-sdk | src/Entities/Cart.php | Cart.updateItemQuantity | public function updateItemQuantity($id, $quantity)
{
$body = [
'data' => [
'id' => $id,
'quantity' => $quantity
]
];
return $this->call('PUT', $body, $this->getReference() . "/items/{$id}");
} | php | public function updateItemQuantity($id, $quantity)
{
$body = [
'data' => [
'id' => $id,
'quantity' => $quantity
]
];
return $this->call('PUT', $body, $this->getReference() . "/items/{$id}");
} | [
"public",
"function",
"updateItemQuantity",
"(",
"$",
"id",
",",
"$",
"quantity",
")",
"{",
"$",
"body",
"=",
"[",
"'data'",
"=>",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'quantity'",
"=>",
"$",
"quantity",
"]",
"]",
";",
"return",
"$",
"this",
"->",
"... | Update an items quantity in a cart
@param string $id the cart item idate
@param int $quantity the new quantity
@return Moltin\Response | [
"Update",
"an",
"items",
"quantity",
"in",
"a",
"cart"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Entities/Cart.php#L133-L142 |
189,041 | moltin/php-sdk | src/Request.php | Request.getHeader | private function getHeader($name)
{
if (isset($this->headers[$name])) {
return $this->headers[$name];
}
return false;
} | php | private function getHeader($name)
{
if (isset($this->headers[$name])) {
return $this->headers[$name];
}
return false;
} | [
"private",
"function",
"getHeader",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
";",
"}",
"return",
"false... | Get a specific header
@param string $name the header name
@return false|string false if the header is not set, otherwise the string value | [
"Get",
"a",
"specific",
"header"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Request.php#L73-L79 |
189,042 | moltin/php-sdk | src/Request.php | Request.setDefaultHeaders | private function setDefaultHeaders()
{
$defaultHeaders = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'User-Agent' => Client::UA,
'X-MOLTIN-SDK-LANGUAGE' => 'php',
'X-MOLTIN-SDK-VERSION' => 'v2-dev'
];
f... | php | private function setDefaultHeaders()
{
$defaultHeaders = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'User-Agent' => Client::UA,
'X-MOLTIN-SDK-LANGUAGE' => 'php',
'X-MOLTIN-SDK-VERSION' => 'v2-dev'
];
f... | [
"private",
"function",
"setDefaultHeaders",
"(",
")",
"{",
"$",
"defaultHeaders",
"=",
"[",
"'Content-Type'",
"=>",
"'application/json'",
",",
"'Accept'",
"=>",
"'application/json'",
",",
"'User-Agent'",
"=>",
"Client",
"::",
"UA",
",",
"'X-MOLTIN-SDK-LANGUAGE'",
"=... | Set the default request headers
@return $this | [
"Set",
"the",
"default",
"request",
"headers"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Request.php#L124-L141 |
189,043 | moltin/php-sdk | src/Request.php | Request.make | public function make()
{
$this->setDefaultHeaders();
$startTime = microtime(true);
$result = $this->httpClient->request($this->getMethod(), $this->getURL(), $this->getPayload());
$endTime = microtime(true);
$this->response = new Response();
$this->response->setExecu... | php | public function make()
{
$this->setDefaultHeaders();
$startTime = microtime(true);
$result = $this->httpClient->request($this->getMethod(), $this->getURL(), $this->getPayload());
$endTime = microtime(true);
$this->response = new Response();
$this->response->setExecu... | [
"public",
"function",
"make",
"(",
")",
"{",
"$",
"this",
"->",
"setDefaultHeaders",
"(",
")",
";",
"$",
"startTime",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"httpClient",
"->",
"request",
"(",
"$",
"this",
"->... | Make a request
@return $this | [
"Make",
"a",
"request"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Request.php#L285-L306 |
189,044 | moltin/php-sdk | src/Client.php | Client.getAPIEndpoint | public function getAPIEndpoint($uri = false)
{
$endpoint = $this->getBase() . '/' . $this->getVersion() . '/';
if ($uri) {
$endpoint .= $uri;
}
return $endpoint;
} | php | public function getAPIEndpoint($uri = false)
{
$endpoint = $this->getBase() . '/' . $this->getVersion() . '/';
if ($uri) {
$endpoint .= $uri;
}
return $endpoint;
} | [
"public",
"function",
"getAPIEndpoint",
"(",
"$",
"uri",
"=",
"false",
")",
"{",
"$",
"endpoint",
"=",
"$",
"this",
"->",
"getBase",
"(",
")",
".",
"'/'",
".",
"$",
"this",
"->",
"getVersion",
"(",
")",
".",
"'/'",
";",
"if",
"(",
"$",
"uri",
")"... | Get the API endpoint for non authentication calls
@param string $uri is the uri to append to the API endpoint
@return string the FQDN with URI for API requests | [
"Get",
"the",
"API",
"endpoint",
"for",
"non",
"authentication",
"calls"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Client.php#L158-L167 |
189,045 | moltin/php-sdk | src/Entities/Order.php | Order.pay | public function pay($gateway, $method, $paymentParams)
{
return $this->call('POST', ['data' => $this->mergePayData($gateway, $method, $paymentParams)], $this->getID() . '/payments');
} | php | public function pay($gateway, $method, $paymentParams)
{
return $this->call('POST', ['data' => $this->mergePayData($gateway, $method, $paymentParams)], $this->getID() . '/payments');
} | [
"public",
"function",
"pay",
"(",
"$",
"gateway",
",",
"$",
"method",
",",
"$",
"paymentParams",
")",
"{",
"return",
"$",
"this",
"->",
"call",
"(",
"'POST'",
",",
"[",
"'data'",
"=>",
"$",
"this",
"->",
"mergePayData",
"(",
"$",
"gateway",
",",
"$",... | Pay for the order
@param string $gateway the slug of the payment gateway
@param string $method the order method (eg 'purchase')
@param array $paymentParams payment params to use in the payment (eg card details, but this depends on the $gateway selected - see docs for more info)
@return Moltin\Response | [
"Pay",
"for",
"the",
"order"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Entities/Order.php#L88-L91 |
189,046 | moltin/php-sdk | src/Resources/Files.php | Files.getFileLocation | public function getFileLocation($file)
{
// get the file info
if (filter_var($file, FILTER_VALIDATE_URL)) {
// the file is a URL, download it and set the local file path
$localFile = '/tmp/moltinfile_' . rand(100000, 900000);
file_put_contents($localFile, file_g... | php | public function getFileLocation($file)
{
// get the file info
if (filter_var($file, FILTER_VALIDATE_URL)) {
// the file is a URL, download it and set the local file path
$localFile = '/tmp/moltinfile_' . rand(100000, 900000);
file_put_contents($localFile, file_g... | [
"public",
"function",
"getFileLocation",
"(",
"$",
"file",
")",
"{",
"// get the file info",
"if",
"(",
"filter_var",
"(",
"$",
"file",
",",
"FILTER_VALIDATE_URL",
")",
")",
"{",
"// the file is a URL, download it and set the local file path",
"$",
"localFile",
"=",
"... | Get the file location given the value passed by the method call
Will retrieve a remote file if the passed location is a URL
@param string $file the local path or URL of the file
@return string the local file path
@throws Moltin\Exceptions\FileNotFoundException | [
"Get",
"the",
"file",
"location",
"given",
"the",
"value",
"passed",
"by",
"the",
"method",
"call",
"Will",
"retrieve",
"a",
"remote",
"file",
"if",
"the",
"passed",
"location",
"is",
"a",
"URL"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resources/Files.php#L40-L60 |
189,047 | moltin/php-sdk | src/Resource.php | Resource.updateRelationships | public function updateRelationships($from, $to, $ids = null)
{
return $this->makeRelationshipCall('put', $from, $to, $ids, true);
} | php | public function updateRelationships($from, $to, $ids = null)
{
return $this->makeRelationshipCall('put', $from, $to, $ids, true);
} | [
"public",
"function",
"updateRelationships",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"ids",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"makeRelationshipCall",
"(",
"'put'",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"ids",
",",
"true",
... | Update relationships from a resource to other resources
@param string $from the UUID of the resource you're updating a relationship on
@param string $to the resource type to update links to (use the plural, eg 'categories' rather than 'category')
@param array|string|null $ids the $ids to create relationships to | [
"Update",
"relationships",
"from",
"a",
"resource",
"to",
"other",
"resources"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L279-L282 |
189,048 | moltin/php-sdk | src/Resource.php | Resource.deleteRelationships | public function deleteRelationships($from, $to, $ids = null)
{
return $this->makeRelationshipCall('delete', $from, $to, $ids);
} | php | public function deleteRelationships($from, $to, $ids = null)
{
return $this->makeRelationshipCall('delete', $from, $to, $ids);
} | [
"public",
"function",
"deleteRelationships",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"ids",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"makeRelationshipCall",
"(",
"'delete'",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"ids",
")",
";",
... | Delete relationships from a resource to other resources
@param string $from the UUID of the resource you're deleting a relationship on
@param string $to the resource type to delete links to (use the plural, eg 'categories' rather than 'category')
@param array|null $ids the $ids to delete relationships to | [
"Delete",
"relationships",
"from",
"a",
"resource",
"to",
"other",
"resources"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L291-L294 |
189,049 | moltin/php-sdk | src/Resource.php | Resource.buildRelationshipData | public function buildRelationshipData($type, $ids)
{
if ($ids === null || (is_array($ids) && empty($ids))) {
return null;
}
// one relationship to add
if (is_string($ids)) {
return [
'type' => $type,
'id' => $ids
];... | php | public function buildRelationshipData($type, $ids)
{
if ($ids === null || (is_array($ids) && empty($ids))) {
return null;
}
// one relationship to add
if (is_string($ids)) {
return [
'type' => $type,
'id' => $ids
];... | [
"public",
"function",
"buildRelationshipData",
"(",
"$",
"type",
",",
"$",
"ids",
")",
"{",
"if",
"(",
"$",
"ids",
"===",
"null",
"||",
"(",
"is_array",
"(",
"$",
"ids",
")",
"&&",
"empty",
"(",
"$",
"ids",
")",
")",
")",
"{",
"return",
"null",
"... | build the body data for a relationship call
@param string $type the type of resource you're relating to (eg 'category')
@param array $ids an array of UUID's for the resources you're relating to
@return array|null if an array of id's is valid return them, otherwise retun null | [
"build",
"the",
"body",
"data",
"for",
"a",
"relationship",
"call"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L331-L356 |
189,050 | moltin/php-sdk | src/Resource.php | Resource.getAccessToken | public function getAccessToken()
{
// check in the session
$existing = $this->storage->getKey('authentication');
// is it still valid
if ($existing && $existing->expires > time()) {
return $existing->access_token;
}
// make the call to the API
$a... | php | public function getAccessToken()
{
// check in the session
$existing = $this->storage->getKey('authentication');
// is it still valid
if ($existing && $existing->expires > time()) {
return $existing->access_token;
}
// make the call to the API
$a... | [
"public",
"function",
"getAccessToken",
"(",
")",
"{",
"// check in the session",
"$",
"existing",
"=",
"$",
"this",
"->",
"storage",
"->",
"getKey",
"(",
"'authentication'",
")",
";",
"// is it still valid",
"if",
"(",
"$",
"existing",
"&&",
"$",
"existing",
... | Get an access token from the local storage if available, otherwise request one from the API
@return string the access token
@throws Exceptions\AuthenticationException | [
"Get",
"an",
"access",
"token",
"from",
"the",
"local",
"storage",
"if",
"available",
"otherwise",
"request",
"one",
"from",
"the",
"API"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L364-L382 |
189,051 | moltin/php-sdk | src/Resource.php | Resource.makeAuthenticationCall | public function makeAuthenticationCall()
{
$authResponse = $this->call('POST', [
'grant_type' => 'client_credentials',
'client_id' => $this->client->getClientID(),
'client_secret' => $this->client->getClientSecret()
], false, ['Content-Type' => 'application/x-www-... | php | public function makeAuthenticationCall()
{
$authResponse = $this->call('POST', [
'grant_type' => 'client_credentials',
'client_id' => $this->client->getClientID(),
'client_secret' => $this->client->getClientSecret()
], false, ['Content-Type' => 'application/x-www-... | [
"public",
"function",
"makeAuthenticationCall",
"(",
")",
"{",
"$",
"authResponse",
"=",
"$",
"this",
"->",
"call",
"(",
"'POST'",
",",
"[",
"'grant_type'",
"=>",
"'client_credentials'",
",",
"'client_id'",
"=>",
"$",
"this",
"->",
"client",
"->",
"getClientID... | Get an access token from the API
@return Moltin\Response
@throws Exceptions\AuthenticationException | [
"Get",
"an",
"access",
"token",
"from",
"the",
"API"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L390-L403 |
189,052 | moltin/php-sdk | src/Resource.php | Resource.call | public function call($method, $body = false, $uriAppend = false, $headers = [], $requiresAuthentication = true, $buildQueryParams = true)
{
$headers = $this->addRequestHeaders($headers);
$url = $requiresAuthentication ? $this->client->getAPIEndpoint($this->uri) : $this->client->getAuthEndpoint();
... | php | public function call($method, $body = false, $uriAppend = false, $headers = [], $requiresAuthentication = true, $buildQueryParams = true)
{
$headers = $this->addRequestHeaders($headers);
$url = $requiresAuthentication ? $this->client->getAPIEndpoint($this->uri) : $this->client->getAuthEndpoint();
... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"$",
"body",
"=",
"false",
",",
"$",
"uriAppend",
"=",
"false",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"requiresAuthentication",
"=",
"true",
",",
"$",
"buildQueryParams",
"=",
"true",
")",
... | Make a call to the API
@param string $method request method to use GET|POST|PUT|PATCH|DELETE
@param array $body any body data to send with the request
@param string $uriAppend any additional URI componenents as a string (eg 'relationships/categories')
@param array $headers any specific headers for the request
@param b... | [
"Make",
"a",
"call",
"to",
"the",
"API"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L416-L440 |
189,053 | moltin/php-sdk | src/Resource.php | Resource.addRequestHeaders | public function addRequestHeaders($headers)
{
$currency = $this->client->getCurrencyCode();
if (!empty($currency)) {
$headers['X-MOLTIN-CURRENCY'] = $this->client->getCurrencyCode();
}
return $headers;
} | php | public function addRequestHeaders($headers)
{
$currency = $this->client->getCurrencyCode();
if (!empty($currency)) {
$headers['X-MOLTIN-CURRENCY'] = $this->client->getCurrencyCode();
}
return $headers;
} | [
"public",
"function",
"addRequestHeaders",
"(",
"$",
"headers",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"client",
"->",
"getCurrencyCode",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"currency",
")",
")",
"{",
"$",
"headers",
"[",
"'... | Adds moltin specific request headers to an array to be passed to the request
@param array $headers
@return array | [
"Adds",
"moltin",
"specific",
"request",
"headers",
"to",
"an",
"array",
"to",
"be",
"passed",
"to",
"the",
"request"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L448-L455 |
189,054 | moltin/php-sdk | src/Resource.php | Resource.buildQueryStringParams | public function buildQueryStringParams()
{
$params = [];
if ($this->limit > 0) {
$params['page']['limit'] = $this->limit;
}
if ($this->offset > 0) {
$params['page']['offset'] = $this->offset;
}
if ($this->sort) {
$params['sort'] = $... | php | public function buildQueryStringParams()
{
$params = [];
if ($this->limit > 0) {
$params['page']['limit'] = $this->limit;
}
if ($this->offset > 0) {
$params['page']['offset'] = $this->offset;
}
if ($this->sort) {
$params['sort'] = $... | [
"public",
"function",
"buildQueryStringParams",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'page'",
"]",
"[",
"'limit'",
"]",
"=",
"$",
"this",
"->",
"limit",
... | Build the query string parameters based on the resource settings
@return array | [
"Build",
"the",
"query",
"string",
"parameters",
"based",
"on",
"the",
"resource",
"settings"
] | ff8b549dd6d6a7d9d1424296627aac7b040e788f | https://github.com/moltin/php-sdk/blob/ff8b549dd6d6a7d9d1424296627aac7b040e788f/src/Resource.php#L462-L481 |
189,055 | php-mvc-project/php-mvc | src/Route.php | Route.getValueOrDefault | public function getValueOrDefault($key, $default = null) {
if (!empty($this->values[$key])) {
return $this->values[$key];
}
elseif (!empty($this->defaults[$key])) {
return $this->defaults[$key];
}
else {
return $default;
}
} | php | public function getValueOrDefault($key, $default = null) {
if (!empty($this->values[$key])) {
return $this->values[$key];
}
elseif (!empty($this->defaults[$key])) {
return $this->defaults[$key];
}
else {
return $default;
}
} | [
"public",
"function",
"getValueOrDefault",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"values",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"values",
"[",
"$... | Get value or default.
@param string $key The key whose value is to try to get.
@param string $default Default value. Only if the value in the $defaults property is not found.
@return string | [
"Get",
"value",
"or",
"default",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Route.php#L129-L139 |
189,056 | php-mvc-project/php-mvc | src/Route.php | Route.getSegments | public function getSegments($named = false) {
if (!empty($this->segments)) {
return $named === true ? $this->segmentsNamed : $this->segments;
}
// required parameters
$required = $this->defaults;
// escape special characters
$safeTemplate = $this->escapeTemp... | php | public function getSegments($named = false) {
if (!empty($this->segments)) {
return $named === true ? $this->segmentsNamed : $this->segments;
}
// required parameters
$required = $this->defaults;
// escape special characters
$safeTemplate = $this->escapeTemp... | [
"public",
"function",
"getSegments",
"(",
"$",
"named",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"segments",
")",
")",
"{",
"return",
"$",
"named",
"===",
"true",
"?",
"$",
"this",
"->",
"segmentsNamed",
":",
"$",
"t... | Returns segments of the route.
@param bool $named Specify whether to return a named collection (true) or array (false, default).
@var RouteSegment[] | [
"Returns",
"segments",
"of",
"the",
"route",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Route.php#L148-L163 |
189,057 | php-mvc-project/php-mvc | src/Route.php | Route.escapeTemplate | private function escapeTemplate($value) {
$result = $value;
$result = str_replace('{{', chr(1), $result);
$result = str_replace('}}', chr(2), $result);
$result = preg_replace_callback('/([^\{\/\x5c]+|)(\{[^\}]+\})([^\{\/\x5c]+|)/', function($m) {
array_shift($m);
... | php | private function escapeTemplate($value) {
$result = $value;
$result = str_replace('{{', chr(1), $result);
$result = str_replace('}}', chr(2), $result);
$result = preg_replace_callback('/([^\{\/\x5c]+|)(\{[^\}]+\})([^\{\/\x5c]+|)/', function($m) {
array_shift($m);
... | [
"private",
"function",
"escapeTemplate",
"(",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"$",
"value",
";",
"$",
"result",
"=",
"str_replace",
"(",
"'{{'",
",",
"chr",
"(",
"1",
")",
",",
"$",
"result",
")",
";",
"$",
"result",
"=",
"str_replace",
... | Quote regular expression characters.
@return string | [
"Quote",
"regular",
"expression",
"characters",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Route.php#L170-L194 |
189,058 | php-mvc-project/php-mvc | src/Route.php | Route.setBounds | private function setBounds(&$segments) {
for ($i = 0, $count = count($segments); $i < $count; ++$i) {
if ($segments[$i]->optional && $i - 1 >= 0) {
$optional = true;
for ($j = $i + 1; $j < $count; ++$j) {
if (!$segments[$j]->optional) {
... | php | private function setBounds(&$segments) {
for ($i = 0, $count = count($segments); $i < $count; ++$i) {
if ($segments[$i]->optional && $i - 1 >= 0) {
$optional = true;
for ($j = $i + 1; $j < $count; ++$j) {
if (!$segments[$j]->optional) {
... | [
"private",
"function",
"setBounds",
"(",
"&",
"$",
"segments",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"count",
"=",
"count",
"(",
"$",
"segments",
")",
";",
"$",
"i",
"<",
"$",
"count",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
... | Marks the boundaries.
@param RouteSegment[] &$segments Segments to processing.
@return void | [
"Marks",
"the",
"boundaries",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Route.php#L418-L444 |
189,059 | php-mvc-project/php-mvc | src/ActionContext.php | ActionContext.actionNameEquals | public function actionNameEquals($name) {
$actionName = strtolower($this->actionName);
if (is_array($name)) {
foreach ($name as $n) {
if ($actionName == strtolower($n)) {
return true;
}
}
return false;
}
... | php | public function actionNameEquals($name) {
$actionName = strtolower($this->actionName);
if (is_array($name)) {
foreach ($name as $n) {
if ($actionName == strtolower($n)) {
return true;
}
}
return false;
}
... | [
"public",
"function",
"actionNameEquals",
"(",
"$",
"name",
")",
"{",
"$",
"actionName",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"actionName",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"foreach",
"(",
"$",
"name",
"as",
"$"... | Checks the equivalence of the specified string with the name of the action.
@param string|array $name The string or string array to compare.
@return bool | [
"Checks",
"the",
"equivalence",
"of",
"the",
"specified",
"string",
"with",
"the",
"name",
"of",
"the",
"action",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ActionContext.php#L183-L198 |
189,060 | php-mvc-project/php-mvc | src/ActionContext.php | ActionContext.controllerNameEquals | public function controllerNameEquals($name) {
$controllerName = strtolower($this->getControllerName());
if (is_array($name)) {
foreach ($name as $n) {
if ($controllerName == strtolower($n)) {
return true;
}
}
retur... | php | public function controllerNameEquals($name) {
$controllerName = strtolower($this->getControllerName());
if (is_array($name)) {
foreach ($name as $n) {
if ($controllerName == strtolower($n)) {
return true;
}
}
retur... | [
"public",
"function",
"controllerNameEquals",
"(",
"$",
"name",
")",
"{",
"$",
"controllerName",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"getControllerName",
"(",
")",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"foreach",
"(",
... | Checks the equivalence of the specified string with the name of the controller.
@param string|array $name The string or string array to compare.
@return bool | [
"Checks",
"the",
"equivalence",
"of",
"the",
"specified",
"string",
"with",
"the",
"name",
"of",
"the",
"controller",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ActionContext.php#L216-L231 |
189,061 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.clear | public function clear($regionName = null) {
$path = $this->getPath($regionName);
$result = count(glob($path . DIRECTORY_SEPARATOR . '*.cache'));
array_map('unlink', glob($path . DIRECTORY_SEPARATOR . '*.cache'));
array_map('unlink', glob($path . DIRECTORY_SEPARATOR . '*.policy'));
... | php | public function clear($regionName = null) {
$path = $this->getPath($regionName);
$result = count(glob($path . DIRECTORY_SEPARATOR . '*.cache'));
array_map('unlink', glob($path . DIRECTORY_SEPARATOR . '*.cache'));
array_map('unlink', glob($path . DIRECTORY_SEPARATOR . '*.policy'));
... | [
"public",
"function",
"clear",
"(",
"$",
"regionName",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
"$",
"regionName",
")",
";",
"$",
"result",
"=",
"count",
"(",
"glob",
"(",
"$",
"path",
".",
"DIRECTORY_SEPARATOR",
".... | Removes all cache entries.
@param string $regionName A name of region.
@return int Number of deleted records. | [
"Removes",
"all",
"cache",
"entries",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L105-L113 |
189,062 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.init | public function init() {
$this->cachePath = PathUtility::mapPath($this->config->cachePath);
$this->accessTime = (isset($this->config->accessTime) ? (int)$this->config->accessTime : 100) * 1000;
$this->hash = (isset($this->config->hash) ? $this->config->hash : null);
} | php | public function init() {
$this->cachePath = PathUtility::mapPath($this->config->cachePath);
$this->accessTime = (isset($this->config->accessTime) ? (int)$this->config->accessTime : 100) * 1000;
$this->hash = (isset($this->config->hash) ? $this->config->hash : null);
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"cachePath",
"=",
"PathUtility",
"::",
"mapPath",
"(",
"$",
"this",
"->",
"config",
"->",
"cachePath",
")",
";",
"$",
"this",
"->",
"accessTime",
"=",
"(",
"isset",
"(",
"$",
"this",
"->... | Initializes the provider.
@return void | [
"Initializes",
"the",
"provider",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L143-L147 |
189,063 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.get | public function get($key, $regionName = null) {
if ($this->containsFiles($key, $regionName, $policy, $cache)) {
$this->getCacheContent($policy, $cache, $result);
return $result;
}
else {
return null;
}
} | php | public function get($key, $regionName = null) {
if ($this->containsFiles($key, $regionName, $policy, $cache)) {
$this->getCacheContent($policy, $cache, $result);
return $result;
}
else {
return null;
}
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"regionName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"containsFiles",
"(",
"$",
"key",
",",
"$",
"regionName",
",",
"$",
"policy",
",",
"$",
"cache",
")",
")",
"{",
"$",
"this"... | Gets the specified cache entry from the cache as an object.
@param string $key A unique identifier for the cache entry.
@param string $regionName A name of region.
@return mixed|null | [
"Gets",
"the",
"specified",
"cache",
"entry",
"from",
"the",
"cache",
"as",
"an",
"object",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L157-L166 |
189,064 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.remove | public function remove($key, $regionName = null) {
if ($this->containsFiles($key, $regionName, $policy, $cache)) {
if ($this->getCacheContent($policy, $cache, $result) === true) {
$this->tryDeleteFile($policy);
$this->tryDeleteFile($cache);
}
... | php | public function remove($key, $regionName = null) {
if ($this->containsFiles($key, $regionName, $policy, $cache)) {
if ($this->getCacheContent($policy, $cache, $result) === true) {
$this->tryDeleteFile($policy);
$this->tryDeleteFile($cache);
}
... | [
"public",
"function",
"remove",
"(",
"$",
"key",
",",
"$",
"regionName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"containsFiles",
"(",
"$",
"key",
",",
"$",
"regionName",
",",
"$",
"policy",
",",
"$",
"cache",
")",
")",
"{",
"if",
"(... | Removes the cache entry from the cache.
@param string $key A unique identifier for the cache entry.
@param string $regionName A name of region.
@return mixed An object that represents the value of the removed cache entry that was specified by the key,
or null if the specified entry was not found. | [
"Removes",
"the",
"cache",
"entry",
"from",
"the",
"cache",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L196-L208 |
189,065 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.getKey | private function getKey($value) {
return !empty($this->hash) ? call_user_func($this->hash, $value) : preg_replace('/[^0-9a-z\.\_\-]/i', '', $value);
} | php | private function getKey($value) {
return !empty($this->hash) ? call_user_func($this->hash, $value) : preg_replace('/[^0-9a-z\.\_\-]/i', '', $value);
} | [
"private",
"function",
"getKey",
"(",
"$",
"value",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"hash",
")",
"?",
"call_user_func",
"(",
"$",
"this",
"->",
"hash",
",",
"$",
"value",
")",
":",
"preg_replace",
"(",
"'/[^0-9a-z\\.\\_\\-]/i'",... | Gets normalized key.
@param string $value The key to proccessing.
@return string | [
"Gets",
"normalized",
"key",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L217-L219 |
189,066 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.getPath | private function getPath($regionName = null) {
$cachePath = $this->cachePath;
if (!empty($regionName)) {
$cachePath .= DIRECTORY_SEPARATOR . $regionName;
}
if (!is_dir($cachePath)) {
if (!mkdir($cachePath, 0775, true)) {
throw new \Exception('Una... | php | private function getPath($regionName = null) {
$cachePath = $this->cachePath;
if (!empty($regionName)) {
$cachePath .= DIRECTORY_SEPARATOR . $regionName;
}
if (!is_dir($cachePath)) {
if (!mkdir($cachePath, 0775, true)) {
throw new \Exception('Una... | [
"private",
"function",
"getPath",
"(",
"$",
"regionName",
"=",
"null",
")",
"{",
"$",
"cachePath",
"=",
"$",
"this",
"->",
"cachePath",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"regionName",
")",
")",
"{",
"$",
"cachePath",
".=",
"DIRECTORY_SEPARATOR",
... | Gets directory path of cache storage.
@return string | [
"Gets",
"directory",
"path",
"of",
"cache",
"storage",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L226-L245 |
189,067 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.getCacheFilePaths | private function getCacheFilePaths($key, $regionName, &$policy, &$cache) {
$key = $this->getKey($key);
$path = $this->getPath($regionName);
$policy = $path . DIRECTORY_SEPARATOR . $key . '.policy';
$cache = $path . DIRECTORY_SEPARATOR . $key . '.cache';
} | php | private function getCacheFilePaths($key, $regionName, &$policy, &$cache) {
$key = $this->getKey($key);
$path = $this->getPath($regionName);
$policy = $path . DIRECTORY_SEPARATOR . $key . '.policy';
$cache = $path . DIRECTORY_SEPARATOR . $key . '.cache';
} | [
"private",
"function",
"getCacheFilePaths",
"(",
"$",
"key",
",",
"$",
"regionName",
",",
"&",
"$",
"policy",
",",
"&",
"$",
"cache",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"key",
")",
";",
"$",
"path",
"=",
"$",
"this"... | Gets path to cache and policy files.
@return void | [
"Gets",
"path",
"to",
"cache",
"and",
"policy",
"files",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L252-L257 |
189,068 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.containsFiles | private function containsFiles($key, $regionName, &$policy = null, &$cache = null) {
$this->getCacheFilePaths($key, $regionName, $policy, $cache);
if (!is_file($policy) && !is_file($cache)) {
return false;
}
elseif (!is_file($policy) && is_file($cache)) {
$this->... | php | private function containsFiles($key, $regionName, &$policy = null, &$cache = null) {
$this->getCacheFilePaths($key, $regionName, $policy, $cache);
if (!is_file($policy) && !is_file($cache)) {
return false;
}
elseif (!is_file($policy) && is_file($cache)) {
$this->... | [
"private",
"function",
"containsFiles",
"(",
"$",
"key",
",",
"$",
"regionName",
",",
"&",
"$",
"policy",
"=",
"null",
",",
"&",
"$",
"cache",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"getCacheFilePaths",
"(",
"$",
"key",
",",
"$",
"regionName",
","... | Checks whether the cache entry already exists in the cache. | [
"Checks",
"whether",
"the",
"cache",
"entry",
"already",
"exists",
"in",
"the",
"cache",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L262-L276 |
189,069 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.getCacheContent | private function getCacheContent($policy, $cache, &$data) {
$policyContent = $this->tryReadFile($policy);
$cacheContent = $this->tryReadFile($cache);
$data = null;
if ($policyContent === false || $cacheContent === false) {
$this->tryDeleteFile($policy);
$this->tr... | php | private function getCacheContent($policy, $cache, &$data) {
$policyContent = $this->tryReadFile($policy);
$cacheContent = $this->tryReadFile($cache);
$data = null;
if ($policyContent === false || $cacheContent === false) {
$this->tryDeleteFile($policy);
$this->tr... | [
"private",
"function",
"getCacheContent",
"(",
"$",
"policy",
",",
"$",
"cache",
",",
"&",
"$",
"data",
")",
"{",
"$",
"policyContent",
"=",
"$",
"this",
"->",
"tryReadFile",
"(",
"$",
"policy",
")",
";",
"$",
"cacheContent",
"=",
"$",
"this",
"->",
... | Gets content of cache entry.
@return bool | [
"Gets",
"content",
"of",
"cache",
"entry",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L283-L307 |
189,070 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.addCache | private function addCache($policy, $cache, $value, $duration) {
$content = is_callable($value) ? $value() : $value;
$policyContent = json_encode(array('absoluteExpiration' => $duration > 0 ? time() + $duration : 0));
if ($this->tryWriteFile($policy, $policyContent) === true) {
if (... | php | private function addCache($policy, $cache, $value, $duration) {
$content = is_callable($value) ? $value() : $value;
$policyContent = json_encode(array('absoluteExpiration' => $duration > 0 ? time() + $duration : 0));
if ($this->tryWriteFile($policy, $policyContent) === true) {
if (... | [
"private",
"function",
"addCache",
"(",
"$",
"policy",
",",
"$",
"cache",
",",
"$",
"value",
",",
"$",
"duration",
")",
"{",
"$",
"content",
"=",
"is_callable",
"(",
"$",
"value",
")",
"?",
"$",
"value",
"(",
")",
":",
"$",
"value",
";",
"$",
"po... | Saves cache. | [
"Saves",
"cache",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L312-L324 |
189,071 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.tryDeleteFile | private function tryDeleteFile($path) {
$interval = 100000;
$totalTime = 0;
while (file_exists($path) && !unlink($path)) {
if ($totalTime >= $this->accessTime) {
return false;
}
usleep($interval);
$totalTime += $interval;
... | php | private function tryDeleteFile($path) {
$interval = 100000;
$totalTime = 0;
while (file_exists($path) && !unlink($path)) {
if ($totalTime >= $this->accessTime) {
return false;
}
usleep($interval);
$totalTime += $interval;
... | [
"private",
"function",
"tryDeleteFile",
"(",
"$",
"path",
")",
"{",
"$",
"interval",
"=",
"100000",
";",
"$",
"totalTime",
"=",
"0",
";",
"while",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",
"!",
"unlink",
"(",
"$",
"path",
")",
")",
"{",
"if"... | Trying to delete the specified file.
@param string $path The path to file to remove.
@return bool | [
"Trying",
"to",
"delete",
"the",
"specified",
"file",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L333-L348 |
189,072 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.tryReadFile | private function tryReadFile($path) {
if (!file_exists($path)) {
return false;
}
$interval = 100000;
$totalTime = 0;
while (($result = file_get_contents($path)) === false) {
if ($totalTime >= $this->accessTime) {
return false;
... | php | private function tryReadFile($path) {
if (!file_exists($path)) {
return false;
}
$interval = 100000;
$totalTime = 0;
while (($result = file_get_contents($path)) === false) {
if ($totalTime >= $this->accessTime) {
return false;
... | [
"private",
"function",
"tryReadFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"interval",
"=",
"100000",
";",
"$",
"totalTime",
"=",
"0",
";",
"while",
"(",
"(",
... | Trying to read the file.
@param string $path The path to the file to be read..
@return string|bool | [
"Trying",
"to",
"read",
"the",
"file",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L357-L376 |
189,073 | php-mvc-project/php-mvc | src/FileCacheProvider.php | FileCacheProvider.tryWriteFile | private function tryWriteFile($path, $content) {
$interval = 100000;
$totalTime = 0;
while (file_put_contents($path, $content) === false) {
if ($totalTime >= $this->accessTime) {
return false;
}
usleep($interval);
$totalTime += $... | php | private function tryWriteFile($path, $content) {
$interval = 100000;
$totalTime = 0;
while (file_put_contents($path, $content) === false) {
if ($totalTime >= $this->accessTime) {
return false;
}
usleep($interval);
$totalTime += $... | [
"private",
"function",
"tryWriteFile",
"(",
"$",
"path",
",",
"$",
"content",
")",
"{",
"$",
"interval",
"=",
"100000",
";",
"$",
"totalTime",
"=",
"0",
";",
"while",
"(",
"file_put_contents",
"(",
"$",
"path",
",",
"$",
"content",
")",
"===",
"false",... | Trying to save the file.
@return bool | [
"Trying",
"to",
"save",
"the",
"file",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/FileCacheProvider.php#L383-L398 |
189,074 | php-mvc-project/php-mvc | src/ModelState.php | ModelState.isValid | public function isValid($key = null) {
if (isset($key)) {
return empty($this->errors[$key]);
}
else {
return empty($this->errors);
}
} | php | public function isValid($key = null) {
if (isset($key)) {
return empty($this->errors[$key]);
}
else {
return empty($this->errors);
}
} | [
"public",
"function",
"isValid",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"key",
")",
")",
"{",
"return",
"empty",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
"]",
")",
";",
"}",
"else",
"{",
"return",
"empty... | Returns true if the state does not contain errors; otherwise, false.
@param string $key If the key is specified, only the specified key will be checked for errors.
@return bool | [
"Returns",
"true",
"if",
"the",
"state",
"does",
"not",
"contain",
"errors",
";",
"otherwise",
"false",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ModelState.php#L61-L68 |
189,075 | php-mvc-project/php-mvc | src/ModelState.php | ModelState.getErrors | public function getErrors($key = null) {
if (isset($key)) {
return !empty($this->errors[$key]) ? $this->errors[$key] : array();
}
else {
return $this->errors;
}
} | php | public function getErrors($key = null) {
if (isset($key)) {
return !empty($this->errors[$key]) ? $this->errors[$key] : array();
}
else {
return $this->errors;
}
} | [
"public",
"function",
"getErrors",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"key",
")",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"this",
"->",
"errors"... | Returns errors of the model state.
@param string $key If the key is specified, only errors for the specified key will be returned.
@return array | [
"Returns",
"errors",
"of",
"the",
"model",
"state",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ModelState.php#L77-L84 |
189,076 | php-mvc-project/php-mvc | src/ModelState.php | ModelState.getKeyValuePair | public function getKeyValuePair() {
$result = array();
foreach ($this->items as $key => $entry) {
$result[$key] = $entry->value;
}
return $result;
} | php | public function getKeyValuePair() {
$result = array();
foreach ($this->items as $key => $entry) {
$result[$key] = $entry->value;
}
return $result;
} | [
"public",
"function",
"getKeyValuePair",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"key",
"=>",
"$",
"entry",
")",
"{",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"$",
"entry"... | Gets the key-value pair.
@return array | [
"Gets",
"the",
"key",
"-",
"value",
"pair",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ModelState.php#L91-L99 |
189,077 | php-mvc-project/php-mvc | src/ModelState.php | ModelState.getValues | public function getValues() {
$result = array();
foreach ($this->items as $key => $entry) {
$result[] = $entry->value;
}
return $result;
} | php | public function getValues() {
$result = array();
foreach ($this->items as $key => $entry) {
$result[] = $entry->value;
}
return $result;
} | [
"public",
"function",
"getValues",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"key",
"=>",
"$",
"entry",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"entry",
"->",
"value",
... | Gets the value sequence.
@return array | [
"Gets",
"the",
"value",
"sequence",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ModelState.php#L115-L123 |
189,078 | php-mvc-project/php-mvc | src/ModelState.php | ModelState.addError | public function addError($key, $error) {
if (is_array($key)) {
$key = implode('_', $key);
}
if (array_key_exists($key, $this->errors)) {
$this->errors[$key][] = $error;
}
else {
$this->errors[$key] = array($error);
}
} | php | public function addError($key, $error) {
if (is_array($key)) {
$key = implode('_', $key);
}
if (array_key_exists($key, $this->errors)) {
$this->errors[$key][] = $error;
}
else {
$this->errors[$key] = array($error);
}
} | [
"public",
"function",
"addError",
"(",
"$",
"key",
",",
"$",
"error",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"implode",
"(",
"'_'",
",",
"$",
"key",
")",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"... | Adds the specified errorMessage to the Errors instance that is associated with the specified key.
@param string $key The key of state to add error.
@param mixed $error The error or error message to add.
@return void | [
"Adds",
"the",
"specified",
"errorMessage",
"to",
"the",
"Errors",
"instance",
"that",
"is",
"associated",
"with",
"the",
"specified",
"key",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ModelState.php#L133-L144 |
189,079 | php-mvc-project/php-mvc | src/DefaultRouteProvider.php | DefaultRouteProvider.ignore | public function ignore($template, $constraints = null) {
$route = new Route();
$route->template = $template;
$route->constraints = $constraints;
$route->ignore = true;
$this->ignored->add($route);
} | php | public function ignore($template, $constraints = null) {
$route = new Route();
$route->template = $template;
$route->constraints = $constraints;
$route->ignore = true;
$this->ignored->add($route);
} | [
"public",
"function",
"ignore",
"(",
"$",
"template",
",",
"$",
"constraints",
"=",
"null",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
")",
";",
"$",
"route",
"->",
"template",
"=",
"$",
"template",
";",
"$",
"route",
"->",
"constraints",
"=",... | Adds an URL pattern that should not be checked for matches against routes if a request URL meets the specified constraints.
@param string $template The URL pattern to be ignored.
@param array $constraints An associative array containing regular expressions for checking the elements of the route.
@return void | [
"Adds",
"an",
"URL",
"pattern",
"that",
"should",
"not",
"be",
"checked",
"for",
"matches",
"against",
"routes",
"if",
"a",
"request",
"URL",
"meets",
"the",
"specified",
"constraints",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/DefaultRouteProvider.php#L188-L196 |
189,080 | php-mvc-project/php-mvc | src/Filter.php | Filter.add | public static function add($actionOrFilterName, $filterName = null) {
if (empty($filterName)) {
$filterName = $actionOrFilterName;
$actionOrFilterName = '.';
}
if ($actionOrFilterName != '.' && !self::$actionContext->actionNameEquals($actionOrFilterName)) {
r... | php | public static function add($actionOrFilterName, $filterName = null) {
if (empty($filterName)) {
$filterName = $actionOrFilterName;
$actionOrFilterName = '.';
}
if ($actionOrFilterName != '.' && !self::$actionContext->actionNameEquals($actionOrFilterName)) {
r... | [
"public",
"static",
"function",
"add",
"(",
"$",
"actionOrFilterName",
",",
"$",
"filterName",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filterName",
")",
")",
"{",
"$",
"filterName",
"=",
"$",
"actionOrFilterName",
";",
"$",
"actionOrFilterNam... | Adds a filter.
@param string $actionOrFilterName The action name or filter name, if the filter should be used for the current controller.
@param string $filterName The name of the filter, if the name of the action is specified in the first parameter.
@return void | [
"Adds",
"a",
"filter",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Filter.php#L55-L70 |
189,081 | mmamedov/page-cache | src/Storage/FileSystem/FileSystem.php | FileSystem.writeAttempt | public function writeAttempt()
{
$result = self::OK;
if (empty($this->filepath)) {
return self::ERROR;
}
/**
* Open the file for writing only. If the file does not exist, it is created.
* If it exists, it is not truncated (as opposed to 'w'). File poin... | php | public function writeAttempt()
{
$result = self::OK;
if (empty($this->filepath)) {
return self::ERROR;
}
/**
* Open the file for writing only. If the file does not exist, it is created.
* If it exists, it is not truncated (as opposed to 'w'). File poin... | [
"public",
"function",
"writeAttempt",
"(",
")",
"{",
"$",
"result",
"=",
"self",
"::",
"OK",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"filepath",
")",
")",
"{",
"return",
"self",
"::",
"ERROR",
";",
"}",
"/**\n * Open the file for writing o... | Attempt to write into the file. If lock is not acquired, file is not written.
@return bool
@throws \Exception | [
"Attempt",
"to",
"write",
"into",
"the",
"file",
".",
"If",
"lock",
"is",
"not",
"acquired",
"file",
"is",
"not",
"written",
"."
] | 8b41cea121c3687b2e485bd9ab17ed4ede222754 | https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/FileSystem.php#L86-L154 |
189,082 | mmamedov/page-cache | src/Storage/FileSystem/FileSystem.php | FileSystem.setFileLock | public function setFileLock($file_lock)
{
if (empty($file_lock) && $file_lock !== false) {
throw new PageCacheException(__CLASS__ . ' file lock can not be empty. To disable set to boolean false.');
}
$this->file_lock = $file_lock;
} | php | public function setFileLock($file_lock)
{
if (empty($file_lock) && $file_lock !== false) {
throw new PageCacheException(__CLASS__ . ' file lock can not be empty. To disable set to boolean false.');
}
$this->file_lock = $file_lock;
} | [
"public",
"function",
"setFileLock",
"(",
"$",
"file_lock",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"file_lock",
")",
"&&",
"$",
"file_lock",
"!==",
"false",
")",
"{",
"throw",
"new",
"PageCacheException",
"(",
"__CLASS__",
".",
"' file lock can not be empty. ... | Set file locking logic
@param false|int $file_lock PHP file lock constant or false for disabling
@throws \Exception | [
"Set",
"file",
"locking",
"logic"
] | 8b41cea121c3687b2e485bd9ab17ed4ede222754 | https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/FileSystem.php#L162-L168 |
189,083 | mmamedov/page-cache | src/Storage/FileSystem/FileSystem.php | FileSystem.setFilePath | public function setFilePath($filepath)
{
if (!isset($filepath) || empty($filepath)) {
throw new PageCacheException(__CLASS__ . ' file path not set or empty');
}
$this->filepath = $filepath;
} | php | public function setFilePath($filepath)
{
if (!isset($filepath) || empty($filepath)) {
throw new PageCacheException(__CLASS__ . ' file path not set or empty');
}
$this->filepath = $filepath;
} | [
"public",
"function",
"setFilePath",
"(",
"$",
"filepath",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"filepath",
")",
"||",
"empty",
"(",
"$",
"filepath",
")",
")",
"{",
"throw",
"new",
"PageCacheException",
"(",
"__CLASS__",
".",
"' file path not set o... | Set filepath of the cache file.
@param string $filepath cache file path
@throws \Exception | [
"Set",
"filepath",
"of",
"the",
"cache",
"file",
"."
] | 8b41cea121c3687b2e485bd9ab17ed4ede222754 | https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/FileSystem.php#L196-L203 |
189,084 | mmamedov/page-cache | src/Storage/CacheItemStorage.php | CacheItemStorage.randomizeExpirationTime | private function randomizeExpirationTime(CacheItemInterface $item)
{
// Get expires time (if previously set by headers forwarding)
$expiresAtTimestamp = $item->getExpiresAt() ? $item->getExpiresAt()->getTimestamp() : null;
// Generate expires time from creation date and default interval
... | php | private function randomizeExpirationTime(CacheItemInterface $item)
{
// Get expires time (if previously set by headers forwarding)
$expiresAtTimestamp = $item->getExpiresAt() ? $item->getExpiresAt()->getTimestamp() : null;
// Generate expires time from creation date and default interval
... | [
"private",
"function",
"randomizeExpirationTime",
"(",
"CacheItemInterface",
"$",
"item",
")",
"{",
"// Get expires time (if previously set by headers forwarding)",
"$",
"expiresAtTimestamp",
"=",
"$",
"item",
"->",
"getExpiresAt",
"(",
")",
"?",
"$",
"item",
"->",
"get... | Calculate and returns item's expiration time.
Cache expiration is cacheExpire seconds +/- a random value of seconds, from -6 to 6.
So although expiration is set for example 200 seconds, it is not guaranteed that it will expire in exactly
that many seconds. It could expire at 200 seconds, but also could expire in 206 ... | [
"Calculate",
"and",
"returns",
"item",
"s",
"expiration",
"time",
"."
] | 8b41cea121c3687b2e485bd9ab17ed4ede222754 | https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/CacheItemStorage.php#L124-L135 |
189,085 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.set | public static function set($key, $value) {
if (!isset(self::$config['settings'])) {
self::$config['settings'] = array();
}
self::$config['settings'][$key] = $value;
} | php | public static function set($key, $value) {
if (!isset(self::$config['settings'])) {
self::$config['settings'] = array();
}
self::$config['settings'][$key] = $value;
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"config",
"[",
"'settings'",
"]",
")",
")",
"{",
"self",
"::",
"$",
"config",
"[",
"'settings'",
"]",
"=",
"arra... | Adds a custom setting.
@param string $key The unique key.
@param mixed $value The value.
@return void | [
"Adds",
"a",
"custom",
"setting",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L166-L172 |
189,086 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.build | public static function build() {
try {
self::init();
self::dependencies();
$route = self::canRoute();
if ($route !== false) {
$actionContext = self::actionContext($route);
if ($actionContext !== null && !self::cached(... | php | public static function build() {
try {
self::init();
self::dependencies();
$route = self::canRoute();
if ($route !== false) {
$actionContext = self::actionContext($route);
if ($actionContext !== null && !self::cached(... | [
"public",
"static",
"function",
"build",
"(",
")",
"{",
"try",
"{",
"self",
"::",
"init",
"(",
")",
";",
"self",
"::",
"dependencies",
"(",
")",
";",
"$",
"route",
"=",
"self",
"::",
"canRoute",
"(",
")",
";",
"if",
"(",
"$",
"route",
"!==",
"fal... | Processes the current HTTP request.
@return void | [
"Processes",
"the",
"current",
"HTTP",
"request",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L210-L236 |
189,087 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.headers | private static function headers() {
if (empty(self::$config['httpHeaders'])) {
return;
}
$response = self::$config['httpContext']->getResponse();
$response->setHeaders(self::$config['httpHeaders']);
} | php | private static function headers() {
if (empty(self::$config['httpHeaders'])) {
return;
}
$response = self::$config['httpContext']->getResponse();
$response->setHeaders(self::$config['httpHeaders']);
} | [
"private",
"static",
"function",
"headers",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"config",
"[",
"'httpHeaders'",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"response",
"=",
"self",
"::",
"$",
"config",
"[",
"'httpContext'",
"]... | Adds headers.
@return void | [
"Adds",
"headers",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L243-L250 |
189,088 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.canRoute | private static function canRoute() {
$httpContext = self::$config['httpContext'];
if ($httpContext->isIgnoredRoute()) {
$request = $httpContext->getRequest();
$response = $httpContext->getResponse();
$response->clear();
if (!file_exists($request->documen... | php | private static function canRoute() {
$httpContext = self::$config['httpContext'];
if ($httpContext->isIgnoredRoute()) {
$request = $httpContext->getRequest();
$response = $httpContext->getResponse();
$response->clear();
if (!file_exists($request->documen... | [
"private",
"static",
"function",
"canRoute",
"(",
")",
"{",
"$",
"httpContext",
"=",
"self",
"::",
"$",
"config",
"[",
"'httpContext'",
"]",
";",
"if",
"(",
"$",
"httpContext",
"->",
"isIgnoredRoute",
"(",
")",
")",
"{",
"$",
"request",
"=",
"$",
"http... | Looks for a suitable route and checks whether the request can be executed.
@return Route|bool | [
"Looks",
"for",
"a",
"suitable",
"route",
"and",
"checks",
"whether",
"the",
"request",
"can",
"be",
"executed",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L392-L421 |
189,089 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.cached | private static function cached($actionContext) {
$httpContext = $actionContext->getHttpContext();
$request = $httpContext->getRequest();
// TODO: support POST
if ($request->isPost()) {
return false;
}
$cacheSettings = InternalHelper::getStaticPropertyValue('... | php | private static function cached($actionContext) {
$httpContext = $actionContext->getHttpContext();
$request = $httpContext->getRequest();
// TODO: support POST
if ($request->isPost()) {
return false;
}
$cacheSettings = InternalHelper::getStaticPropertyValue('... | [
"private",
"static",
"function",
"cached",
"(",
"$",
"actionContext",
")",
"{",
"$",
"httpContext",
"=",
"$",
"actionContext",
"->",
"getHttpContext",
"(",
")",
";",
"$",
"request",
"=",
"$",
"httpContext",
"->",
"getRequest",
"(",
")",
";",
"// TODO: suppor... | Checks the cache and outputs the result if there is data in the cache for the current request.
@param ActionContext $actionContext The action context.
@return bool | [
"Checks",
"the",
"cache",
"and",
"outputs",
"the",
"result",
"if",
"there",
"is",
"data",
"in",
"the",
"cache",
"for",
"the",
"current",
"request",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L525-L593 |
189,090 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.caching | private static function caching($actionContext) {
$cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');
// no key, no cache
if (empty($cacheKey)) {
return;
}
$cacheSettings = InternalHelper::getStaticPropertyValue('\\PhpMvc\\OutputCache', 'settin... | php | private static function caching($actionContext) {
$cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');
// no key, no cache
if (empty($cacheKey)) {
return;
}
$cacheSettings = InternalHelper::getStaticPropertyValue('\\PhpMvc\\OutputCache', 'settin... | [
"private",
"static",
"function",
"caching",
"(",
"$",
"actionContext",
")",
"{",
"$",
"cacheKey",
"=",
"InternalHelper",
"::",
"getPropertyValue",
"(",
"$",
"actionContext",
",",
"'cacheKey'",
")",
";",
"// no key, no cache",
"if",
"(",
"empty",
"(",
"$",
"cac... | Caches the response, if possible.
@return void | [
"Caches",
"the",
"response",
"if",
"possible",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L600-L661 |
189,091 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.cachingPartial | private static function cachingPartial($actionContext, $eventArgs) {
$cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');
// no key, no cache
if (empty($cacheKey)) {
return;
}
$cache = $httpContext->getCache();
$cachePartSeq = $cache->ge... | php | private static function cachingPartial($actionContext, $eventArgs) {
$cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');
// no key, no cache
if (empty($cacheKey)) {
return;
}
$cache = $httpContext->getCache();
$cachePartSeq = $cache->ge... | [
"private",
"static",
"function",
"cachingPartial",
"(",
"$",
"actionContext",
",",
"$",
"eventArgs",
")",
"{",
"$",
"cacheKey",
"=",
"InternalHelper",
"::",
"getPropertyValue",
"(",
"$",
"actionContext",
",",
"'cacheKey'",
")",
";",
"// no key, no cache",
"if",
... | Caches the output in parts.
@return void | [
"Caches",
"the",
"output",
"in",
"parts",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L668-L689 |
189,092 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.cachingClient | private static function cachingClient($actionContext) {
$cacheSettings = InternalHelper::getStaticPropertyValue('\\PhpMvc\\OutputCache', 'settings');
$actionName = $actionContext->getActionName();
// location
if (!empty($cacheSettings[$actionName]['location'])) {
$location =... | php | private static function cachingClient($actionContext) {
$cacheSettings = InternalHelper::getStaticPropertyValue('\\PhpMvc\\OutputCache', 'settings');
$actionName = $actionContext->getActionName();
// location
if (!empty($cacheSettings[$actionName]['location'])) {
$location =... | [
"private",
"static",
"function",
"cachingClient",
"(",
"$",
"actionContext",
")",
"{",
"$",
"cacheSettings",
"=",
"InternalHelper",
"::",
"getStaticPropertyValue",
"(",
"'\\\\PhpMvc\\\\OutputCache'",
",",
"'settings'",
")",
";",
"$",
"actionName",
"=",
"$",
"actionC... | Sends the cache headers.
@return void | [
"Sends",
"the",
"cache",
"headers",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L696-L759 |
189,093 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.getCacheParams | private static function getCacheParams($actionContext, $cacheSettings, $parameterName, $value = null) {
$actionName = $actionContext->getActionName();
$params = array();
if ($parameterName != 'varyByCustom') {
ksort($value);
// action level
if (!empty($cache... | php | private static function getCacheParams($actionContext, $cacheSettings, $parameterName, $value = null) {
$actionName = $actionContext->getActionName();
$params = array();
if ($parameterName != 'varyByCustom') {
ksort($value);
// action level
if (!empty($cache... | [
"private",
"static",
"function",
"getCacheParams",
"(",
"$",
"actionContext",
",",
"$",
"cacheSettings",
",",
"$",
"parameterName",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"actionName",
"=",
"$",
"actionContext",
"->",
"getActionName",
"(",
")",
";",
... | Builds an array of parameters for the cache entry key.
@return array | [
"Builds",
"an",
"array",
"of",
"parameters",
"for",
"the",
"cache",
"entry",
"key",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L766-L821 |
189,094 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.filters | private static function filters($actionContext) {
$allFilters = InternalHelper::getStaticPropertyValue('\\PhpMvc\\Filter', 'filters');
$allFiltersInstance = array();
foreach ($allFilters as $actionName => $filters) {
foreach ($filters as $filterName) {
$className = $... | php | private static function filters($actionContext) {
$allFilters = InternalHelper::getStaticPropertyValue('\\PhpMvc\\Filter', 'filters');
$allFiltersInstance = array();
foreach ($allFilters as $actionName => $filters) {
foreach ($filters as $filterName) {
$className = $... | [
"private",
"static",
"function",
"filters",
"(",
"$",
"actionContext",
")",
"{",
"$",
"allFilters",
"=",
"InternalHelper",
"::",
"getStaticPropertyValue",
"(",
"'\\\\PhpMvc\\\\Filter'",
",",
"'filters'",
")",
";",
"$",
"allFiltersInstance",
"=",
"array",
"(",
")",... | Initializes the filters.
@return void | [
"Initializes",
"the",
"filters",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L828-L862 |
189,095 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.validation | private static function validation() {
if (isset(self::$config['validators'])) {
$validators = self::$config['validators'];
}
else {
$validators = true;
}
// action name validation
if ($validators === true || (!isset($validators['actionName']) || ... | php | private static function validation() {
if (isset(self::$config['validators'])) {
$validators = self::$config['validators'];
}
else {
$validators = true;
}
// action name validation
if ($validators === true || (!isset($validators['actionName']) || ... | [
"private",
"static",
"function",
"validation",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"config",
"[",
"'validators'",
"]",
")",
")",
"{",
"$",
"validators",
"=",
"self",
"::",
"$",
"config",
"[",
"'validators'",
"]",
";",
"}",
"els... | Checks the request and throws an exception if the request contains dangerous data.
@return void | [
"Checks",
"the",
"request",
"and",
"throws",
"an",
"exception",
"if",
"the",
"request",
"contains",
"dangerous",
"data",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L869-L934 |
189,096 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.render | private static function render($actionContext) {
$controller = $actionContext->getController();
// annotation and validation
$modelState = $actionContext->getModelState();
self::annotateAndValidateModel($modelState);
// filters
$actionExecutingContext = self::actionExec... | php | private static function render($actionContext) {
$controller = $actionContext->getController();
// annotation and validation
$modelState = $actionContext->getModelState();
self::annotateAndValidateModel($modelState);
// filters
$actionExecutingContext = self::actionExec... | [
"private",
"static",
"function",
"render",
"(",
"$",
"actionContext",
")",
"{",
"$",
"controller",
"=",
"$",
"actionContext",
"->",
"getController",
"(",
")",
";",
"// annotation and validation",
"$",
"modelState",
"=",
"$",
"actionContext",
"->",
"getModelState",... | Generates and renders the final result.
@param ActionContext $actionContext The action context.
@return void | [
"Generates",
"and",
"renders",
"the",
"final",
"result",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L953-L1041 |
189,097 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.executeAction | private static function executeAction($actionContext) {
$controller = $actionContext->getController();
$actionName = $actionContext->getActionName();
$action = new \ReflectionMethod($controller, $actionName);
if (!$action->isPublic()) {
throw new \Exception('Action methods m... | php | private static function executeAction($actionContext) {
$controller = $actionContext->getController();
$actionName = $actionContext->getActionName();
$action = new \ReflectionMethod($controller, $actionName);
if (!$action->isPublic()) {
throw new \Exception('Action methods m... | [
"private",
"static",
"function",
"executeAction",
"(",
"$",
"actionContext",
")",
"{",
"$",
"controller",
"=",
"$",
"actionContext",
"->",
"getController",
"(",
")",
";",
"$",
"actionName",
"=",
"$",
"actionContext",
"->",
"getActionName",
"(",
")",
";",
"$"... | Calls the action method and returns the result.
@return mixed | [
"Calls",
"the",
"action",
"method",
"and",
"returns",
"the",
"result",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L1298-L1308 |
189,098 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.actionExecutingFilters | private static function actionExecutingFilters($actionContext) {
$context = new ActionExecutingContext($actionContext);
$filters = $actionContext->getFilters();
foreach ($filters as $filter) {
$filter->actionExecuting($context);
}
return $context;
} | php | private static function actionExecutingFilters($actionContext) {
$context = new ActionExecutingContext($actionContext);
$filters = $actionContext->getFilters();
foreach ($filters as $filter) {
$filter->actionExecuting($context);
}
return $context;
} | [
"private",
"static",
"function",
"actionExecutingFilters",
"(",
"$",
"actionContext",
")",
"{",
"$",
"context",
"=",
"new",
"ActionExecutingContext",
"(",
"$",
"actionContext",
")",
";",
"$",
"filters",
"=",
"$",
"actionContext",
"->",
"getFilters",
"(",
")",
... | Calls the actionExecuting methods.
@param ActionContext $actionContext The context of the action.
@return ActionExecutingContext | [
"Calls",
"the",
"actionExecuting",
"methods",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L1317-L1327 |
189,099 | php-mvc-project/php-mvc | src/AppBuilder.php | AppBuilder.actionExecutedFilters | private static function actionExecutedFilters($actionContext, $actionResult, $exceptionContext = null) {
$context = new ActionExecutedContext($actionContext, $actionResult, $exceptionContext);
$filters = $actionContext->getFilters();
foreach ($filters as $filter) {
$filter->actionE... | php | private static function actionExecutedFilters($actionContext, $actionResult, $exceptionContext = null) {
$context = new ActionExecutedContext($actionContext, $actionResult, $exceptionContext);
$filters = $actionContext->getFilters();
foreach ($filters as $filter) {
$filter->actionE... | [
"private",
"static",
"function",
"actionExecutedFilters",
"(",
"$",
"actionContext",
",",
"$",
"actionResult",
",",
"$",
"exceptionContext",
"=",
"null",
")",
"{",
"$",
"context",
"=",
"new",
"ActionExecutedContext",
"(",
"$",
"actionContext",
",",
"$",
"actionR... | Calls the actionExecuted methods.
@param ActionContext $actionContext The context of the action.
@param ActionResult $actionResult The result of action.
@param ExceptionContext $exceptionContext The context of exception.
@return ActionExecutedContext | [
"Calls",
"the",
"actionExecuted",
"methods",
"."
] | 2523373c1cd3d77da73126a7ed60311b6e251d3a | https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L1338-L1348 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.