repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
multidots/cakephp-rest-api
src/Error/ApiExceptionRenderer.php
ApiExceptionRenderer.__prepareResponse
private function __prepareResponse($exception, $options = []) { $response = $this->_getController()->response; $code = $this->_code($exception); $response->getStatusCode($this->_code($exception)); Configure::write('apiExceptionMessage', $exception->getMessage()); $responseF...
php
private function __prepareResponse($exception, $options = []) { $response = $this->_getController()->response; $code = $this->_code($exception); $response->getStatusCode($this->_code($exception)); Configure::write('apiExceptionMessage', $exception->getMessage()); $responseF...
[ "private", "function", "__prepareResponse", "(", "$", "exception", ",", "$", "options", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "_getController", "(", ")", "->", "response", ";", "$", "code", "=", "$", "this", "->", "_code", ...
Prepare response. @param Exception $exception Exception @param array $options Array of options @return Response
[ "Prepare", "response", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Error/ApiExceptionRenderer.php#L77-L110
multidots/cakephp-rest-api
src/Controller/ApiErrorController.php
ApiErrorController.beforeRender
public function beforeRender(Event $event) { $this->httpStatusCode = $this->response->getStatusCode(); $messageArr = $this->response->withStatus($this->httpStatusCode); if (Configure::read('ApiRequest.debug') && isset($this->viewVars['error'])) { $this->apiResponse[$this->respo...
php
public function beforeRender(Event $event) { $this->httpStatusCode = $this->response->getStatusCode(); $messageArr = $this->response->withStatus($this->httpStatusCode); if (Configure::read('ApiRequest.debug') && isset($this->viewVars['error'])) { $this->apiResponse[$this->respo...
[ "public", "function", "beforeRender", "(", "Event", "$", "event", ")", "{", "$", "this", "->", "httpStatusCode", "=", "$", "this", "->", "response", "->", "getStatusCode", "(", ")", ";", "$", "messageArr", "=", "$", "this", "->", "response", "->", "withS...
beforeRender callback. @param Event $event Event. @return null
[ "beforeRender", "callback", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Controller/ApiErrorController.php#L22-L41
multidots/cakephp-rest-api
src/Utility/JwtToken.php
JwtToken.generateToken
public static function generateToken($payload = null) { if (empty($payload)) { return false; } $token = JWT::encode($payload, Configure::read('ApiRequest.jwtAuth.cypherKey'), Configure::read('ApiRequest.jwtAuth.tokenAlgorithm')); return $token; }
php
public static function generateToken($payload = null) { if (empty($payload)) { return false; } $token = JWT::encode($payload, Configure::read('ApiRequest.jwtAuth.cypherKey'), Configure::read('ApiRequest.jwtAuth.tokenAlgorithm')); return $token; }
[ "public", "static", "function", "generateToken", "(", "$", "payload", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "payload", ")", ")", "{", "return", "false", ";", "}", "$", "token", "=", "JWT", "::", "encode", "(", "$", "payload", ",", "C...
Generates a token based on payload @param mixed $payload Payload data to generate token @return string|bool Token or false
[ "Generates", "a", "token", "based", "on", "payload" ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Utility/JwtToken.php#L20-L29
multidots/cakephp-rest-api
src/View/ApiErrorView.php
ApiErrorView.initialize
public function initialize() { parent::initialize(); if ('xml' === Configure::read('ApiRequest.responseType')) { $this->response->withType('xml'); $this->_responseLayout = 'xml_error'; } else { $this->response->withType('json'); } }
php
public function initialize() { parent::initialize(); if ('xml' === Configure::read('ApiRequest.responseType')) { $this->response->withType('xml'); $this->_responseLayout = 'xml_error'; } else { $this->response->withType('json'); } }
[ "public", "function", "initialize", "(", ")", "{", "parent", "::", "initialize", "(", ")", ";", "if", "(", "'xml'", "===", "Configure", "::", "read", "(", "'ApiRequest.responseType'", ")", ")", "{", "$", "this", "->", "response", "->", "withType", "(", "...
Initialization hook method. @return void
[ "Initialization", "hook", "method", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/View/ApiErrorView.php#L29-L39
multidots/cakephp-rest-api
src/Utility/ApiRequestLogger.php
ApiRequestLogger.log
public static function log(Request $request, Response $response) { Configure::write('requestLogged', true); try { $apiRequests = TableRegistry::get('RestApi.ApiRequests'); $entityData = [ 'http_method' => $request->getMethod(), 'endpoint' => $...
php
public static function log(Request $request, Response $response) { Configure::write('requestLogged', true); try { $apiRequests = TableRegistry::get('RestApi.ApiRequests'); $entityData = [ 'http_method' => $request->getMethod(), 'endpoint' => $...
[ "public", "static", "function", "log", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "Configure", "::", "write", "(", "'requestLogged'", ",", "true", ")", ";", "try", "{", "$", "apiRequests", "=", "TableRegistry", "::", "get",...
Logs the request and response data into database. @param Request $request The \Cake\Network\Request object @param Response $response The \Cake\Network\Response object
[ "Logs", "the", "request", "and", "response", "data", "into", "database", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Utility/ApiRequestLogger.php#L22-L44
multidots/cakephp-rest-api
src/Controller/AppController.php
AppController.initialize
public function initialize() { parent::initialize(); $this->responseFormat = [ 'statusKey' => (null !== Configure::read('ApiRequest.responseFormat.statusKey')) ? Configure::read('ApiRequest.responseFormat.statusKey') : 'status', 'statusOkText' => (null !== Configure::read('A...
php
public function initialize() { parent::initialize(); $this->responseFormat = [ 'statusKey' => (null !== Configure::read('ApiRequest.responseFormat.statusKey')) ? Configure::read('ApiRequest.responseFormat.statusKey') : 'status', 'statusOkText' => (null !== Configure::read('A...
[ "public", "function", "initialize", "(", ")", "{", "parent", "::", "initialize", "(", ")", ";", "$", "this", "->", "responseFormat", "=", "[", "'statusKey'", "=>", "(", "null", "!==", "Configure", "::", "read", "(", "'ApiRequest.responseFormat.statusKey'", ")"...
Initialization hook method. @return void
[ "Initialization", "hook", "method", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Controller/AppController.php#L63-L82
multidots/cakephp-rest-api
src/Controller/AppController.php
AppController.beforeRender
public function beforeRender(Event $event) { parent::beforeRender($event); $this->response->getStatusCode($this->httpStatusCode); if (200 != $this->httpStatusCode) { $this->responseStatus = $this->responseFormat['statusNokText']; } $response = [ $th...
php
public function beforeRender(Event $event) { parent::beforeRender($event); $this->response->getStatusCode($this->httpStatusCode); if (200 != $this->httpStatusCode) { $this->responseStatus = $this->responseFormat['statusNokText']; } $response = [ $th...
[ "public", "function", "beforeRender", "(", "Event", "$", "event", ")", "{", "parent", "::", "beforeRender", "(", "$", "event", ")", ";", "$", "this", "->", "response", "->", "getStatusCode", "(", "$", "this", "->", "httpStatusCode", ")", ";", "if", "(", ...
Before render callback. @param Event $event The beforeRender event. @return \Cake\Network\Response|null
[ "Before", "render", "callback", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Controller/AppController.php#L90-L112
jack-theripper/yandex
src/Disk.php
Disk.toArray
public function toArray(array $allowed = null) { if ( ! $this->_toArray()) { $response = $this->send(new Request($this->uri, 'GET')); if ($response->getStatusCode() == 200) { $response = json_decode($response->getBody(), true); if ( ! is_array($response)) { throw new UnsupportedExceptio...
php
public function toArray(array $allowed = null) { if ( ! $this->_toArray()) { $response = $this->send(new Request($this->uri, 'GET')); if ($response->getStatusCode() == 200) { $response = json_decode($response->getBody(), true); if ( ! is_array($response)) { throw new UnsupportedExceptio...
[ "public", "function", "toArray", "(", "array", "$", "allowed", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_toArray", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "send", "(", "new", "Request", "(", "$", "this", "->...
Получает информацию о диске @param array $allowed @return array @example array (size=5) 'trash_size' => int 9449304 'total_space' => float 33822867456 'used_space' => float 25863284099 'free_space' => float 7959583357 'system_folders' => array (size=2) 'applications' => string 'disk:/Приложения' (length=26) 'downloa...
[ "Получает", "информацию", "о", "диске" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L168-L190
jack-theripper/yandex
src/Disk.php
Disk.getResource
public function getResource($path, $limit = 20, $offset = 0) { if ( ! is_string($path)) { throw new \InvalidArgumentException('Ресурс, должен быть строкового типа - путь к файлу/папке.'); } if (stripos($path, 'app:/') !== 0 && stripos($path, 'disk:/') !== 0) { $path = 'disk:/'.ltrim($path, ' /'); } ...
php
public function getResource($path, $limit = 20, $offset = 0) { if ( ! is_string($path)) { throw new \InvalidArgumentException('Ресурс, должен быть строкового типа - путь к файлу/папке.'); } if (stripos($path, 'app:/') !== 0 && stripos($path, 'disk:/') !== 0) { $path = 'disk:/'.ltrim($path, ' /'); } ...
[ "public", "function", "getResource", "(", "$", "path", ",", "$", "limit", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "!", "is_string", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Ресурс...
Работа с ресурсами на диске @param string $path Путь к новому либо уже существующему ресурсу @param integer $limit @param integer $offset @return \Arhitector\Yandex\Disk\Resource\Closed @example $disk->getResource('any_file.ext') -> upload( __DIR__.'/file_to_upload'); $disk->getResource('any_file.ext') ...
[ "Работа", "с", "ресурсами", "на", "диске" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L220-L234
jack-theripper/yandex
src/Disk.php
Disk.getPublishResource
public function getPublishResource($public_key, $limit = 20, $offset = 0) { if ( ! is_string($public_key)) { throw new \InvalidArgumentException('Публичный ключ ресурса должен быть строкового типа.'); } return (new Disk\Resource\Opened($public_key, $this, $this->uri)) ->setLimit($limit, $offset); }
php
public function getPublishResource($public_key, $limit = 20, $offset = 0) { if ( ! is_string($public_key)) { throw new \InvalidArgumentException('Публичный ключ ресурса должен быть строкового типа.'); } return (new Disk\Resource\Opened($public_key, $this, $this->uri)) ->setLimit($limit, $offset); }
[ "public", "function", "getPublishResource", "(", "$", "public_key", ",", "$", "limit", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "!", "is_string", "(", "$", "public_key", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException"...
Работа с опубликованными ресурсами @param mixed $public_key Публичный ключ к опубликованному ресурсу. @return \Arhitector\Yandex\Disk\Resource\Opened @example $disk->getPublishResource('public_key') -> toArray() array (size=11) 'public_key' => string 'wICbu9SPnY3uT4tFA6P99YXJwuAr2TU7oGYu1fTq68Y=' (length=44) 'name...
[ "Работа", "с", "опубликованными", "ресурсами" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L300-L309
jack-theripper/yandex
src/Disk.php
Disk.getPublishResources
public function getPublishResources($limit = 20, $offset = 0) { return (new Disk\Resource\Collection(function($parameters) { $previous = $this->setAccessTokenRequired(false); $response = $this->send((new Request($this->uri->withPath($this->uri->getPath().'resources/public') ->withQuery(http_build_query($pa...
php
public function getPublishResources($limit = 20, $offset = 0) { return (new Disk\Resource\Collection(function($parameters) { $previous = $this->setAccessTokenRequired(false); $response = $this->send((new Request($this->uri->withPath($this->uri->getPath().'resources/public') ->withQuery(http_build_query($pa...
[ "public", "function", "getPublishResources", "(", "$", "limit", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "return", "(", "new", "Disk", "\\", "Resource", "\\", "Collection", "(", "function", "(", "$", "parameters", ")", "{", "$", "previous", "...
Получение списка опубликованных файлов и папок @param int $limit @param int $offset @return \Arhitector\Yandex\Disk\Resource\Collection
[ "Получение", "списка", "опубликованных", "файлов", "и", "папок" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L319-L342
jack-theripper/yandex
src/Disk.php
Disk.getTrashResource
public function getTrashResource($path, $limit = 20, $offset = 0) { if ( ! is_string($path)) { throw new \InvalidArgumentException('Ресурс, должен быть строкового типа - путь к файлу/папке, либо NULL'); } if (stripos($path, 'trash:/') === 0) { $path = substr($path, 7); } return (new Disk\Resource...
php
public function getTrashResource($path, $limit = 20, $offset = 0) { if ( ! is_string($path)) { throw new \InvalidArgumentException('Ресурс, должен быть строкового типа - путь к файлу/папке, либо NULL'); } if (stripos($path, 'trash:/') === 0) { $path = substr($path, 7); } return (new Disk\Resource...
[ "public", "function", "getTrashResource", "(", "$", "path", ",", "$", "limit", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "!", "is_string", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Р...
Ресурсы в корзине. @param string $path путь к файлу в корзине @param int $limit @param int $offset @return \Arhitector\Yandex\Disk\Resource\Removed @example $disk->getTrashResource('file.ext') -> toArray() // файл в корзине $disk->getTrashResource('trash:/file.ext') -> delete()
[ "Ресурсы", "в", "корзине", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L357-L371
jack-theripper/yandex
src/Disk.php
Disk.getTrashResources
public function getTrashResources($limit = 20, $offset = 0) { return (new Disk\Resource\Collection(function($parameters) { if ( ! empty($parameters['sort']) && ! in_array($parameters['sort'], ['deleted', 'created', '-deleted', '-created']) ) { throw new \UnexpectedValueException('Допустимые значения...
php
public function getTrashResources($limit = 20, $offset = 0) { return (new Disk\Resource\Collection(function($parameters) { if ( ! empty($parameters['sort']) && ! in_array($parameters['sort'], ['deleted', 'created', '-deleted', '-created']) ) { throw new \UnexpectedValueException('Допустимые значения...
[ "public", "function", "getTrashResources", "(", "$", "limit", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "return", "(", "new", "Disk", "\\", "Resource", "\\", "Collection", "(", "function", "(", "$", "parameters", ")", "{", "if", "(", "!", "e...
Содержимое всей корзины. @param int $limit @param int $offset @return \Arhitector\Yandex\Disk\Resource\Collection
[ "Содержимое", "всей", "корзины", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L381-L410
jack-theripper/yandex
src/Disk.php
Disk.cleanTrash
public function cleanTrash() { $response = $this->send(new Request($this->uri->withPath($this->uri->getPath().'trash/resources'), 'DELETE')); if ($response->getStatusCode() == 204) { $response = json_decode($response->getBody(), true); if ( ! empty($response['operation'])) { return $response['oper...
php
public function cleanTrash() { $response = $this->send(new Request($this->uri->withPath($this->uri->getPath().'trash/resources'), 'DELETE')); if ($response->getStatusCode() == 204) { $response = json_decode($response->getBody(), true); if ( ! empty($response['operation'])) { return $response['oper...
[ "public", "function", "cleanTrash", "(", ")", "{", "$", "response", "=", "$", "this", "->", "send", "(", "new", "Request", "(", "$", "this", "->", "uri", "->", "withPath", "(", "$", "this", "->", "uri", "->", "getPath", "(", ")", ".", "'trash/resourc...
Очистить корзину. @return bool|\Arhitector\Yandex\Disk\Operation
[ "Очистить", "корзину", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L417-L434
jack-theripper/yandex
src/Disk.php
Disk.uploaded
public function uploaded($limit = 20, $offset = 0) { return (new Disk\Resource\Collection(function($parameters) { $response = $this->send((new Request($this->uri->withPath($this->uri->getPath().'resources/last-uploaded') ->withQuery(http_build_query($parameters, null, '&')), 'GET'))); if ($response->getSt...
php
public function uploaded($limit = 20, $offset = 0) { return (new Disk\Resource\Collection(function($parameters) { $response = $this->send((new Request($this->uri->withPath($this->uri->getPath().'resources/last-uploaded') ->withQuery(http_build_query($parameters, null, '&')), 'GET'))); if ($response->getSt...
[ "public", "function", "uploaded", "(", "$", "limit", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "return", "(", "new", "Disk", "\\", "Resource", "\\", "Collection", "(", "function", "(", "$", "parameters", ")", "{", "$", "response", "=", "$", ...
Последние загруженные файлы @param integer $limit @param integer $offset @return \Arhitector\Yandex\Disk\Resource\Collection @example $disk->uploaded(limit, offset) // коллекия закрытых ресурсов
[ "Последние", "загруженные", "файлы" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L448-L469
jack-theripper/yandex
src/Disk.php
Disk.send
public function send(RequestInterface $request) { $response = parent::send($request); if ($response->getStatusCode() == 202) { if (($responseBody = json_decode($response->getBody(), true)) && isset($responseBody['href'])) { $operation = new Uri($responseBody['href']); if ( ! $operation->getQuery(...
php
public function send(RequestInterface $request) { $response = parent::send($request); if ($response->getStatusCode() == 202) { if (($responseBody = json_decode($response->getBody(), true)) && isset($responseBody['href'])) { $operation = new Uri($responseBody['href']); if ( ! $operation->getQuery(...
[ "public", "function", "send", "(", "RequestInterface", "$", "request", ")", "{", "$", "response", "=", "parent", "::", "send", "(", "$", "request", ")", ";", "if", "(", "$", "response", "->", "getStatusCode", "(", ")", "==", "202", ")", "{", "if", "(...
Отправляет запрос. @param \Psr\Http\Message\RequestInterface $request @return \Psr\Http\Message\ResponseInterface
[ "Отправляет", "запрос", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk.php#L523-L546
jack-theripper/yandex
src/Disk/Operation.php
Operation.getStatus
public function getStatus() { $response = $this->parent->send(new Request($this->uri->withPath($this->uri->getPath().'operations/' .$this->getIdentifier()), 'GET')); if ($response->getStatusCode() == 200) { $response = json_decode($response->getBody(), true); if (isset($response['status'])) { r...
php
public function getStatus() { $response = $this->parent->send(new Request($this->uri->withPath($this->uri->getPath().'operations/' .$this->getIdentifier()), 'GET')); if ($response->getStatusCode() == 200) { $response = json_decode($response->getBody(), true); if (isset($response['status'])) { r...
[ "public", "function", "getStatus", "(", ")", "{", "$", "response", "=", "$", "this", "->", "parent", "->", "send", "(", "new", "Request", "(", "$", "this", "->", "uri", "->", "withPath", "(", "$", "this", "->", "uri", "->", "getPath", "(", ")", "."...
Текстовый статус операции. @return string|null NULL если не удалось получить статус.
[ "Текстовый", "статус", "операции", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Operation.php#L80-L96
jack-theripper/yandex
src/Disk/Filter/PreviewTrait.php
PreviewTrait.setPreviewCrop
public function setPreviewCrop($crop) { $this->isModified = true; $this->parameters['preview_crop'] = (bool) $crop; return $this; }
php
public function setPreviewCrop($crop) { $this->isModified = true; $this->parameters['preview_crop'] = (bool) $crop; return $this; }
[ "public", "function", "setPreviewCrop", "(", "$", "crop", ")", "{", "$", "this", "->", "isModified", "=", "true", ";", "$", "this", "->", "parameters", "[", "'preview_crop'", "]", "=", "(", "bool", ")", "$", "crop", ";", "return", "$", "this", ";", "...
Обрезать превью согласно размеру @param boolean $crop @return $this
[ "Обрезать", "превью", "согласно", "размеру" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Filter/PreviewTrait.php#L31-L37
jack-theripper/yandex
src/Disk/Filter/PreviewTrait.php
PreviewTrait.setPreview
public function setPreview($preview) { if (is_scalar($preview)) { $preview = strtoupper($preview); $previewNum = str_replace('X', '', $preview, $replaces); if (in_array($preview, ['S', 'M', 'L', 'XL', 'XXL', 'XXXL']) || (is_numeric($previewNum) && $replaces < 2)) { if (is_numeric($previewNum)) ...
php
public function setPreview($preview) { if (is_scalar($preview)) { $preview = strtoupper($preview); $previewNum = str_replace('X', '', $preview, $replaces); if (in_array($preview, ['S', 'M', 'L', 'XL', 'XXL', 'XXXL']) || (is_numeric($previewNum) && $replaces < 2)) { if (is_numeric($previewNum)) ...
[ "public", "function", "setPreview", "(", "$", "preview", ")", "{", "if", "(", "is_scalar", "(", "$", "preview", ")", ")", "{", "$", "preview", "=", "strtoupper", "(", "$", "preview", ")", ";", "$", "previewNum", "=", "str_replace", "(", "'X'", ",", "...
Размер уменьшенного превью файла @param mixed $preview S, M, L, XL, XXL, XXXL, <ширина>, <ширина>x, x<высота>, <ширина>x<высота> @return $this @throws \UnexpectedValueException
[ "Размер", "уменьшенного", "превью", "файла" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Filter/PreviewTrait.php#L47-L69
jack-theripper/yandex
src/Disk/FilterTrait.php
FilterTrait.setLimit
public function setLimit($limit, $offset = null) { if (filter_var($limit, FILTER_VALIDATE_INT) === false) { throw new \InvalidArgumentException('Параметр "limit" должен быть целым числом.'); } $this->isModified = true; $this->parameters['limit'] = (int) $limit; if ($offset !== null) { $this->setO...
php
public function setLimit($limit, $offset = null) { if (filter_var($limit, FILTER_VALIDATE_INT) === false) { throw new \InvalidArgumentException('Параметр "limit" должен быть целым числом.'); } $this->isModified = true; $this->parameters['limit'] = (int) $limit; if ($offset !== null) { $this->setO...
[ "public", "function", "setLimit", "(", "$", "limit", ",", "$", "offset", "=", "null", ")", "{", "if", "(", "filter_var", "(", "$", "limit", ",", "FILTER_VALIDATE_INT", ")", "===", "false", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", ...
Количество ресурсов, вложенных в папку, описание которых следует вернуть в ответе @param integer $limit @param integer $offset установить смещение @return $this
[ "Количество", "ресурсов", "вложенных", "в", "папку", "описание", "которых", "следует", "вернуть", "в", "ответе" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/FilterTrait.php#L46-L62
jack-theripper/yandex
src/Disk/FilterTrait.php
FilterTrait.setOffset
public function setOffset($offset) { if (filter_var($offset, FILTER_VALIDATE_INT) === false) { throw new \InvalidArgumentException('Параметр "offset" должен быть целым числом.'); } $this->isModified = true; $this->parameters['offset'] = (int) $offset; return $this; }
php
public function setOffset($offset) { if (filter_var($offset, FILTER_VALIDATE_INT) === false) { throw new \InvalidArgumentException('Параметр "offset" должен быть целым числом.'); } $this->isModified = true; $this->parameters['offset'] = (int) $offset; return $this; }
[ "public", "function", "setOffset", "(", "$", "offset", ")", "{", "if", "(", "filter_var", "(", "$", "offset", ",", "FILTER_VALIDATE_INT", ")", "===", "false", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Параметр \"offset\" должен быть целым ...
Количество вложенных ресурсов с начала списка, которые следует опустить в ответе @param integer $offset @return $this
[ "Количество", "вложенных", "ресурсов", "с", "начала", "списка", "которые", "следует", "опустить", "в", "ответе" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/FilterTrait.php#L71-L82
jack-theripper/yandex
src/Disk/FilterTrait.php
FilterTrait.setSort
public function setSort($sort, $inverse = false) { $sort = (string) $sort; if ( ! in_array($sort, ['name', 'path', 'created', 'modified', 'size', 'deleted'])) { throw new \UnexpectedValueException('Допустимые значения сортировки - name, path, created, modified, size'); } if ($inverse) { $sort = '-'...
php
public function setSort($sort, $inverse = false) { $sort = (string) $sort; if ( ! in_array($sort, ['name', 'path', 'created', 'modified', 'size', 'deleted'])) { throw new \UnexpectedValueException('Допустимые значения сортировки - name, path, created, modified, size'); } if ($inverse) { $sort = '-'...
[ "public", "function", "setSort", "(", "$", "sort", ",", "$", "inverse", "=", "false", ")", "{", "$", "sort", "=", "(", "string", ")", "$", "sort", ";", "if", "(", "!", "in_array", "(", "$", "sort", ",", "[", "'name'", ",", "'path'", ",", "'create...
Атрибут, по которому сортируется список ресурсов, вложенных в папку. @param string $sort @param boolean $inverse TRUE чтобы сортировать в обратном порядке @return $this @throws \UnexpectedValueException
[ "Атрибут", "по", "которому", "сортируется", "список", "ресурсов", "вложенных", "в", "папку", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/FilterTrait.php#L93-L111
jack-theripper/yandex
src/Disk/FilterTrait.php
FilterTrait.getParameters
public function getParameters(array $allowed = null) { if ($allowed !== null) { return array_intersect_key($this->parameters, array_flip($allowed)); } return $this->parameters; }
php
public function getParameters(array $allowed = null) { if ($allowed !== null) { return array_intersect_key($this->parameters, array_flip($allowed)); } return $this->parameters; }
[ "public", "function", "getParameters", "(", "array", "$", "allowed", "=", "null", ")", "{", "if", "(", "$", "allowed", "!==", "null", ")", "{", "return", "array_intersect_key", "(", "$", "this", "->", "parameters", ",", "array_flip", "(", "$", "allowed", ...
Возвращает все параметры @return array
[ "Возвращает", "все", "параметры" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/FilterTrait.php#L118-L126
jack-theripper/yandex
src/Disk/Filter/TypeTrait.php
TypeTrait.setType
public function setType($type) { if ( ! is_string($type) || ! in_array($type, ['file', 'dir'])) { throw new \UnexpectedValueException('Тип ресурса, допустимые значения - "file", "dir".'); } $this->isModified = true; $this->parameters['type'] = $type; return $this; }
php
public function setType($type) { if ( ! is_string($type) || ! in_array($type, ['file', 'dir'])) { throw new \UnexpectedValueException('Тип ресурса, допустимые значения - "file", "dir".'); } $this->isModified = true; $this->parameters['type'] = $type; return $this; }
[ "public", "function", "setType", "(", "$", "type", ")", "{", "if", "(", "!", "is_string", "(", "$", "type", ")", "||", "!", "in_array", "(", "$", "type", ",", "[", "'file'", ",", "'dir'", "]", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueEx...
Тип ресурса @param string $type @return $this @throws \UnexpectedValueException
[ "Тип", "ресурса" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Filter/TypeTrait.php#L31-L42
jack-theripper/yandex
src/Disk/Filter/RelativePathTrait.php
RelativePathTrait.setRelativePath
public function setRelativePath($path) { if ( ! is_string($path)) { throw new \InvalidArgumentException('Относительный путь к ресурсу должен быть строкового типа.'); } $this->isModified = true; $this->parameters['path'] = '/'.ltrim($path, ' /'); return $this; }
php
public function setRelativePath($path) { if ( ! is_string($path)) { throw new \InvalidArgumentException('Относительный путь к ресурсу должен быть строкового типа.'); } $this->isModified = true; $this->parameters['path'] = '/'.ltrim($path, ' /'); return $this; }
[ "public", "function", "setRelativePath", "(", "$", "path", ")", "{", "if", "(", "!", "is_string", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Относительный путь к ресурсу должен быть строкового типа.');", "", "", "}", ...
Относительный путь к ресурсу внутри публичной папки. @param string $path @return $this
[ "Относительный", "путь", "к", "ресурсу", "внутри", "публичной", "папки", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Filter/RelativePathTrait.php#L30-L41
jack-theripper/yandex
src/Disk/Resource/Removed.php
Removed.toArray
public function toArray(array $allowed = null) { if ( ! $this->_toArray() || $this->isModified()) { $response = $this->client->send((new Request($this->uri->withPath($this->uri->getPath().'trash/resources') ->withQuery(http_build_query(array_merge($this-...
php
public function toArray(array $allowed = null) { if ( ! $this->_toArray() || $this->isModified()) { $response = $this->client->send((new Request($this->uri->withPath($this->uri->getPath().'trash/resources') ->withQuery(http_build_query(array_merge($this-...
[ "public", "function", "toArray", "(", "array", "$", "allowed", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_toArray", "(", ")", "||", "$", "this", "->", "isModified", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "cl...
Получает информацию о ресурсе @return mixed
[ "Получает", "информацию", "о", "ресурсе" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Removed.php#L77-L114
jack-theripper/yandex
src/Disk/Resource/Removed.php
Removed.restore
public function restore($name = null, $overwrite = false) { if (is_bool($name)) { $overwrite = $name; $name = null; } if ($name instanceof Closed) { $name = $name->getPath(); } if ( ! empty($name) && ! is_string($name)) { throw new \InvalidArgumentException('Новое имя для восстанавливаемо...
php
public function restore($name = null, $overwrite = false) { if (is_bool($name)) { $overwrite = $name; $name = null; } if ($name instanceof Closed) { $name = $name->getPath(); } if ( ! empty($name) && ! is_string($name)) { throw new \InvalidArgumentException('Новое имя для восстанавливаемо...
[ "public", "function", "restore", "(", "$", "name", "=", "null", ",", "$", "overwrite", "=", "false", ")", "{", "if", "(", "is_bool", "(", "$", "name", ")", ")", "{", "$", "overwrite", "=", "$", "name", ";", "$", "name", "=", "null", ";", "}", "...
Восстановление файла или папки из Корзины В корзине файлы с одинаковыми именами в действительности именют постфикс к имени в виде unixtime @param mixed $name оставляет имя как есть и если boolean это заменяет overwrite @param boolean $overwrite @return mixed
[ "Восстановление", "файла", "или", "папки", "из", "Корзины", "В", "корзине", "файлы", "с", "одинаковыми", "именами", "в", "действительности", "именют", "постфикс", "к", "имени", "в", "виде", "unixtime" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Removed.php#L124-L173
jack-theripper/yandex
src/Disk/Resource/Opened.php
Opened.download
public function download($destination, $overwrite = false, $check_hash = false) { $destination_type = gettype($destination); if (is_resource($destination)) { $destination = new Stream($destination); } if ($destination instanceof StreamInterface) { if ( ! $destination->isWritable()) { throw n...
php
public function download($destination, $overwrite = false, $check_hash = false) { $destination_type = gettype($destination); if (is_resource($destination)) { $destination = new Stream($destination); } if ($destination instanceof StreamInterface) { if ( ! $destination->isWritable()) { throw n...
[ "public", "function", "download", "(", "$", "destination", ",", "$", "overwrite", "=", "false", ",", "$", "check_hash", "=", "false", ")", "{", "$", "destination_type", "=", "gettype", "(", "$", "destination", ")", ";", "if", "(", "is_resource", "(", "$"...
Скачивание публичного файла или папки @param resource|StreamInterface|string $destination Путь, по которому будет сохранён файл StreamInterface будет записан в поток resource открытый на запись @param boolean $overwrite флаг перезаписи @param boolean $check_hash прове...
[ "Скачивание", "публичного", "файла", "или", "папки" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Opened.php#L182-L263
jack-theripper/yandex
src/Disk/Resource/Opened.php
Opened.hasEqual
public function hasEqual() { if ($this->has() && ($path = $this->get('name'))) { try { return $this->client->getResource(((string) $this->get('path')).'/'.$path) ->get('md5', false) === $this->get('md5'); } catch (\Exception $exc) { } } return false; }
php
public function hasEqual() { if ($this->has() && ($path = $this->get('name'))) { try { return $this->client->getResource(((string) $this->get('path')).'/'.$path) ->get('md5', false) === $this->get('md5'); } catch (\Exception $exc) { } } return false; }
[ "public", "function", "hasEqual", "(", ")", "{", "if", "(", "$", "this", "->", "has", "(", ")", "&&", "(", "$", "path", "=", "$", "this", "->", "get", "(", "'name'", ")", ")", ")", "{", "try", "{", "return", "$", "this", "->", "client", "->", ...
Этот файл или такой же находится на моём диске Метод требует Access Token @return boolean
[ "Этот", "файл", "или", "такой", "же", "находится", "на", "моём", "диске", "Метод", "требует", "Access", "Token" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Opened.php#L271-L287
jack-theripper/yandex
src/Disk/Resource/Opened.php
Opened.save
public function save($name = null, $path = null) { $parameters = []; /** * @var mixed $name Имя, под которым файл следует сохранить в папку «Загрузки» */ if (is_string($name)) { $parameters['name'] = $name; } else if ($name instanceof Closed) { $parameters['name'] = substr(strrchr($name->g...
php
public function save($name = null, $path = null) { $parameters = []; /** * @var mixed $name Имя, под которым файл следует сохранить в папку «Загрузки» */ if (is_string($name)) { $parameters['name'] = $name; } else if ($name instanceof Closed) { $parameters['name'] = substr(strrchr($name->g...
[ "public", "function", "save", "(", "$", "name", "=", "null", ",", "$", "path", "=", "null", ")", "{", "$", "parameters", "=", "[", "]", ";", "/**\n\t\t * @var mixed $name Имя, под которым файл следует сохранить в папку «Загрузки»\n\t\t */", "if", "(", "is_string", ...
Сохранение публичного файла в «Загрузки» или отдельный файл из публичной папки @param string $name Имя, под которым файл следует сохранить в папку «Загрузки» @param string $path Путь внутри публичной папки. @return mixed
[ "Сохранение", "публичного", "файла", "в", "«Загрузки»", "или", "отдельный", "файл", "из", "публичной", "папки" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Opened.php#L297-L364
jack-theripper/yandex
src/Disk/Resource/Opened.php
Opened.setPath
public function setPath($path) { if ( ! is_scalar($path)) { throw new \InvalidArgumentException('Параметр "path" должен быть строкового типа.'); } $this->path = (string) $path; return $this; }
php
public function setPath($path) { if ( ! is_scalar($path)) { throw new \InvalidArgumentException('Параметр "path" должен быть строкового типа.'); } $this->path = (string) $path; return $this; }
[ "public", "function", "setPath", "(", "$", "path", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Параметр \"path\" должен быть строкового типа.');", "", "", "}", "$", "this", ...
Устанавливает путь внутри публичной папки @param string $path @return $this
[ "Устанавливает", "путь", "внутри", "публичной", "папки" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Opened.php#L373-L383
jack-theripper/yandex
src/Disk/Resource/Opened.php
Opened.createDocViewerUrl
protected function createDocViewerUrl() { if ($this->isFile()) { $docviewer = [ 'name' => $this->get('name'), 'url' => sprintf('ya-disk-public://%s', $this->get('public_key')) ]; return (string) (new Uri('https://docviewer.yandex.ru/')) ->withQuery(http_build_query($docviewer, null, '&'))...
php
protected function createDocViewerUrl() { if ($this->isFile()) { $docviewer = [ 'name' => $this->get('name'), 'url' => sprintf('ya-disk-public://%s', $this->get('public_key')) ]; return (string) (new Uri('https://docviewer.yandex.ru/')) ->withQuery(http_build_query($docviewer, null, '&'))...
[ "protected", "function", "createDocViewerUrl", "(", ")", "{", "if", "(", "$", "this", "->", "isFile", "(", ")", ")", "{", "$", "docviewer", "=", "[", "'name'", "=>", "$", "this", "->", "get", "(", "'name'", ")", ",", "'url'", "=>", "sprintf", "(", ...
Получает ссылку для просмотра документа. @return bool|string @throws \InvalidArgumentException
[ "Получает", "ссылку", "для", "просмотра", "документа", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Opened.php#L391-L405
jack-theripper/yandex
src/Disk/Resource/Collection.php
Collection.toArray
public function toArray(array $allowed = null) { if ( ! parent::toArray() || $this->isModified()) { $this->setContents(call_user_func($this->closure, $this->getParameters($this->parametersAllowed))); $this->isModified = false; } return parent::toArray(); }
php
public function toArray(array $allowed = null) { if ( ! parent::toArray() || $this->isModified()) { $this->setContents(call_user_func($this->closure, $this->getParameters($this->parametersAllowed))); $this->isModified = false; } return parent::toArray(); }
[ "public", "function", "toArray", "(", "array", "$", "allowed", "=", "null", ")", "{", "if", "(", "!", "parent", "::", "toArray", "(", ")", "||", "$", "this", "->", "isModified", "(", ")", ")", "{", "$", "this", "->", "setContents", "(", "call_user_fu...
Получает информацию @return array
[ "Получает", "информацию" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Collection.php#L52-L61
jack-theripper/yandex
src/Client/HttpClient.php
HttpClient.sendRequest
public function sendRequest(RequestInterface $request) { $responseBuilder = $this->createResponseBuilder(); $options = $this->createCurlOptions($request, $responseBuilder); curl_reset($this->handle); curl_setopt_array($this->handle, $options); curl_exec($this->handle); if (curl_errno($this->handle) > 0) ...
php
public function sendRequest(RequestInterface $request) { $responseBuilder = $this->createResponseBuilder(); $options = $this->createCurlOptions($request, $responseBuilder); curl_reset($this->handle); curl_setopt_array($this->handle, $options); curl_exec($this->handle); if (curl_errno($this->handle) > 0) ...
[ "public", "function", "sendRequest", "(", "RequestInterface", "$", "request", ")", "{", "$", "responseBuilder", "=", "$", "this", "->", "createResponseBuilder", "(", ")", ";", "$", "options", "=", "$", "this", "->", "createCurlOptions", "(", "$", "request", ...
Sends a PSR-7 request. @param RequestInterface $request @return ResponseInterface @throws \RuntimeException If creating the body stream fails. @throws \UnexpectedValueException if unsupported HTTP version requested @throws RequestException @since 1.0
[ "Sends", "a", "PSR", "-", "7", "request", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/HttpClient.php#L116-L133
jack-theripper/yandex
src/Client/HttpClient.php
HttpClient.createCurlOptions
protected function createCurlOptions(RequestInterface $request, ResponseBuilder $responseBuilder) { $options = array_diff_key($this->options, array_flip([CURLOPT_INFILE, CURLOPT_INFILESIZE])); $options[CURLOPT_HTTP_VERSION] = $this->getCurlHttpVersion($request->getProtocolVersion()); $options[CURLOPT_HEADERFUNCT...
php
protected function createCurlOptions(RequestInterface $request, ResponseBuilder $responseBuilder) { $options = array_diff_key($this->options, array_flip([CURLOPT_INFILE, CURLOPT_INFILESIZE])); $options[CURLOPT_HTTP_VERSION] = $this->getCurlHttpVersion($request->getProtocolVersion()); $options[CURLOPT_HEADERFUNCT...
[ "protected", "function", "createCurlOptions", "(", "RequestInterface", "$", "request", ",", "ResponseBuilder", "$", "responseBuilder", ")", "{", "$", "options", "=", "array_diff_key", "(", "$", "this", "->", "options", ",", "array_flip", "(", "[", "CURLOPT_INFILE"...
Generates cURL options @param RequestInterface $request @param ResponseBuilder $responseBuilder @throws \UnexpectedValueException if unsupported HTTP version requested @throws \RuntimeException if can not read body @return array
[ "Generates", "cURL", "options" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/HttpClient.php#L178-L232
jack-theripper/yandex
src/Client/HttpClient.php
HttpClient.createHeaders
protected function createHeaders(RequestInterface $request, array $options) { $headers = []; $body = $request->getBody(); $size = $body->getSize(); foreach ($request->getHeaders() as $header => $values) { foreach ((array) $values as $value) { $headers[] = sprintf('%s: %s', $header, $value); } ...
php
protected function createHeaders(RequestInterface $request, array $options) { $headers = []; $body = $request->getBody(); $size = $body->getSize(); foreach ($request->getHeaders() as $header => $values) { foreach ((array) $values as $value) { $headers[] = sprintf('%s: %s', $header, $value); } ...
[ "protected", "function", "createHeaders", "(", "RequestInterface", "$", "request", ",", "array", "$", "options", ")", "{", "$", "headers", "=", "[", "]", ";", "$", "body", "=", "$", "request", "->", "getBody", "(", ")", ";", "$", "size", "=", "$", "b...
Create headers array for CURLOPT_HTTPHEADER @param RequestInterface $request @param array $options cURL options @return string[]
[ "Create", "headers", "array", "for", "CURLOPT_HTTPHEADER" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/HttpClient.php#L242-L274
jack-theripper/yandex
src/Client/HttpClient.php
HttpClient.createCurlBody
protected function createCurlBody(RequestInterface $request, array $options) { $body = clone $request->getBody(); $size = $body->getSize(); // Avoid full loading large or unknown size body into memory. It doesn't replace "CURLOPT_READFUNCTION". if ($size === null || $size > 1048576) { if ($body->isSeekab...
php
protected function createCurlBody(RequestInterface $request, array $options) { $body = clone $request->getBody(); $size = $body->getSize(); // Avoid full loading large or unknown size body into memory. It doesn't replace "CURLOPT_READFUNCTION". if ($size === null || $size > 1048576) { if ($body->isSeekab...
[ "protected", "function", "createCurlBody", "(", "RequestInterface", "$", "request", ",", "array", "$", "options", ")", "{", "$", "body", "=", "clone", "$", "request", "->", "getBody", "(", ")", ";", "$", "size", "=", "$", "body", "->", "getSize", "(", ...
Create body @param RequestInterface $request @param array $options @return array
[ "Create", "body" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/HttpClient.php#L284-L320
jack-theripper/yandex
src/Client/HttpClient.php
HttpClient.createResponseBuilder
protected function createResponseBuilder() { try { $body = $this->streamFactory->createStream(fopen('php://temp', 'w+')); } catch (\InvalidArgumentException $e) { throw new \RuntimeException('Can not create "php://temp" stream.'); } $response = $this->messageFactory->createResponse(200, null, [], ...
php
protected function createResponseBuilder() { try { $body = $this->streamFactory->createStream(fopen('php://temp', 'w+')); } catch (\InvalidArgumentException $e) { throw new \RuntimeException('Can not create "php://temp" stream.'); } $response = $this->messageFactory->createResponse(200, null, [], ...
[ "protected", "function", "createResponseBuilder", "(", ")", "{", "try", "{", "$", "body", "=", "$", "this", "->", "streamFactory", "->", "createStream", "(", "fopen", "(", "'php://temp'", ",", "'w+'", ")", ")", ";", "}", "catch", "(", "\\", "InvalidArgumen...
Create new ResponseBuilder instance @return ResponseBuilder @throws \RuntimeException If creating the stream from $body fails.
[ "Create", "new", "ResponseBuilder", "instance" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/HttpClient.php#L362-L376
jack-theripper/yandex
src/Client/Stream/Progress.php
Progress.read
public function read($length) { $this->readSize += $length; $percent = round(100 / $this->totalSize * $this->readSize, 2); $this->emit('progress', min(100.0, $percent)); return parent::read($length); }
php
public function read($length) { $this->readSize += $length; $percent = round(100 / $this->totalSize * $this->readSize, 2); $this->emit('progress', min(100.0, $percent)); return parent::read($length); }
[ "public", "function", "read", "(", "$", "length", ")", "{", "$", "this", "->", "readSize", "+=", "$", "length", ";", "$", "percent", "=", "round", "(", "100", "/", "$", "this", "->", "totalSize", "*", "$", "this", "->", "readSize", ",", "2", ")", ...
Read data from the stream. @param int $length Read up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes. @return string Returns the data read from the stream, or an empty string if no bytes are available. @throws \RuntimeException ...
[ "Read", "data", "from", "the", "stream", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/Stream/Progress.php#L62-L69
jack-theripper/yandex
src/Client/Stream/Progress.php
Progress.seek
public function seek($offset, $whence = SEEK_SET) { if (parent::seek($offset, $whence)) { $this->readSize = $offset; return true; } return false; }
php
public function seek($offset, $whence = SEEK_SET) { if (parent::seek($offset, $whence)) { $this->readSize = $offset; return true; } return false; }
[ "public", "function", "seek", "(", "$", "offset", ",", "$", "whence", "=", "SEEK_SET", ")", "{", "if", "(", "parent", "::", "seek", "(", "$", "offset", ",", "$", "whence", ")", ")", "{", "$", "this", "->", "readSize", "=", "$", "offset", ";", "re...
Seek to a position in the stream. @param int $offset Stream offset @param int $whence Specifies how the cursor position will be calculated based on the seek offset. Valid values are identical to the built-in PHP $whence values for `fseek()`. SEEK_SET: Set position equal to offset bytes SEEK_CUR: Set position to curre...
[ "Seek", "to", "a", "position", "in", "the", "stream", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/Stream/Progress.php#L99-L109
jack-theripper/yandex
src/Client/SimpleKey.php
SimpleKey.authentication
protected function authentication(RequestInterface $request) { $uri = $request->getUri(); $key = http_build_query(['key' => $this->getAccessKey()], null, '&'); if (strlen($uri->getQuery()) > 0) { $key = '&'.$key; } return $request->withUri($uri->withQuery($uri->getQuery().$key)); }
php
protected function authentication(RequestInterface $request) { $uri = $request->getUri(); $key = http_build_query(['key' => $this->getAccessKey()], null, '&'); if (strlen($uri->getQuery()) > 0) { $key = '&'.$key; } return $request->withUri($uri->withQuery($uri->getQuery().$key)); }
[ "protected", "function", "authentication", "(", "RequestInterface", "$", "request", ")", "{", "$", "uri", "=", "$", "request", "->", "getUri", "(", ")", ";", "$", "key", "=", "http_build_query", "(", "[", "'key'", "=>", "$", "this", "->", "getAccessKey", ...
Провести аунтификацию в соостветствии с типом сервиса @param RequestInterface $request @return RequestInterface
[ "Провести", "аунтификацию", "в", "соостветствии", "с", "типом", "сервиса" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/SimpleKey.php#L86-L97
jack-theripper/yandex
src/Disk/AbstractResource.php
AbstractResource.has
public function has($index = null) { try { if ($this->toArray()) { if ($index === null) { return true; } return $this->hasProperty($index); } } catch (\Exception $exc) { } return false; }
php
public function has($index = null) { try { if ($this->toArray()) { if ($index === null) { return true; } return $this->hasProperty($index); } } catch (\Exception $exc) { } return false; }
[ "public", "function", "has", "(", "$", "index", "=", "null", ")", "{", "try", "{", "if", "(", "$", "this", "->", "toArray", "(", ")", ")", "{", "if", "(", "$", "index", "===", "null", ")", "{", "return", "true", ";", "}", "return", "$", "this",...
Есть такой файл/папка на диске или свойство @param mixed $index @return bool
[ "Есть", "такой", "файл", "/", "папка", "на", "диске", "или", "свойство" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/AbstractResource.php#L58-L78
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.getProperty
public function getProperty($index, $default = null) { $properties = $this->get('custom_properties', []); if (isset($properties[$index])) { return $properties[$index]; } if ($default instanceof \Closure) { return $default($this); } return $default; }
php
public function getProperty($index, $default = null) { $properties = $this->get('custom_properties', []); if (isset($properties[$index])) { return $properties[$index]; } if ($default instanceof \Closure) { return $default($this); } return $default; }
[ "public", "function", "getProperty", "(", "$", "index", ",", "$", "default", "=", "null", ")", "{", "$", "properties", "=", "$", "this", "->", "get", "(", "'custom_properties'", ",", "[", "]", ")", ";", "if", "(", "isset", "(", "$", "properties", "["...
Позводляет получить метаинформацию из custom_properties @param string $index @param mixed $default @return mixed|null
[ "Позводляет", "получить", "метаинформацию", "из", "custom_properties" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L136-L151
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.set
public function set($meta, $value = null) { if ( ! is_array($meta)) { if ( ! is_scalar($meta)) { throw new \InvalidArgumentException('Индекс метаинформации должен быть простого типа.'); } $meta = [(string) $meta => $value]; } if (empty($meta)) { throw new \OutOfBoundsException('Не было п...
php
public function set($meta, $value = null) { if ( ! is_array($meta)) { if ( ! is_scalar($meta)) { throw new \InvalidArgumentException('Индекс метаинформации должен быть простого типа.'); } $meta = [(string) $meta => $value]; } if (empty($meta)) { throw new \OutOfBoundsException('Не было п...
[ "public", "function", "set", "(", "$", "meta", ",", "$", "value", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "meta", ")", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "meta", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Добавление метаинформации для ресурса @param mixed $meta строка либо массив значений @param mixed $value NULL чтобы удалить определённую метаинформаию когда $meta строка @return Closed @throws \LengthException
[ "Добавление", "метаинформации", "для", "ресурса" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L172-L209
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.delete
public function delete($permanently = false) { $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources') ->withQuery(http_build_query([ 'path' => $this->getPath(), 'permanently' => (bool) $permanently ])), 'DELETE')); if ($response->getStatusCode() ==...
php
public function delete($permanently = false) { $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources') ->withQuery(http_build_query([ 'path' => $this->getPath(), 'permanently' => (bool) $permanently ])), 'DELETE')); if ($response->getStatusCode() ==...
[ "public", "function", "delete", "(", "$", "permanently", "=", "false", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "send", "(", "new", "Request", "(", "$", "this", "->", "uri", "->", "withPath", "(", "$", "this", "->", "uri", ...
Удаление файла или папки @param boolean $permanently TRUE Признак безвозвратного удаления @return bool|\Arhitector\Yandex\Disk\Operation|\Arhitector\Yandex\Disk\Resource\Removed
[ "Удаление", "файла", "или", "папки" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L264-L312
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.move
public function move($destination, $overwrite = false) { if ($destination instanceof Closed) { $destination = $destination->getPath(); } $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources/move') ->withQuery(http_build_query([ 'from' => $this->getPa...
php
public function move($destination, $overwrite = false) { if ($destination instanceof Closed) { $destination = $destination->getPath(); } $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources/move') ->withQuery(http_build_query([ 'from' => $this->getPa...
[ "public", "function", "move", "(", "$", "destination", ",", "$", "overwrite", "=", "false", ")", "{", "if", "(", "$", "destination", "instanceof", "Closed", ")", "{", "$", "destination", "=", "$", "destination", "->", "getPath", "(", ")", ";", "}", "$"...
Перемещение файла или папки. Перемещать файлы и папки на Диске можно, указывая текущий путь к ресурсу и его новое положение. Если запрос был обработан без ошибок, API составляет тело ответа в зависимости от вида указанного ресурса – ответ для пустой папки или файла отличается от ответа для непустой папки. (Если запрос ...
[ "Перемещение", "файла", "или", "папки", ".", "Перемещать", "файлы", "и", "папки", "на", "Диске", "можно", "указывая", "текущий", "путь", "к", "ресурсу", "и", "его", "новое", "положение", ".", "Если", "запрос", "был", "обработан", "без", "ошибок", "API", "сос...
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L329-L361
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.create
public function create() { try { $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources') ->withQuery(http_build_query([ 'path' => $this->getPath() ], null, '&')), 'PUT')); $this->setContents([]); } catch (\Exception $exc) { throw $exc; } return $this...
php
public function create() { try { $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources') ->withQuery(http_build_query([ 'path' => $this->getPath() ], null, '&')), 'PUT')); $this->setContents([]); } catch (\Exception $exc) { throw $exc; } return $this...
[ "public", "function", "create", "(", ")", "{", "try", "{", "$", "this", "->", "client", "->", "send", "(", "new", "Request", "(", "$", "this", "->", "uri", "->", "withPath", "(", "$", "this", "->", "uri", "->", "getPath", "(", ")", ".", "'resources...
Создание папки, если ресурса с таким же именем нет @return \Arhitector\Yandex\Disk\Resource\Closed @throws mixed
[ "Создание", "папки", "если", "ресурса", "с", "таким", "же", "именем", "нет" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L369-L385
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.setPublish
public function setPublish($publish = true) { $request = 'resources/unpublish'; if ($publish) { $request = 'resources/publish'; } $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().$request) ->withQuery(http_build_query([ 'path' => $this->getPath() ], null, ...
php
public function setPublish($publish = true) { $request = 'resources/unpublish'; if ($publish) { $request = 'resources/publish'; } $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().$request) ->withQuery(http_build_query([ 'path' => $this->getPath() ], null, ...
[ "public", "function", "setPublish", "(", "$", "publish", "=", "true", ")", "{", "$", "request", "=", "'resources/unpublish'", ";", "if", "(", "$", "publish", ")", "{", "$", "request", "=", "'resources/publish'", ";", "}", "$", "response", "=", "$", "this...
Публикация ресурса\Закрытие доступа @param boolean $publish TRUE открыть доступ, FALSE закрыть доступ @return \Arhitector\Yandex\Disk\Resource\Closed|\Arhitector\Yandex\Disk\Resource\Opened
[ "Публикация", "ресурса", "\\", "Закрытие", "доступа" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L394-L419
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.download
public function download($destination, $overwrite = false) { $destination_type = gettype($destination); if ( ! $this->has()) { throw new NotFoundException('Не удалось найти запрошенный ресурс.'); } if (is_resource($destination)) { $destination = new Stream($destination); } if ($destination ins...
php
public function download($destination, $overwrite = false) { $destination_type = gettype($destination); if ( ! $this->has()) { throw new NotFoundException('Не удалось найти запрошенный ресурс.'); } if (is_resource($destination)) { $destination = new Stream($destination); } if ($destination ins...
[ "public", "function", "download", "(", "$", "destination", ",", "$", "overwrite", "=", "false", ")", "{", "$", "destination_type", "=", "gettype", "(", "$", "destination", ")", ";", "if", "(", "!", "$", "this", "->", "has", "(", ")", ")", "{", "throw...
Скачивает файл @param resource|StreamInterface|string $destination Путь, по которому будет сохранён файл StreamInterface будет записан в поток resource открытый на запись @param mixed $overwrite @return bool @throws NotFoundException @throws AlreadyExistsException @throws \OutOfBoundsExcept...
[ "Скачивает", "файл" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L436-L516
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.upload
public function upload($file_path, $overwrite = false, $disable_redirects = false) { if (is_string($file_path)) { $scheme = substr($file_path, 0, 7); if ($scheme == 'http://' or $scheme == 'https:/') { try { $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath...
php
public function upload($file_path, $overwrite = false, $disable_redirects = false) { if (is_string($file_path)) { $scheme = substr($file_path, 0, 7); if ($scheme == 'http://' or $scheme == 'https:/') { try { $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath...
[ "public", "function", "upload", "(", "$", "file_path", ",", "$", "overwrite", "=", "false", ",", "$", "disable_redirects", "=", "false", ")", "{", "if", "(", "is_string", "(", "$", "file_path", ")", ")", "{", "$", "scheme", "=", "substr", "(", "$", "...
Загрузить файл на диск @param mixed $file_path может быть как путь к локальному файлу, так и URL к файлу. @param bool $overwrite если ресурс существует на Яндекс.Диске TRUE перезапишет ресурс. @param bool $disable_redirects помогает запретить редиректы по адресу, TRUE запретит пере адресацию...
[ "Загрузить", "файл", "на", "диск" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L572-L655
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.getLink
public function getLink() { if ( ! $this->has()) { throw new NotFoundException('Не удалось найти запрошенный ресурс.'); } $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources/download') ...
php
public function getLink() { if ( ! $this->has()) { throw new NotFoundException('Не удалось найти запрошенный ресурс.'); } $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources/download') ...
[ "public", "function", "getLink", "(", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", ")", ")", "{", "throw", "new", "NotFoundException", "(", "'Не удалось найти запрошенный ресурс.');", "", "", "}", "$", "response", "=", "$", "this", "->", "cli...
Получает прямую ссылку @return string @throws mixed @TODO Не работает для файлов вложенных в публичную папку.
[ "Получает", "прямую", "ссылку" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L665-L688
jack-theripper/yandex
src/Disk/Resource/Closed.php
Closed.createDocViewerUrl
protected function createDocViewerUrl() { if ($this->isFile()) { $docviewer = [ 'url' => $this->get('path'), 'name' => $this->get('name') ]; if (strpos($docviewer['url'], 'disk:/') === 0) { $docviewer['url'] = substr($docviewer['url'], 6); } $docviewer['url'] = "ya-disk:///disk/{$d...
php
protected function createDocViewerUrl() { if ($this->isFile()) { $docviewer = [ 'url' => $this->get('path'), 'name' => $this->get('name') ]; if (strpos($docviewer['url'], 'disk:/') === 0) { $docviewer['url'] = substr($docviewer['url'], 6); } $docviewer['url'] = "ya-disk:///disk/{$d...
[ "protected", "function", "createDocViewerUrl", "(", ")", "{", "if", "(", "$", "this", "->", "isFile", "(", ")", ")", "{", "$", "docviewer", "=", "[", "'url'", "=>", "$", "this", "->", "get", "(", "'path'", ")", ",", "'name'", "=>", "$", "this", "->...
Получает ссылку для просмотра документа. Достпно владельцу аккаунта. @return bool|string
[ "Получает", "ссылку", "для", "просмотра", "документа", ".", "Достпно", "владельцу", "аккаунта", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Resource/Closed.php#L695-L716
jack-theripper/yandex
src/AbstractClient.php
AbstractClient.send
public function send(RequestInterface $request) { $request = $this->authentication($request); $defaultHeaders = [ 'Accept' => $this->getContentType(), 'Content-Type' => $this->getContentType() ]; foreach ($defaultHeaders as $defaultHeader => $value) { if ( ! $request->hasHeader($defaultHeader...
php
public function send(RequestInterface $request) { $request = $this->authentication($request); $defaultHeaders = [ 'Accept' => $this->getContentType(), 'Content-Type' => $this->getContentType() ]; foreach ($defaultHeaders as $defaultHeader => $value) { if ( ! $request->hasHeader($defaultHeader...
[ "public", "function", "send", "(", "RequestInterface", "$", "request", ")", "{", "$", "request", "=", "$", "this", "->", "authentication", "(", "$", "request", ")", ";", "$", "defaultHeaders", "=", "[", "'Accept'", "=>", "$", "this", "->", "getContentType"...
Модифицирует и отправляет запрос. @param \Psr\Http\Message\RequestInterface $request @return \Psr\Http\Message\ResponseInterface
[ "Модифицирует", "и", "отправляет", "запрос", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/AbstractClient.php#L128-L148
jack-theripper/yandex
src/AbstractClient.php
AbstractClient.setAccessTokenRequired
protected function setAccessTokenRequired($tokenRequired) { $previous = $this->tokenRequired; $this->tokenRequired = (bool) $tokenRequired; return $previous; }
php
protected function setAccessTokenRequired($tokenRequired) { $previous = $this->tokenRequired; $this->tokenRequired = (bool) $tokenRequired; return $previous; }
[ "protected", "function", "setAccessTokenRequired", "(", "$", "tokenRequired", ")", "{", "$", "previous", "=", "$", "this", "->", "tokenRequired", ";", "$", "this", "->", "tokenRequired", "=", "(", "bool", ")", "$", "tokenRequired", ";", "return", "$", "previ...
Устаналивает необходимость токена при запросе. @param $tokenRequired @return boolean возвращает предыдущее состояние
[ "Устаналивает", "необходимость", "токена", "при", "запросе", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/AbstractClient.php#L157-L163
jack-theripper/yandex
src/AbstractClient.php
AbstractClient.transformResponseToException
protected function transformResponseToException(RequestInterface $request, ResponseInterface $response) { if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 500) { throw new \RuntimeException($response->getReasonPhrase(), $response->getStatusCode()); } if ($response->getStatusCode() >= 5...
php
protected function transformResponseToException(RequestInterface $request, ResponseInterface $response) { if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 500) { throw new \RuntimeException($response->getReasonPhrase(), $response->getStatusCode()); } if ($response->getStatusCode() >= 5...
[ "protected", "function", "transformResponseToException", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "if", "(", "$", "response", "->", "getStatusCode", "(", ")", ">=", "400", "&&", "$", "response", "->", "getStat...
Трансформирует ответ в исключения @param \Psr\Http\Message\RequestInterface $request @param \Psr\Http\Message\ResponseInterface $response @return \Psr\Http\Message\ResponseInterface если статус код не является ошибочным, то вернуть объект ответа @throws \Arhitector\Yandex\Client\Exception\ServiceException
[ "Трансформирует", "ответ", "в", "исключения" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/AbstractClient.php#L174-L187
jack-theripper/yandex
src/Disk/Filter/MediaTypeTrait.php
MediaTypeTrait.setMediaType
public function setMediaType($media_type) { $media_type = (string) $media_type; if ( ! in_array($media_type, $this->getMediaTypes())) { throw new \UnexpectedValueException('Тип файла, значения - "'.implode('", "', $this->getMediaTypes()).'".'); } $this->isModified = true; $this->parameters['media_type...
php
public function setMediaType($media_type) { $media_type = (string) $media_type; if ( ! in_array($media_type, $this->getMediaTypes())) { throw new \UnexpectedValueException('Тип файла, значения - "'.implode('", "', $this->getMediaTypes()).'".'); } $this->isModified = true; $this->parameters['media_type...
[ "public", "function", "setMediaType", "(", "$", "media_type", ")", "{", "$", "media_type", "=", "(", "string", ")", "$", "media_type", ";", "if", "(", "!", "in_array", "(", "$", "media_type", ",", "$", "this", "->", "getMediaTypes", "(", ")", ")", ")",...
Тип файлов, которые нужно включить в список @param string $media_type @return $this @throws \UnexpectedValueException
[ "Тип", "файлов", "которые", "нужно", "включить", "в", "список" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Disk/Filter/MediaTypeTrait.php#L132-L145
jack-theripper/yandex
src/Client/Stream/Factory.php
Factory.createStream
public function createStream($body = null) { if ( ! $body instanceof StreamInterface) { if (is_resource($body)) { $body = new Stream($body); } else { $stream = new Stream('php://temp', 'rb+'); if (null !== $body) { $stream->write((string) $body); } $body = $str...
php
public function createStream($body = null) { if ( ! $body instanceof StreamInterface) { if (is_resource($body)) { $body = new Stream($body); } else { $stream = new Stream('php://temp', 'rb+'); if (null !== $body) { $stream->write((string) $body); } $body = $str...
[ "public", "function", "createStream", "(", "$", "body", "=", "null", ")", "{", "if", "(", "!", "$", "body", "instanceof", "StreamInterface", ")", "{", "if", "(", "is_resource", "(", "$", "body", ")", ")", "{", "$", "body", "=", "new", "Stream", "(", ...
Create a new stream instance. @param StreamInterface $body @return null|\Zend\Diactoros\Stream @throws \RuntimeException @throws \InvalidArgumentException
[ "Create", "a", "new", "stream", "instance", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/Stream/Factory.php#L36-L60
jack-theripper/yandex
src/Client/OAuth.php
OAuth.refreshAccessToken
public function refreshAccessToken($username, $password, $onlyToken = false) { if ( ! is_scalar($username) || ! is_scalar($password)) { throw new \InvalidArgumentException('Параметры "имя пользователя" и "пароль" должны быть простого типа.'); } $previous = $this->setAccessTokenRequired(false); $request =...
php
public function refreshAccessToken($username, $password, $onlyToken = false) { if ( ! is_scalar($username) || ! is_scalar($password)) { throw new \InvalidArgumentException('Параметры "имя пользователя" и "пароль" должны быть простого типа.'); } $previous = $this->setAccessTokenRequired(false); $request =...
[ "public", "function", "refreshAccessToken", "(", "$", "username", ",", "$", "password", ",", "$", "onlyToken", "=", "false", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "username", ")", "||", "!", "is_scalar", "(", "$", "password", ")", ")", "{", ...
Запрашивает или обновляет токен @param string $username имя пользователя yandex @param string $password пароль от аккаунта @param bool $onlyToken вернуть только строковый токен @return object|string @throws UnauthorizedException @throws \Exception @example $client->refreshAccessToken('username', 'password'); ob...
[ "Запрашивает", "или", "обновляет", "токен" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/OAuth.php#L177-L223
jack-theripper/yandex
src/Client/OAuth.php
OAuth.authentication
protected function authentication(RequestInterface $request) { if ($this->tokenRequired) { return $request->withHeader('Authorization', sprintf('OAuth %s', $this->getAccessToken())); } return $request; }
php
protected function authentication(RequestInterface $request) { if ($this->tokenRequired) { return $request->withHeader('Authorization', sprintf('OAuth %s', $this->getAccessToken())); } return $request; }
[ "protected", "function", "authentication", "(", "RequestInterface", "$", "request", ")", "{", "if", "(", "$", "this", "->", "tokenRequired", ")", "{", "return", "$", "request", "->", "withHeader", "(", "'Authorization'", ",", "sprintf", "(", "'OAuth %s'", ",",...
Провести аунтификацию в соостветствии с типом сервиса @param \Psr\Http\Message\RequestInterface $request @return \Psr\Http\Message\RequestInterface
[ "Провести", "аунтификацию", "в", "соостветствии", "с", "типом", "сервиса" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/OAuth.php#L232-L240
jack-theripper/yandex
src/Client/OAuth.php
OAuth.transformResponseToException
protected function transformResponseToException(RequestInterface $request, ResponseInterface $response) { if (isset($this->exceptions[$response->getStatusCode()])) { $exception = $this->exceptions[$response->getStatusCode()]; if ($response->hasHeader('Content-Type') && stripos($response->getHeaderLine('...
php
protected function transformResponseToException(RequestInterface $request, ResponseInterface $response) { if (isset($this->exceptions[$response->getStatusCode()])) { $exception = $this->exceptions[$response->getStatusCode()]; if ($response->hasHeader('Content-Type') && stripos($response->getHeaderLine('...
[ "protected", "function", "transformResponseToException", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "exceptions", "[", "$", "response", "->", "getStatusCode", "(", ")"...
Трансформирует ответ в исключения. Ответ API, где использует OAuth, отличается от других сервисов. @param \Psr\Http\Message\RequestInterface $request @param \Psr\Http\Message\ResponseInterface $response @return \Psr\Http\Message\ResponseInterface если статус код не является ошибочным, то вернуть объект ответа
[ "Трансформирует", "ответ", "в", "исключения", ".", "Ответ", "API", "где", "использует", "OAuth", "отличается", "от", "других", "сервисов", "." ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/OAuth.php#L251-L283
jack-theripper/yandex
src/Client/Container/ContainerTrait.php
ContainerTrait.toArray
public function toArray(array $allowed = null) { $contents = $this->store; if ($allowed !== null) { $contents = array_intersect_key($this->store, array_flip($allowed)); } /*foreach ($contents as $index => $value) { if ($value instanceof Container || $value instanceof AbstractResource) { $con...
php
public function toArray(array $allowed = null) { $contents = $this->store; if ($allowed !== null) { $contents = array_intersect_key($this->store, array_flip($allowed)); } /*foreach ($contents as $index => $value) { if ($value instanceof Container || $value instanceof AbstractResource) { $con...
[ "public", "function", "toArray", "(", "array", "$", "allowed", "=", "null", ")", "{", "$", "contents", "=", "$", "this", "->", "store", ";", "if", "(", "$", "allowed", "!==", "null", ")", "{", "$", "contents", "=", "array_intersect_key", "(", "$", "t...
Получить данные контейнера в виде массива @param array $allowed получить только эти ключи @return array контейнер
[ "Получить", "данные", "контейнера", "в", "виде", "массива" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/Container/ContainerTrait.php#L45-L63
jack-theripper/yandex
src/Client/Container/ContainerTrait.php
ContainerTrait.get
public function get($index, $default = null) { if ($this->hasByIndex($index)) { return $this->store[$index]; } if ($default instanceof \Closure) { return $default($this); } return $default; }
php
public function get($index, $default = null) { if ($this->hasByIndex($index)) { return $this->store[$index]; } if ($default instanceof \Closure) { return $default($this); } return $default; }
[ "public", "function", "get", "(", "$", "index", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasByIndex", "(", "$", "index", ")", ")", "{", "return", "$", "this", "->", "store", "[", "$", "index", "]", ";", "}", "i...
Получить значение из контейнера по ключу @param string $index @param mixed $default может быть функцией @return mixed
[ "Получить", "значение", "из", "контейнера", "по", "ключу" ]
train
https://github.com/jack-theripper/yandex/blob/db78fae891552c9b1c8d0b043e9ebf879b918a18/src/Client/Container/ContainerTrait.php#L139-L152
acquia/drupal-spec-tool
src/Context/ContentModelContext.php
ContentModelContext.assertBundles
public function assertBundles(TableNode $expected) { $bundle_info = []; foreach ($this->getContentEntityTypes() as $entity_type) { $bundles = $this->entityTypeManager() ->getStorage($entity_type->getBundleEntityType()) ->loadMultiple(); foreach ($bundles as $bundle) { $descri...
php
public function assertBundles(TableNode $expected) { $bundle_info = []; foreach ($this->getContentEntityTypes() as $entity_type) { $bundles = $this->entityTypeManager() ->getStorage($entity_type->getBundleEntityType()) ->loadMultiple(); foreach ($bundles as $bundle) { $descri...
[ "public", "function", "assertBundles", "(", "TableNode", "$", "expected", ")", "{", "$", "bundle_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getContentEntityTypes", "(", ")", "as", "$", "entity_type", ")", "{", "$", "bundles", "=", "$"...
Asserts the configuration of content entity type bundles. @Then exactly the following content entity type bundles should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "content", "entity", "type", "bundles", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ContentModelContext.php#L54-L94
acquia/drupal-spec-tool
src/Context/ContentModelContext.php
ContentModelContext.assertFields
public function assertFields(TableNode $expected) { $fields = []; foreach ($this->getContentEntityTypes() as $entity_type) { $bundles = $this->entityTypeManager() ->getStorage($entity_type->getBundleEntityType()) ->loadMultiple(); foreach ($bundles as $bundle) { /** @var stri...
php
public function assertFields(TableNode $expected) { $fields = []; foreach ($this->getContentEntityTypes() as $entity_type) { $bundles = $this->entityTypeManager() ->getStorage($entity_type->getBundleEntityType()) ->loadMultiple(); foreach ($bundles as $bundle) { /** @var stri...
[ "public", "function", "assertFields", "(", "TableNode", "$", "expected", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getContentEntityTypes", "(", ")", "as", "$", "entity_type", ")", "{", "$", "bundles", "=", "$", "t...
Asserts the configuration of fields on select content entity types. @Then exactly the following fields should exist @throws \Exception @see ContentModelContext::getContentEntityTypes
[ "Asserts", "the", "configuration", "of", "fields", "on", "select", "content", "entity", "types", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ContentModelContext.php#L105-L165
acquia/drupal-spec-tool
src/Context/ContentModelContext.php
ContentModelContext.getContentEntityTypes
protected function getContentEntityTypes() { $ids = [ 'block_content', 'media', 'node', 'paragraph', 'taxonomy_term', ]; $entity_types = []; foreach ($ids as $id) { try { $entity_types[] = $this->entityTypeManager()->getDefinition($id); } catch (Pl...
php
protected function getContentEntityTypes() { $ids = [ 'block_content', 'media', 'node', 'paragraph', 'taxonomy_term', ]; $entity_types = []; foreach ($ids as $id) { try { $entity_types[] = $this->entityTypeManager()->getDefinition($id); } catch (Pl...
[ "protected", "function", "getContentEntityTypes", "(", ")", "{", "$", "ids", "=", "[", "'block_content'", ",", "'media'", ",", "'node'", ",", "'paragraph'", ",", "'taxonomy_term'", ",", "]", ";", "$", "entity_types", "=", "[", "]", ";", "foreach", "(", "$"...
Gets the content entity types of interest. @return \Drupal\Core\Entity\EntityTypeInterface[] An array of entity types.
[ "Gets", "the", "content", "entity", "types", "of", "interest", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ContentModelContext.php#L173-L192
acquia/drupal-spec-tool
src/Context/MenuContext.php
MenuContext.assertMenusExist
public function assertMenusExist(TableNode $expected) { $menu_info = []; /** @var \Drupal\system\Entity\Menu $menu */ $menus = $this->entityTypeManager() ->getStorage('menu') ->loadMultiple(); foreach ($menus as $id => $menu) { $menu_info[] = [$menu->label(), $id, $menu->getDescription...
php
public function assertMenusExist(TableNode $expected) { $menu_info = []; /** @var \Drupal\system\Entity\Menu $menu */ $menus = $this->entityTypeManager() ->getStorage('menu') ->loadMultiple(); foreach ($menus as $id => $menu) { $menu_info[] = [$menu->label(), $id, $menu->getDescription...
[ "public", "function", "assertMenusExist", "(", "TableNode", "$", "expected", ")", "{", "$", "menu_info", "=", "[", "]", ";", "/** @var \\Drupal\\system\\Entity\\Menu $menu */", "$", "menus", "=", "$", "this", "->", "entityTypeManager", "(", ")", "->", "getStorage"...
Asserts the configuration of menus. @Then exactly the following menus should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "menus", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/MenuContext.php#L20-L37
acquia/drupal-spec-tool
src/Context/MediaContext.php
MediaContext.assertImageStyles
public function assertImageStyles(TableNode $expected) { $image_style_info = []; foreach ($this->getImageStyles() as $image_style) { $image_style_info[] = [ $image_style->label(), $image_style->id(), ]; } $actual = new TableNode($image_style_info); (new TableEqualityAsse...
php
public function assertImageStyles(TableNode $expected) { $image_style_info = []; foreach ($this->getImageStyles() as $image_style) { $image_style_info[] = [ $image_style->label(), $image_style->id(), ]; } $actual = new TableNode($image_style_info); (new TableEqualityAsse...
[ "public", "function", "assertImageStyles", "(", "TableNode", "$", "expected", ")", "{", "$", "image_style_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getImageStyles", "(", ")", "as", "$", "image_style", ")", "{", "$", "image_style_info", ...
Asserts the configuration of image styles. @Then exactly the following image styles should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "image", "styles", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/MediaContext.php#L43-L62
acquia/drupal-spec-tool
src/Context/MediaContext.php
MediaContext.assertImageEffects
public function assertImageEffects(TableNode $expected) { $image_style_info = []; foreach ($this->getImageStyles() as $image_style) { foreach ($image_style->getEffects() as $effect) { $image_style_info[] = [ $image_style->label(), (string) $effect->label(), $this->for...
php
public function assertImageEffects(TableNode $expected) { $image_style_info = []; foreach ($this->getImageStyles() as $image_style) { foreach ($image_style->getEffects() as $effect) { $image_style_info[] = [ $image_style->label(), (string) $effect->label(), $this->for...
[ "public", "function", "assertImageEffects", "(", "TableNode", "$", "expected", ")", "{", "$", "image_style_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getImageStyles", "(", ")", "as", "$", "image_style", ")", "{", "foreach", "(", "$", ...
Asserts the configuration of image effects. @Then exactly the following image effects should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "image", "effects", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/MediaContext.php#L71-L93
acquia/drupal-spec-tool
src/Context/MediaContext.php
MediaContext.formatImageEffectSummary
private function formatImageEffectSummary(array $summary) { $rendered = (string) $this->renderer->renderPlain($summary); $plaintext = strip_tags($rendered); $trimmed = trim($plaintext); $one_line = preg_replace('/[ \n]+/', ' ', $trimmed); return $one_line; }
php
private function formatImageEffectSummary(array $summary) { $rendered = (string) $this->renderer->renderPlain($summary); $plaintext = strip_tags($rendered); $trimmed = trim($plaintext); $one_line = preg_replace('/[ \n]+/', ' ', $trimmed); return $one_line; }
[ "private", "function", "formatImageEffectSummary", "(", "array", "$", "summary", ")", "{", "$", "rendered", "=", "(", "string", ")", "$", "this", "->", "renderer", "->", "renderPlain", "(", "$", "summary", ")", ";", "$", "plaintext", "=", "strip_tags", "("...
Formats an image effect summary for use in a Gherkin data table. @param array $summary An image effect summary render array. @return string The summary formatted for use in a Gherkin data table.
[ "Formats", "an", "image", "effect", "summary", "for", "use", "in", "a", "Gherkin", "data", "table", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/MediaContext.php#L120-L126
acquia/drupal-spec-tool
src/Context/WorkflowContext.php
WorkflowContext.assertWorkflows
public function assertWorkflows(TableNode $expected) { $workflow_info = []; foreach ($this->getWorkflows() as $workflow) { $workflow_info[] = [ $workflow->label(), $workflow->id(), (string) $workflow->getTypePlugin()->label(), ]; } $actual = new TableNode($workflow_in...
php
public function assertWorkflows(TableNode $expected) { $workflow_info = []; foreach ($this->getWorkflows() as $workflow) { $workflow_info[] = [ $workflow->label(), $workflow->id(), (string) $workflow->getTypePlugin()->label(), ]; } $actual = new TableNode($workflow_in...
[ "public", "function", "assertWorkflows", "(", "TableNode", "$", "expected", ")", "{", "$", "workflow_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getWorkflows", "(", ")", "as", "$", "workflow", ")", "{", "$", "workflow_info", "[", "]", ...
Asserts the configuration of workflows. @Then exactly the following workflows should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "workflows", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/WorkflowContext.php#L35-L56
acquia/drupal-spec-tool
src/Context/WorkflowContext.php
WorkflowContext.assertWorkflowStates
public function assertWorkflowStates(TableNode $expected) { $states_info = []; foreach ($this->getWorkflows() as $workflow) { /** @var \Drupal\workflows\StateInterface[] $states */ $states = $workflow->getTypePlugin()->getStates(); foreach ($states as $state) { $states_info[] = [ ...
php
public function assertWorkflowStates(TableNode $expected) { $states_info = []; foreach ($this->getWorkflows() as $workflow) { /** @var \Drupal\workflows\StateInterface[] $states */ $states = $workflow->getTypePlugin()->getStates(); foreach ($states as $state) { $states_info[] = [ ...
[ "public", "function", "assertWorkflowStates", "(", "TableNode", "$", "expected", ")", "{", "$", "states_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getWorkflows", "(", ")", "as", "$", "workflow", ")", "{", "/** @var \\Drupal\\workflows\\Stat...
Asserts the configuration of workflow states. @Then exactly the following workflow states should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "workflow", "states", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/WorkflowContext.php#L65-L90
acquia/drupal-spec-tool
src/Context/WorkflowContext.php
WorkflowContext.assertWorkflowTransitions
public function assertWorkflowTransitions(TableNode $expected) { $states_info = []; foreach ($this->getWorkflows() as $workflow) { /** @var \Drupal\workflows\TransitionInterface[] $transitions */ $transitions = $workflow->getTypePlugin()->getTransitions(); foreach ($transitions as $transition...
php
public function assertWorkflowTransitions(TableNode $expected) { $states_info = []; foreach ($this->getWorkflows() as $workflow) { /** @var \Drupal\workflows\TransitionInterface[] $transitions */ $transitions = $workflow->getTypePlugin()->getTransitions(); foreach ($transitions as $transition...
[ "public", "function", "assertWorkflowTransitions", "(", "TableNode", "$", "expected", ")", "{", "$", "states_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getWorkflows", "(", ")", "as", "$", "workflow", ")", "{", "/** @var \\Drupal\\workflows\...
Asserts the configuration of workflow transitions. @Then exactly the following workflow transitions should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "workflow", "transitions", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/WorkflowContext.php#L99-L133
acquia/drupal-spec-tool
src/Context/AccessControlContext.php
AccessControlContext.assertRolesExist
public function assertRolesExist(TableNode $expected) { $role_info = []; /** @var \Drupal\user\Entity\Role[] $roles */ $roles = $this->entityTypeManager() ->getStorage('user_role') ->loadMultiple(); foreach ($roles as $id => $role) { $role_info[] = [$role->label(), $id]; } $act...
php
public function assertRolesExist(TableNode $expected) { $role_info = []; /** @var \Drupal\user\Entity\Role[] $roles */ $roles = $this->entityTypeManager() ->getStorage('user_role') ->loadMultiple(); foreach ($roles as $id => $role) { $role_info[] = [$role->label(), $id]; } $act...
[ "public", "function", "assertRolesExist", "(", "TableNode", "$", "expected", ")", "{", "$", "role_info", "=", "[", "]", ";", "/** @var \\Drupal\\user\\Entity\\Role[] $roles */", "$", "roles", "=", "$", "this", "->", "entityTypeManager", "(", ")", "->", "getStorage...
Asserts the configuration of roles. @Then exactly the following roles should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "roles", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/AccessControlContext.php#L20-L37
acquia/drupal-spec-tool
src/Context/ViewsContext.php
ViewsContext.assertViewsExist
public function assertViewsExist(TableNode $expected) { $views_info = []; foreach ($this->getViews() as $id => $view) { $views_info[] = [ $view->label(), $id, $this->getBaseTableLabel($view->get('base_table')), $view->status() ? 'Enabled' : 'Disabled', $view->get('d...
php
public function assertViewsExist(TableNode $expected) { $views_info = []; foreach ($this->getViews() as $id => $view) { $views_info[] = [ $view->label(), $id, $this->getBaseTableLabel($view->get('base_table')), $view->status() ? 'Enabled' : 'Disabled', $view->get('d...
[ "public", "function", "assertViewsExist", "(", "TableNode", "$", "expected", ")", "{", "$", "views_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getViews", "(", ")", "as", "$", "id", "=>", "$", "view", ")", "{", "$", "views_info", "[...
Asserts the configuration of views. @Then exactly the following views should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "views", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ViewsContext.php#L51-L76
acquia/drupal-spec-tool
src/Context/ViewsContext.php
ViewsContext.assertViewDisplaysExist
public function assertViewDisplaysExist(TableNode $expected) { $displays_info = []; foreach ($this->getViews() as $view) { /** @var array $display */ foreach ($view->get('display') as $display) { $definition = $this->viewsDisplayManager ->getDefinition($display['display_plugin']); ...
php
public function assertViewDisplaysExist(TableNode $expected) { $displays_info = []; foreach ($this->getViews() as $view) { /** @var array $display */ foreach ($view->get('display') as $display) { $definition = $this->viewsDisplayManager ->getDefinition($display['display_plugin']); ...
[ "public", "function", "assertViewDisplaysExist", "(", "TableNode", "$", "expected", ")", "{", "$", "displays_info", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getViews", "(", ")", "as", "$", "view", ")", "{", "/** @var array $display */", "forea...
Asserts the configuration of views displays. @Then exactly the following views displays should exist @throws \Exception
[ "Asserts", "the", "configuration", "of", "views", "displays", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ViewsContext.php#L85-L113
acquia/drupal-spec-tool
src/Context/ViewsContext.php
ViewsContext.getBaseTables
private function getBaseTables() { $base_tables = []; /** @var array[] $wizard_plugins */ $wizard_plugins = $this->viewsWizardManager->getDefinitions(); foreach ($wizard_plugins as $wizard) { if (!array_key_exists('base_table', $wizard)) { continue; } $base_tables[$wizard['bas...
php
private function getBaseTables() { $base_tables = []; /** @var array[] $wizard_plugins */ $wizard_plugins = $this->viewsWizardManager->getDefinitions(); foreach ($wizard_plugins as $wizard) { if (!array_key_exists('base_table', $wizard)) { continue; } $base_tables[$wizard['bas...
[ "private", "function", "getBaseTables", "(", ")", "{", "$", "base_tables", "=", "[", "]", ";", "/** @var array[] $wizard_plugins */", "$", "wizard_plugins", "=", "$", "this", "->", "viewsWizardManager", "->", "getDefinitions", "(", ")", ";", "foreach", "(", "$",...
Gets the list of Views base tables. @return array|string[] An array of base table human-readable labels keyed by the corresponding IDs.
[ "Gets", "the", "list", "of", "Views", "base", "tables", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ViewsContext.php#L122-L135
acquia/drupal-spec-tool
src/Context/ViewsContext.php
ViewsContext.getBaseTableLabel
private function getBaseTableLabel($id) { return array_key_exists($id, $this->baseTables) ? $this->baseTables[$id] : $id; }
php
private function getBaseTableLabel($id) { return array_key_exists($id, $this->baseTables) ? $this->baseTables[$id] : $id; }
[ "private", "function", "getBaseTableLabel", "(", "$", "id", ")", "{", "return", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "baseTables", ")", "?", "$", "this", "->", "baseTables", "[", "$", "id", "]", ":", "$", "id", ";", "}" ]
Gets the human-readable label for a given base table ID. @param string $id A base table ID. @return string A human-readable label for the given base table ID if found, or the ID if not.
[ "Gets", "the", "human", "-", "readable", "label", "for", "a", "given", "base", "table", "ID", "." ]
train
https://github.com/acquia/drupal-spec-tool/blob/4bbc93c2ec171c6b36f68d08be3eb302ca1869ee/src/Context/ViewsContext.php#L147-L149
contentful/ContentfulBundle
src/Command/Delivery/InfoCommand.php
InfoCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Contentful clients'); if (0 === \count($this->info)) { $io->error('There are no Contentful clients currently configured.'); return 0; ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Contentful clients'); if (0 === \count($this->info)) { $io->error('There are no Contentful clients currently configured.'); return 0; ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "io", "->", "title", "(", "'Contentful ...
{@inheritdoc}
[ "{" ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/Command/Delivery/InfoCommand.php#L39-L65
contentful/ContentfulBundle
src/Controller/Delivery/ProfilerController.php
ProfilerController.detailsAction
public function detailsAction(string $token, int $requestIndex): Response { $this->profiler->disable(); $profile = $this->profiler->loadProfile($token); /** @var ClientDataCollector $collector */ $collector = $profile->getCollector('contentful'); $messages = $collector->getM...
php
public function detailsAction(string $token, int $requestIndex): Response { $this->profiler->disable(); $profile = $this->profiler->loadProfile($token); /** @var ClientDataCollector $collector */ $collector = $profile->getCollector('contentful'); $messages = $collector->getM...
[ "public", "function", "detailsAction", "(", "string", "$", "token", ",", "int", "$", "requestIndex", ")", ":", "Response", "{", "$", "this", "->", "profiler", "->", "disable", "(", ")", ";", "$", "profile", "=", "$", "this", "->", "profiler", "->", "lo...
@param string $token @param int $requestIndex @return Response
[ "@param", "string", "$token", "@param", "int", "$requestIndex" ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/Controller/Delivery/ProfilerController.php#L49-L66
contentful/ContentfulBundle
src/DependencyInjection/ContentfulExtension.php
ContentfulExtension.load
public function load(array $configs, ContainerBuilder $container) { $configs = $this->processConfiguration( new Configuration($container->getParameter('kernel.debug')), $configs ); $this->registerCache($container) ->registerCommand($container) ...
php
public function load(array $configs, ContainerBuilder $container) { $configs = $this->processConfiguration( new Configuration($container->getParameter('kernel.debug')), $configs ); $this->registerCache($container) ->registerCommand($container) ...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "configs", "=", "$", "this", "->", "processConfiguration", "(", "new", "Configuration", "(", "$", "container", "->", "getParameter", "(", "'...
{@inheritdoc}
[ "{" ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/ContentfulExtension.php#L36-L48
contentful/ContentfulBundle
src/DependencyInjection/ContentfulExtension.php
ContentfulExtension.registerCache
private function registerCache(ContainerBuilder $container): self { $container->register('contentful.delivery.cache_clearer', CacheClearer::class) ->setAbstract(\true) ; $container->register('contentful.delivery.cache_warmer', CacheWarmer::class) ->setAbstract(\true)...
php
private function registerCache(ContainerBuilder $container): self { $container->register('contentful.delivery.cache_clearer', CacheClearer::class) ->setAbstract(\true) ; $container->register('contentful.delivery.cache_warmer', CacheWarmer::class) ->setAbstract(\true)...
[ "private", "function", "registerCache", "(", "ContainerBuilder", "$", "container", ")", ":", "self", "{", "$", "container", "->", "register", "(", "'contentful.delivery.cache_clearer'", ",", "CacheClearer", "::", "class", ")", "->", "setAbstract", "(", "\\", "true...
Registers two base cache handlers, one for warming up and one for clearing. They are defined as abstract as a "concrete" implementation will be defined for every configured client. @param ContainerBuilder $container @return ContentfulExtension
[ "Registers", "two", "base", "cache", "handlers", "one", "for", "warming", "up", "and", "one", "for", "clearing", ".", "They", "are", "defined", "as", "abstract", "as", "a", "concrete", "implementation", "will", "be", "defined", "for", "every", "configured", ...
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/ContentfulExtension.php#L59-L70
contentful/ContentfulBundle
src/DependencyInjection/ContentfulExtension.php
ContentfulExtension.registerCommand
private function registerCommand(ContainerBuilder $container): self { $container->register('contentful.delivery.command.info', InfoCommand::class) ->addArgument(new Parameter('contentful.delivery.clients.info')) ->addTag('console.command', [ 'command' => 'contentful:d...
php
private function registerCommand(ContainerBuilder $container): self { $container->register('contentful.delivery.command.info', InfoCommand::class) ->addArgument(new Parameter('contentful.delivery.clients.info')) ->addTag('console.command', [ 'command' => 'contentful:d...
[ "private", "function", "registerCommand", "(", "ContainerBuilder", "$", "container", ")", ":", "self", "{", "$", "container", "->", "register", "(", "'contentful.delivery.command.info'", ",", "InfoCommand", "::", "class", ")", "->", "addArgument", "(", "new", "Par...
Registers the CLI command which is in charge of extracting the configuration info, and displaying it for debugging purposes. @param ContainerBuilder $container @return ContentfulExtension
[ "Registers", "the", "CLI", "command", "which", "is", "in", "charge", "of", "extracting", "the", "configuration", "info", "and", "displaying", "it", "for", "debugging", "purposes", "." ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/ContentfulExtension.php#L80-L98
contentful/ContentfulBundle
src/DependencyInjection/ContentfulExtension.php
ContentfulExtension.registerDataCollector
private function registerDataCollector(ContainerBuilder $container): self { $container->register('contentful.delivery.data_collector', ClientDataCollector::class) ->addArgument(new TaggedIteratorArgument('contentful.delivery.client')) ->addArgument(new Parameter('contentful.delivery....
php
private function registerDataCollector(ContainerBuilder $container): self { $container->register('contentful.delivery.data_collector', ClientDataCollector::class) ->addArgument(new TaggedIteratorArgument('contentful.delivery.client')) ->addArgument(new Parameter('contentful.delivery....
[ "private", "function", "registerDataCollector", "(", "ContainerBuilder", "$", "container", ")", ":", "self", "{", "$", "container", "->", "register", "(", "'contentful.delivery.data_collector'", ",", "ClientDataCollector", "::", "class", ")", "->", "addArgument", "(",...
Registers the data collector, which will display info about the configured clients and the queries being made to the API. @param ContainerBuilder $container @return ContentfulExtension
[ "Registers", "the", "data", "collector", "which", "will", "display", "info", "about", "the", "configured", "clients", "and", "the", "queries", "being", "made", "to", "the", "API", "." ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/ContentfulExtension.php#L108-L121
contentful/ContentfulBundle
src/DependencyInjection/ContentfulExtension.php
ContentfulExtension.configureDeliveryOptions
private function configureDeliveryOptions(array $options): array { $logger = $options['options']['logger']; if (\null !== $logger) { $options['options']['logger'] = \true === $logger ? new Reference(LoggerInterface::class) : new Reference($options['options...
php
private function configureDeliveryOptions(array $options): array { $logger = $options['options']['logger']; if (\null !== $logger) { $options['options']['logger'] = \true === $logger ? new Reference(LoggerInterface::class) : new Reference($options['options...
[ "private", "function", "configureDeliveryOptions", "(", "array", "$", "options", ")", ":", "array", "{", "$", "logger", "=", "$", "options", "[", "'options'", "]", "[", "'logger'", "]", ";", "if", "(", "\\", "null", "!==", "$", "logger", ")", "{", "$",...
Converts the references in the configuration into actual Reference objects. @param array $options @return array
[ "Converts", "the", "references", "in", "the", "configuration", "into", "actual", "Reference", "objects", "." ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/ContentfulExtension.php#L188-L209
contentful/ContentfulBundle
src/DataCollector/Delivery/ClientDataCollector.php
ClientDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = \null) { $messages = []; foreach ($this->clients as $client) { $messages = \array_merge($messages, $client->getMessages()); } $this->data['messages'] = $messages; }
php
public function collect(Request $request, Response $response, \Exception $exception = \null) { $messages = []; foreach ($this->clients as $client) { $messages = \array_merge($messages, $client->getMessages()); } $this->data['messages'] = $messages; }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "\\", "null", ")", "{", "$", "messages", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "clients",...
{@inheritdoc}
[ "{" ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DataCollector/Delivery/ClientDataCollector.php#L52-L60
contentful/ContentfulBundle
src/Command/Delivery/DebugCommand.php
DebugCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $name = $input->getArgument('client-name'); if (!$name && 1 === \count($this->clients)) { $name = \array_keys($this->clients)[0]; } if (!isset($thi...
php
public function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $name = $input->getArgument('client-name'); if (!$name && 1 === \count($this->clients)) { $name = \array_keys($this->clients)[0]; } if (!isset($thi...
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "name", "=", "$", "input", "->", "getArg...
{@inheritdoc}
[ "{" ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/Command/Delivery/DebugCommand.php#L63-L148
contentful/ContentfulBundle
src/DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder(); $root = $treeBuilder->root('contentful', 'array', $this->builder); $root ->addDefaultsIfNotSet() ->children() ->arrayNode('delivery') ->requiresAtLeastOneE...
php
public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder(); $root = $treeBuilder->root('contentful', 'array', $this->builder); $root ->addDefaultsIfNotSet() ->children() ->arrayNode('delivery') ->requiresAtLeastOneE...
[ "public", "function", "getConfigTreeBuilder", "(", ")", ":", "TreeBuilder", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", ")", ";", "$", "root", "=", "$", "treeBuilder", "->", "root", "(", "'contentful'", ",", "'array'", ",", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/Configuration.php#L42-L64
contentful/ContentfulBundle
src/DependencyInjection/Compiler/ProfilerControllerPass.php
ProfilerControllerPass.process
public function process(ContainerBuilder $container) { if (!$container->hasDefinition('profiler') || !$container->hasDefinition('twig')) { return; } $container->register('contentful.delivery.profiler_controller', ProfilerController::class) ->setArguments([ ...
php
public function process(ContainerBuilder $container) { if (!$container->hasDefinition('profiler') || !$container->hasDefinition('twig')) { return; } $container->register('contentful.delivery.profiler_controller', ProfilerController::class) ->setArguments([ ...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "if", "(", "!", "$", "container", "->", "hasDefinition", "(", "'profiler'", ")", "||", "!", "$", "container", "->", "hasDefinition", "(", "'twig'", ")", ")", "{", "return...
Loads the definition for the ProfilerController when the profiler and twig are present. @param ContainerBuilder $container
[ "Loads", "the", "definition", "for", "the", "ProfilerController", "when", "the", "profiler", "and", "twig", "are", "present", "." ]
train
https://github.com/contentful/ContentfulBundle/blob/f77d946eb1f784250ea5f302349be6e3e1dd4165/src/DependencyInjection/Compiler/ProfilerControllerPass.php#L26-L40
ezsystems/ezplatform-http-cache
src/EventSubscriber/UserContextSubscriber.php
UserContextSubscriber.tagUserContext
public function tagUserContext(FilterResponseEvent $event) { $response = $event->getResponse(); if (!$response->isCacheable()) { return; } if ($response->headers->get('Content-Type') !== 'application/vnd.fos.user-context-hash') { return; } if...
php
public function tagUserContext(FilterResponseEvent $event) { $response = $event->getResponse(); if (!$response->isCacheable()) { return; } if ($response->headers->get('Content-Type') !== 'application/vnd.fos.user-context-hash') { return; } if...
[ "public", "function", "tagUserContext", "(", "FilterResponseEvent", "$", "event", ")", "{", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "if", "(", "!", "$", "response", "->", "isCacheable", "(", ")", ")", "{", "return", ";", ...
Tag vnd.fos.user-context-hash responses if they are set to cached. @param FilterResponseEvent $event
[ "Tag", "vnd", ".", "fos", ".", "user", "-", "context", "-", "hash", "responses", "if", "they", "are", "set", "to", "cached", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/EventSubscriber/UserContextSubscriber.php#L43-L61
ezsystems/ezplatform-http-cache
src/EventSubscriber/RestKernelViewSubscriber.php
RestKernelViewSubscriber.getTags
protected function getTags($value) { $tags = []; switch ($value) { case $value instanceof VersionList && !empty($value->versions): $tags[] = 'content-' . $value->versions[0]->contentInfo->id; $tags[] = 'content-versions-' . $value->versions[0]->contentInfo...
php
protected function getTags($value) { $tags = []; switch ($value) { case $value instanceof VersionList && !empty($value->versions): $tags[] = 'content-' . $value->versions[0]->contentInfo->id; $tags[] = 'content-versions-' . $value->versions[0]->contentInfo...
[ "protected", "function", "getTags", "(", "$", "value", ")", "{", "$", "tags", "=", "[", "]", ";", "switch", "(", "$", "value", ")", "{", "case", "$", "value", "instanceof", "VersionList", "&&", "!", "empty", "(", "$", "value", "->", "versions", ")", ...
@param object $value @return array
[ "@param", "object", "$value" ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/EventSubscriber/RestKernelViewSubscriber.php#L68-L126
ezsystems/ezplatform-http-cache
src/AppCache.php
AppCache.handle
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { $response = parent::handle($request, $type, $catch); if (!$this->getKernel()->isDebug()) { $this->cleanupHeadersForProd($response); } return $response; }
php
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { $response = parent::handle($request, $type, $catch); if (!$this->getKernel()->isDebug()) { $this->cleanupHeadersForProd($response); } return $response; }
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "$", "type", "=", "HttpKernelInterface", "::", "MASTER_REQUEST", ",", "$", "catch", "=", "true", ")", "{", "$", "response", "=", "parent", "::", "handle", "(", "$", "request", ",", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/AppCache.php#L34-L43
ezsystems/ezplatform-http-cache
src/AppCache.php
AppCache.invalidate
protected function invalidate(Request $request, $catch = false) { if ($request->getMethod() !== 'PURGE' && $request->getMethod() !== 'BAN') { return parent::invalidate($request, $catch); } // Reject all non-authorized clients if (!in_array($request->getClientIp(), $this-...
php
protected function invalidate(Request $request, $catch = false) { if ($request->getMethod() !== 'PURGE' && $request->getMethod() !== 'BAN') { return parent::invalidate($request, $catch); } // Reject all non-authorized clients if (!in_array($request->getClientIp(), $this-...
[ "protected", "function", "invalidate", "(", "Request", "$", "request", ",", "$", "catch", "=", "false", ")", "{", "if", "(", "$", "request", "->", "getMethod", "(", ")", "!==", "'PURGE'", "&&", "$", "request", "->", "getMethod", "(", ")", "!==", "'BAN'...
{@inheritdoc}
[ "{" ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/AppCache.php#L57-L83
ezsystems/ezplatform-http-cache
src/AppCache.php
AppCache.cleanupHeadersForProd
protected function cleanupHeadersForProd(Response $response) { // remove headers that identify the content or internal digest info $response->headers->remove('xkey'); $response->headers->remove('x-content-digest'); // remove vary by X-User-Hash header $varyValues = []; ...
php
protected function cleanupHeadersForProd(Response $response) { // remove headers that identify the content or internal digest info $response->headers->remove('xkey'); $response->headers->remove('x-content-digest'); // remove vary by X-User-Hash header $varyValues = []; ...
[ "protected", "function", "cleanupHeadersForProd", "(", "Response", "$", "response", ")", "{", "// remove headers that identify the content or internal digest info", "$", "response", "->", "headers", "->", "remove", "(", "'xkey'", ")", ";", "$", "response", "->", "header...
Perform cleanup of reponse. @param Response $response
[ "Perform", "cleanup", "of", "reponse", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/AppCache.php#L100-L130
ezsystems/ezplatform-http-cache
src/Twig/ContentTaggingExtension.php
ContentTaggingExtension.tagHttpCacheForLocation
public function tagHttpCacheForLocation(Location $location) { $this->responseTagger->tag($location); $this->responseTagger->tag($location->getContentInfo()); }
php
public function tagHttpCacheForLocation(Location $location) { $this->responseTagger->tag($location); $this->responseTagger->tag($location->getContentInfo()); }
[ "public", "function", "tagHttpCacheForLocation", "(", "Location", "$", "location", ")", "{", "$", "this", "->", "responseTagger", "->", "tag", "(", "$", "location", ")", ";", "$", "this", "->", "responseTagger", "->", "tag", "(", "$", "location", "->", "ge...
Adds tags to current response. @internal Function is only for use within this class (and implicit by Twig). @param Location $location
[ "Adds", "tags", "to", "current", "response", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/Twig/ContentTaggingExtension.php#L50-L54
ezsystems/ezplatform-http-cache
src/Proxy/TagAwareStore.php
TagAwareStore.write
public function write(Request $request, Response $response) { $key = parent::write($request, $response); // Get tags in order to save them $digest = $response->headers->get('X-Content-Digest'); $tags = $response->headers->get('xkey', null, false); if (count($tags) === 1) { ...
php
public function write(Request $request, Response $response) { $key = parent::write($request, $response); // Get tags in order to save them $digest = $response->headers->get('X-Content-Digest'); $tags = $response->headers->get('xkey', null, false); if (count($tags) === 1) { ...
[ "public", "function", "write", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "key", "=", "parent", "::", "write", "(", "$", "request", ",", "$", "response", ")", ";", "// Get tags in order to save them", "$", "digest", "=...
Writes a cache entry to the store for the given Request and Response. Existing entries are read and any that match the response are removed. This method calls write with the new list of cache entries. @param Request $request A Request instance @param Response $response A Response instance @return string The key un...
[ "Writes", "a", "cache", "entry", "to", "the", "store", "for", "the", "given", "Request", "and", "Response", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/Proxy/TagAwareStore.php#L68-L88
ezsystems/ezplatform-http-cache
src/Proxy/TagAwareStore.php
TagAwareStore.saveTag
private function saveTag($tag, $digest) { $path = $this->getTagPath($tag) . DIRECTORY_SEPARATOR . $digest; if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { return false; } $tmpFile = tempnam(dirname($path), basenam...
php
private function saveTag($tag, $digest) { $path = $this->getTagPath($tag) . DIRECTORY_SEPARATOR . $digest; if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { return false; } $tmpFile = tempnam(dirname($path), basenam...
[ "private", "function", "saveTag", "(", "$", "tag", ",", "$", "digest", ")", "{", "$", "path", "=", "$", "this", "->", "getTagPath", "(", "$", "tag", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "digest", ";", "if", "(", "!", "is_dir", "(", "dirname", ...
Save digest for the given tag. @param string $tag The tag key @param string $digest The digest hash to store representing the cache item. @return bool
[ "Save", "digest", "for", "the", "given", "tag", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/Proxy/TagAwareStore.php#L98-L123
ezsystems/ezplatform-http-cache
src/Proxy/TagAwareStore.php
TagAwareStore.purgeByRequest
public function purgeByRequest(Request $request) { if (!$request->headers->has('X-Location-Id') && !$request->headers->has('key')) { return $this->purge($request->getUri()); } // For BC with older purge code covering most use cases. $locationId = $request->headers->get('...
php
public function purgeByRequest(Request $request) { if (!$request->headers->has('X-Location-Id') && !$request->headers->has('key')) { return $this->purge($request->getUri()); } // For BC with older purge code covering most use cases. $locationId = $request->headers->get('...
[ "public", "function", "purgeByRequest", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "request", "->", "headers", "->", "has", "(", "'X-Location-Id'", ")", "&&", "!", "$", "request", "->", "headers", "->", "has", "(", "'key'", ")", ")"...
Purges data from $request. If key or X-Location-Id (deprecated) header is present, the store will purge cache for given locationId or group of locationIds. If not, regular purge by URI will occur. @param \Symfony\Component\HttpFoundation\Request $request @return bool True if purge was successful. False otherwise
[ "Purges", "data", "from", "$request", ".", "If", "key", "or", "X", "-", "Location", "-", "Id", "(", "deprecated", ")", "header", "is", "present", "the", "store", "will", "purge", "cache", "for", "given", "locationId", "or", "group", "of", "locationIds", ...
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/Proxy/TagAwareStore.php#L134-L167
ezsystems/ezplatform-http-cache
src/Proxy/TagAwareStore.php
TagAwareStore.purgeByCacheTag
private function purgeByCacheTag($tag) { $cacheTagsCacheDir = $this->getTagPath($tag); if (!file_exists($cacheTagsCacheDir) || !is_dir($cacheTagsCacheDir)) { return; } $files = (new Finder())->files()->in($cacheTagsCacheDir); foreach ($files as $file) { ...
php
private function purgeByCacheTag($tag) { $cacheTagsCacheDir = $this->getTagPath($tag); if (!file_exists($cacheTagsCacheDir) || !is_dir($cacheTagsCacheDir)) { return; } $files = (new Finder())->files()->in($cacheTagsCacheDir); foreach ($files as $file) { ...
[ "private", "function", "purgeByCacheTag", "(", "$", "tag", ")", "{", "$", "cacheTagsCacheDir", "=", "$", "this", "->", "getTagPath", "(", "$", "tag", ")", ";", "if", "(", "!", "file_exists", "(", "$", "cacheTagsCacheDir", ")", "||", "!", "is_dir", "(", ...
Purges cache for tag. @param string $tag
[ "Purges", "cache", "for", "tag", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/Proxy/TagAwareStore.php#L182-L198
ezsystems/ezplatform-http-cache
src/Proxy/TagAwareStore.php
TagAwareStore.getTagPath
public function getTagPath($tag = null) { $path = $this->root . DIRECTORY_SEPARATOR . static::TAG_CACHE_DIR; if ($tag) { // Flip the tag so we put id first so it gets sliced into folders. // (otherwise we would easily reach inode limits on file system) $tag = strr...
php
public function getTagPath($tag = null) { $path = $this->root . DIRECTORY_SEPARATOR . static::TAG_CACHE_DIR; if ($tag) { // Flip the tag so we put id first so it gets sliced into folders. // (otherwise we would easily reach inode limits on file system) $tag = strr...
[ "public", "function", "getTagPath", "(", "$", "tag", "=", "null", ")", "{", "$", "path", "=", "$", "this", "->", "root", ".", "DIRECTORY_SEPARATOR", ".", "static", "::", "TAG_CACHE_DIR", ";", "if", "(", "$", "tag", ")", "{", "// Flip the tag so we put id f...
Returns cache dir for $tag. This method is public only for unit tests. Use it only if you know what you are doing. @internal @param int $tag @return string
[ "Returns", "cache", "dir", "for", "$tag", "." ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/src/Proxy/TagAwareStore.php#L212-L223
ezsystems/ezplatform-http-cache
spec/EventSubscriber/RestKernelViewSubscriberSpec.php
RestKernelViewSubscriberSpec.it_does_nothing_on_content_type_draft
public function it_does_nothing_on_content_type_draft( GetResponseForControllerResultEvent $event, Request $request, ParameterBag $attributes, ContentType $restValue, TagHandler $tagHandler ) { $request->isMethodCacheable()->willReturn(true); $attributes->get(...
php
public function it_does_nothing_on_content_type_draft( GetResponseForControllerResultEvent $event, Request $request, ParameterBag $attributes, ContentType $restValue, TagHandler $tagHandler ) { $request->isMethodCacheable()->willReturn(true); $attributes->get(...
[ "public", "function", "it_does_nothing_on_content_type_draft", "(", "GetResponseForControllerResultEvent", "$", "event", ",", "Request", "$", "request", ",", "ParameterBag", "$", "attributes", ",", "ContentType", "$", "restValue", ",", "TagHandler", "$", "tagHandler", "...
ContentType
[ "ContentType" ]
train
https://github.com/ezsystems/ezplatform-http-cache/blob/54d6c0b10c60e9e041d8900e519aa46dc3656f0a/spec/EventSubscriber/RestKernelViewSubscriberSpec.php#L95-L112