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
Smile-SA/elasticsuite
src/module-elasticsuite-core/Model/Search/RequestMapper.php
RequestMapper.getSortOrders
public function getSortOrders(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria) { $sortOrders = []; foreach ($searchCriteria->getSortOrders() ?? [] as $sortOrder) { $sortOrders[$sortOrder->getField()] = ['direction' => $sortOrder->getDirec...
php
public function getSortOrders(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria) { $sortOrders = []; foreach ($searchCriteria->getSortOrders() ?? [] as $sortOrder) { $sortOrders[$sortOrder->getField()] = ['direction' => $sortOrder->getDirec...
[ "public", "function", "getSortOrders", "(", "ContainerConfigurationInterface", "$", "containerConfiguration", ",", "SearchCriteriaInterface", "$", "searchCriteria", ")", "{", "$", "sortOrders", "=", "[", "]", ";", "foreach", "(", "$", "searchCriteria", "->", "getSortO...
Extract sort orders from the search criteria. @SuppressWarnings(PHPMD.UnusedFormalParameter) @param ContainerConfigurationInterface $containerConfiguration Container config. @param SearchCriteriaInterface $searchCriteria Search criteria. @return array
[ "Extract", "sort", "orders", "from", "the", "search", "criteria", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Model/Search/RequestMapper.php#L39-L48
Smile-SA/elasticsuite
src/module-elasticsuite-core/Model/Search/RequestMapper.php
RequestMapper.getFilters
public function getFilters(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria) { $filters = []; foreach ($searchCriteria->getFilterGroups() ?? [] as $filterGroup) { foreach ($filterGroup->getFilters() ?? [] as $filter) { if (...
php
public function getFilters(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria) { $filters = []; foreach ($searchCriteria->getFilterGroups() ?? [] as $filterGroup) { foreach ($filterGroup->getFilters() ?? [] as $filter) { if (...
[ "public", "function", "getFilters", "(", "ContainerConfigurationInterface", "$", "containerConfiguration", ",", "SearchCriteriaInterface", "$", "searchCriteria", ")", "{", "$", "filters", "=", "[", "]", ";", "foreach", "(", "$", "searchCriteria", "->", "getFilterGroup...
Extract filters from the search criteria. @SuppressWarnings(PHPMD.UnusedFormalParameter) @param ContainerConfigurationInterface $containerConfiguration Container config. @param SearchCriteriaInterface $searchCriteria Search criteria. @return array
[ "Extract", "filters", "from", "the", "search", "criteria", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Model/Search/RequestMapper.php#L60-L73
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Search/Request/Product/Attribute/Aggregation/DefaultAttribute.php
DefaultAttribute.getAggregationData
public function getAggregationData(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute) { $bucketConfig = [ 'name' => $this->getFilterField($attribute), 'size' => (int) $attribute->getFacetMaxSize(), 'type' => \Smile\ElasticsuiteCore\Search\Reques...
php
public function getAggregationData(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute) { $bucketConfig = [ 'name' => $this->getFilterField($attribute), 'size' => (int) $attribute->getFacetMaxSize(), 'type' => \Smile\ElasticsuiteCore\Search\Reques...
[ "public", "function", "getAggregationData", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "ResourceModel", "\\", "Eav", "\\", "Attribute", "$", "attribute", ")", "{", "$", "bucketConfig", "=", "[", "'name'", "=>", "$", "this", "->", "getFilterF...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Search/Request/Product/Attribute/Aggregation/DefaultAttribute.php#L46-L62
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Search/Request/Product/Attribute/Aggregation/DefaultAttribute.php
DefaultAttribute.getFilterField
protected function getFilterField(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute) { return $this->mappingHelper->getFilterField($attribute); }
php
protected function getFilterField(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute) { return $this->mappingHelper->getFilterField($attribute); }
[ "protected", "function", "getFilterField", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "ResourceModel", "\\", "Eav", "\\", "Attribute", "$", "attribute", ")", "{", "return", "$", "this", "->", "mappingHelper", "->", "getFilterField", "(", "$", ...
Retrieve ES filter field. @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute The attribute @return string
[ "Retrieve", "ES", "filter", "field", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Search/Request/Product/Attribute/Aggregation/DefaultAttribute.php#L71-L74
Kong/unirest-php
src/Unirest/Request/Body.php
Body.File
public static function File($filename, $mimetype = '', $postname = '') { if (class_exists('CURLFile')) { return new \CURLFile($filename, $mimetype, $postname); } if (function_exists('curl_file_create')) { return curl_file_create($filename, $mimetype, $postname); ...
php
public static function File($filename, $mimetype = '', $postname = '') { if (class_exists('CURLFile')) { return new \CURLFile($filename, $mimetype, $postname); } if (function_exists('curl_file_create')) { return curl_file_create($filename, $mimetype, $postname); ...
[ "public", "static", "function", "File", "(", "$", "filename", ",", "$", "mimetype", "=", "''", ",", "$", "postname", "=", "''", ")", "{", "if", "(", "class_exists", "(", "'CURLFile'", ")", ")", "{", "return", "new", "\\", "CURLFile", "(", "$", "filen...
Prepares a file for upload. To be used inside the parameters declaration for a request. @param string $filename The file path @param string $mimetype MIME type @param string $postname the file name @return string|\CURLFile
[ "Prepares", "a", "file", "for", "upload", ".", "To", "be", "used", "inside", "the", "parameters", "declaration", "for", "a", "request", "." ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request/Body.php#L17-L28
Kong/unirest-php
src/Unirest/Request.php
Request.jsonOpts
public static function jsonOpts($assoc = false, $depth = 512, $options = 0) { return self::$jsonOpts = array($assoc, $depth, $options); }
php
public static function jsonOpts($assoc = false, $depth = 512, $options = 0) { return self::$jsonOpts = array($assoc, $depth, $options); }
[ "public", "static", "function", "jsonOpts", "(", "$", "assoc", "=", "false", ",", "$", "depth", "=", "512", ",", "$", "options", "=", "0", ")", "{", "return", "self", "::", "$", "jsonOpts", "=", "array", "(", "$", "assoc", ",", "$", "depth", ",", ...
Set JSON decode mode @param bool $assoc When TRUE, returned objects will be converted into associative arrays. @param integer $depth User specified recursion depth. @param integer $options Bitmask of JSON decode options. Currently only JSON_BIGINT_AS_STRING is supported (default is to cast large integers as floats) @r...
[ "Set", "JSON", "decode", "mode" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L43-L46
Kong/unirest-php
src/Unirest/Request.php
Request.auth
public static function auth($username = '', $password = '', $method = CURLAUTH_BASIC) { self::$auth['user'] = $username; self::$auth['pass'] = $password; self::$auth['method'] = $method; }
php
public static function auth($username = '', $password = '', $method = CURLAUTH_BASIC) { self::$auth['user'] = $username; self::$auth['pass'] = $password; self::$auth['method'] = $method; }
[ "public", "static", "function", "auth", "(", "$", "username", "=", "''", ",", "$", "password", "=", "''", ",", "$", "method", "=", "CURLAUTH_BASIC", ")", "{", "self", "::", "$", "auth", "[", "'user'", "]", "=", "$", "username", ";", "self", "::", "...
Set authentication method to use @param string $username authentication username @param string $password authentication password @param integer $method authentication method
[ "Set", "authentication", "method", "to", "use" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L187-L192
Kong/unirest-php
src/Unirest/Request.php
Request.proxy
public static function proxy($address, $port = 1080, $type = CURLPROXY_HTTP, $tunnel = false) { self::$proxy['type'] = $type; self::$proxy['port'] = $port; self::$proxy['tunnel'] = $tunnel; self::$proxy['address'] = $address; }
php
public static function proxy($address, $port = 1080, $type = CURLPROXY_HTTP, $tunnel = false) { self::$proxy['type'] = $type; self::$proxy['port'] = $port; self::$proxy['tunnel'] = $tunnel; self::$proxy['address'] = $address; }
[ "public", "static", "function", "proxy", "(", "$", "address", ",", "$", "port", "=", "1080", ",", "$", "type", "=", "CURLPROXY_HTTP", ",", "$", "tunnel", "=", "false", ")", "{", "self", "::", "$", "proxy", "[", "'type'", "]", "=", "$", "type", ";",...
Set proxy to use @param string $address proxy address @param integer $port proxy port @param integer $type (Available options for this are CURLPROXY_HTTP, CURLPROXY_HTTP_1_0 CURLPROXY_SOCKS4, CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5_HOSTNAME) @param bool $tunnel enable/disable tunneling
[ "Set", "proxy", "to", "use" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L202-L208
Kong/unirest-php
src/Unirest/Request.php
Request.proxyAuth
public static function proxyAuth($username = '', $password = '', $method = CURLAUTH_BASIC) { self::$proxy['auth']['user'] = $username; self::$proxy['auth']['pass'] = $password; self::$proxy['auth']['method'] = $method; }
php
public static function proxyAuth($username = '', $password = '', $method = CURLAUTH_BASIC) { self::$proxy['auth']['user'] = $username; self::$proxy['auth']['pass'] = $password; self::$proxy['auth']['method'] = $method; }
[ "public", "static", "function", "proxyAuth", "(", "$", "username", "=", "''", ",", "$", "password", "=", "''", ",", "$", "method", "=", "CURLAUTH_BASIC", ")", "{", "self", "::", "$", "proxy", "[", "'auth'", "]", "[", "'user'", "]", "=", "$", "usernam...
Set proxy authentication method to use @param string $username authentication username @param string $password authentication password @param integer $method authentication method
[ "Set", "proxy", "authentication", "method", "to", "use" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L217-L222
Kong/unirest-php
src/Unirest/Request.php
Request.get
public static function get($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::GET, $url, $parameters, $headers, $username, $password); }
php
public static function get($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::GET, $url, $parameters, $headers, $username, $password); }
[ "public", "static", "function", "get", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "parameters", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send"...
Send a GET request to a URL @param string $url URL to send the GET request to @param array $headers additional headers to send @param mixed $parameters parameters to send in the querystring @param string $username Authentication username (deprecated) @param string $password Authentication password (deprecated) @return...
[ "Send", "a", "GET", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L234-L237
Kong/unirest-php
src/Unirest/Request.php
Request.head
public static function head($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::HEAD, $url, $parameters, $headers, $username, $password); }
php
public static function head($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::HEAD, $url, $parameters, $headers, $username, $password); }
[ "public", "static", "function", "head", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "parameters", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send...
Send a HEAD request to a URL @param string $url URL to send the HEAD request to @param array $headers additional headers to send @param mixed $parameters parameters to send in the querystring @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (deprec...
[ "Send", "a", "HEAD", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L248-L251
Kong/unirest-php
src/Unirest/Request.php
Request.options
public static function options($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::OPTIONS, $url, $parameters, $headers, $username, $password); }
php
public static function options($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::OPTIONS, $url, $parameters, $headers, $username, $password); }
[ "public", "static", "function", "options", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "parameters", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "s...
Send a OPTIONS request to a URL @param string $url URL to send the OPTIONS request to @param array $headers additional headers to send @param mixed $parameters parameters to send in the querystring @param string $username Basic Authentication username @param string $password Basic Authentication password @return Respon...
[ "Send", "a", "OPTIONS", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L262-L265
Kong/unirest-php
src/Unirest/Request.php
Request.connect
public static function connect($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::CONNECT, $url, $parameters, $headers, $username, $password); }
php
public static function connect($url, $headers = array(), $parameters = null, $username = null, $password = null) { return self::send(Method::CONNECT, $url, $parameters, $headers, $username, $password); }
[ "public", "static", "function", "connect", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "parameters", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "s...
Send a CONNECT request to a URL @param string $url URL to send the CONNECT request to @param array $headers additional headers to send @param mixed $parameters parameters to send in the querystring @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (...
[ "Send", "a", "CONNECT", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L276-L279
Kong/unirest-php
src/Unirest/Request.php
Request.post
public static function post($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::POST, $url, $body, $headers, $username, $password); }
php
public static function post($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::POST, $url, $body, $headers, $username, $password); }
[ "public", "static", "function", "post", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "body", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send", "...
Send POST request to a URL @param string $url URL to send the POST request to @param array $headers additional headers to send @param mixed $body POST body data @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (deprecated) @return Response response
[ "Send", "POST", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L290-L293
Kong/unirest-php
src/Unirest/Request.php
Request.delete
public static function delete($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::DELETE, $url, $body, $headers, $username, $password); }
php
public static function delete($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::DELETE, $url, $body, $headers, $username, $password); }
[ "public", "static", "function", "delete", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "body", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send", ...
Send DELETE request to a URL @param string $url URL to send the DELETE request to @param array $headers additional headers to send @param mixed $body DELETE body data @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (deprecated) @return Response
[ "Send", "DELETE", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L304-L307
Kong/unirest-php
src/Unirest/Request.php
Request.put
public static function put($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::PUT, $url, $body, $headers, $username, $password); }
php
public static function put($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::PUT, $url, $body, $headers, $username, $password); }
[ "public", "static", "function", "put", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "body", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send", "(...
Send PUT request to a URL @param string $url URL to send the PUT request to @param array $headers additional headers to send @param mixed $body PUT body data @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (deprecated) @return Response
[ "Send", "PUT", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L318-L321
Kong/unirest-php
src/Unirest/Request.php
Request.patch
public static function patch($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::PATCH, $url, $body, $headers, $username, $password); }
php
public static function patch($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::PATCH, $url, $body, $headers, $username, $password); }
[ "public", "static", "function", "patch", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "body", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send", ...
Send PATCH request to a URL @param string $url URL to send the PATCH request to @param array $headers additional headers to send @param mixed $body PATCH body data @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (deprecated) @return Response
[ "Send", "PATCH", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L332-L335
Kong/unirest-php
src/Unirest/Request.php
Request.trace
public static function trace($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::TRACE, $url, $body, $headers, $username, $password); }
php
public static function trace($url, $headers = array(), $body = null, $username = null, $password = null) { return self::send(Method::TRACE, $url, $body, $headers, $username, $password); }
[ "public", "static", "function", "trace", "(", "$", "url", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "body", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "return", "self", "::", "send", ...
Send TRACE request to a URL @param string $url URL to send the TRACE request to @param array $headers additional headers to send @param mixed $body TRACE body data @param string $username Basic Authentication username (deprecated) @param string $password Basic Authentication password (deprecated) @return Response
[ "Send", "TRACE", "request", "to", "a", "URL" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L346-L349
Kong/unirest-php
src/Unirest/Request.php
Request.buildHTTPCurlQuery
public static function buildHTTPCurlQuery($data, $parent = false) { $result = array(); if (is_object($data)) { $data = get_object_vars($data); } foreach ($data as $key => $value) { if ($parent) { $new_key = sprintf('%s[%s]', $parent, $key); ...
php
public static function buildHTTPCurlQuery($data, $parent = false) { $result = array(); if (is_object($data)) { $data = get_object_vars($data); } foreach ($data as $key => $value) { if ($parent) { $new_key = sprintf('%s[%s]', $parent, $key); ...
[ "public", "static", "function", "buildHTTPCurlQuery", "(", "$", "data", ",", "$", "parent", "=", "false", ")", "{", "$", "result", "=", "array", "(", ")", ";", "if", "(", "is_object", "(", "$", "data", ")", ")", "{", "$", "data", "=", "get_object_var...
This function is useful for serializing multidimensional arrays, and avoid getting the 'Array to string conversion' notice @param array|object $data array to flatten. @param bool|string $parent parent key or false if no parent @return array
[ "This", "function", "is", "useful", "for", "serializing", "multidimensional", "arrays", "and", "avoid", "getting", "the", "Array", "to", "string", "conversion", "notice" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L358-L381
Kong/unirest-php
src/Unirest/Request.php
Request.send
public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null) { self::$handle = curl_init(); if ($method !== Method::GET) { if ($method === Method::POST) { curl_setopt(self::$handle, CURLOPT_POST, true); } else { if ($met...
php
public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null) { self::$handle = curl_init(); if ($method !== Method::GET) { if ($method === Method::POST) { curl_setopt(self::$handle, CURLOPT_POST, true); } else { if ($met...
[ "public", "static", "function", "send", "(", "$", "method", ",", "$", "url", ",", "$", "body", "=", "null", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "self", "::",...
Send a cURL request @param \Unirest\Method|string $method HTTP method to use @param string $url URL to send the request to @param mixed $body request body @param array $headers additional headers to send @param string $username Authentication username (deprecated) @param string $password Authentication password (deprec...
[ "Send", "a", "cURL", "request" ]
train
https://github.com/Kong/unirest-php/blob/14aa9aa6919e4b70c59cd20722ac113c0ffeb45b/src/Unirest/Request.php#L394-L489
yiisoft/yii2-app-basic
models/User.php
User.findIdentity
public static function findIdentity($id) { return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; }
php
public static function findIdentity($id) { return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; }
[ "public", "static", "function", "findIdentity", "(", "$", "id", ")", "{", "return", "isset", "(", "self", "::", "$", "users", "[", "$", "id", "]", ")", "?", "new", "static", "(", "self", "::", "$", "users", "[", "$", "id", "]", ")", ":", "null", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-app-basic/blob/088c23462dcec61af9fa0ae03a9ce05428d7ac78/models/User.php#L34-L37
yiisoft/yii2-app-basic
models/User.php
User.findIdentityByAccessToken
public static function findIdentityByAccessToken($token, $type = null) { foreach (self::$users as $user) { if ($user['accessToken'] === $token) { return new static($user); } } return null; }
php
public static function findIdentityByAccessToken($token, $type = null) { foreach (self::$users as $user) { if ($user['accessToken'] === $token) { return new static($user); } } return null; }
[ "public", "static", "function", "findIdentityByAccessToken", "(", "$", "token", ",", "$", "type", "=", "null", ")", "{", "foreach", "(", "self", "::", "$", "users", "as", "$", "user", ")", "{", "if", "(", "$", "user", "[", "'accessToken'", "]", "===", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-app-basic/blob/088c23462dcec61af9fa0ae03a9ce05428d7ac78/models/User.php#L42-L51
yiisoft/yii2-app-basic
models/User.php
User.findByUsername
public static function findByUsername($username) { foreach (self::$users as $user) { if (strcasecmp($user['username'], $username) === 0) { return new static($user); } } return null; }
php
public static function findByUsername($username) { foreach (self::$users as $user) { if (strcasecmp($user['username'], $username) === 0) { return new static($user); } } return null; }
[ "public", "static", "function", "findByUsername", "(", "$", "username", ")", "{", "foreach", "(", "self", "::", "$", "users", "as", "$", "user", ")", "{", "if", "(", "strcasecmp", "(", "$", "user", "[", "'username'", "]", ",", "$", "username", ")", "...
Finds user by username @param string $username @return static|null
[ "Finds", "user", "by", "username" ]
train
https://github.com/yiisoft/yii2-app-basic/blob/088c23462dcec61af9fa0ae03a9ce05428d7ac78/models/User.php#L59-L68
yiisoft/yii2-app-basic
models/ContactForm.php
ContactForm.contact
public function contact($email) { if ($this->validate()) { Yii::$app->mailer->compose() ->setTo($email) ->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']]) ->setReplyTo([$this->email => $this->name]) ->s...
php
public function contact($email) { if ($this->validate()) { Yii::$app->mailer->compose() ->setTo($email) ->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']]) ->setReplyTo([$this->email => $this->name]) ->s...
[ "public", "function", "contact", "(", "$", "email", ")", "{", "if", "(", "$", "this", "->", "validate", "(", ")", ")", "{", "Yii", "::", "$", "app", "->", "mailer", "->", "compose", "(", ")", "->", "setTo", "(", "$", "email", ")", "->", "setFrom"...
Sends an email to the specified email address using the information collected by this model. @param string $email the target email address @return bool whether the model passes validation
[ "Sends", "an", "email", "to", "the", "specified", "email", "address", "using", "the", "information", "collected", "by", "this", "model", "." ]
train
https://github.com/yiisoft/yii2-app-basic/blob/088c23462dcec61af9fa0ae03a9ce05428d7ac78/models/ContactForm.php#L50-L64
cocur/slugify
src/RuleProvider/FileRuleProvider.php
FileRuleProvider.getRules
public function getRules($ruleset) { $fileName = $this->directoryName.DIRECTORY_SEPARATOR.$ruleset.'.json'; return json_decode(file_get_contents($fileName), true); }
php
public function getRules($ruleset) { $fileName = $this->directoryName.DIRECTORY_SEPARATOR.$ruleset.'.json'; return json_decode(file_get_contents($fileName), true); }
[ "public", "function", "getRules", "(", "$", "ruleset", ")", "{", "$", "fileName", "=", "$", "this", "->", "directoryName", ".", "DIRECTORY_SEPARATOR", ".", "$", "ruleset", ".", "'.json'", ";", "return", "json_decode", "(", "file_get_contents", "(", "$", "fil...
@param $ruleset @return array
[ "@param", "$ruleset" ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/RuleProvider/FileRuleProvider.php#L41-L46
cocur/slugify
src/Bridge/Symfony/CocurSlugifyExtension.php
CocurSlugifyExtension.load
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); if (empty($config['rulesets'])) { unset($config['rulesets']); } // Extract slugify argument...
php
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); if (empty($config['rulesets'])) { unset($config['rulesets']); } // Extract slugify argument...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "config", "=", "$", "this", "->", "processConfiguration", "(", "$", "con...
{@inheritDoc} @param mixed[] $configs @param ContainerBuilder $container
[ "{", "@inheritDoc", "}" ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/Bridge/Symfony/CocurSlugifyExtension.php#L37-L66
cocur/slugify
src/Bridge/Silex2/SlugifyServiceProvider.php
SlugifyServiceProvider.register
public function register(Container $container) { $container['slugify.options'] = []; $container['slugify.provider'] = null; $container['slugify'] = function ($container) { return new Slugify($container['slugify.options'], $container['slugify.provider']); }; if ...
php
public function register(Container $container) { $container['slugify.options'] = []; $container['slugify.provider'] = null; $container['slugify'] = function ($container) { return new Slugify($container['slugify.options'], $container['slugify.provider']); }; if ...
[ "public", "function", "register", "(", "Container", "$", "container", ")", "{", "$", "container", "[", "'slugify.options'", "]", "=", "[", "]", ";", "$", "container", "[", "'slugify.provider'", "]", "=", "null", ";", "$", "container", "[", "'slugify'", "]"...
{@inheritDoc}
[ "{" ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/Bridge/Silex2/SlugifyServiceProvider.php#L31-L47
cocur/slugify
src/Bridge/Silex/SlugifyServiceProvider.php
SlugifyServiceProvider.register
public function register(Application $app) { $app['slugify.options'] = []; $app['slugify.provider'] = null; $app['slugify'] = $app->share(function ($app) { return new Slugify($app['slugify.options'], $app['slugify.provider']); }); if (isset($app['twig'])) { ...
php
public function register(Application $app) { $app['slugify.options'] = []; $app['slugify.provider'] = null; $app['slugify'] = $app->share(function ($app) { return new Slugify($app['slugify.options'], $app['slugify.provider']); }); if (isset($app['twig'])) { ...
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "$", "app", "[", "'slugify.options'", "]", "=", "[", "]", ";", "$", "app", "[", "'slugify.provider'", "]", "=", "null", ";", "$", "app", "[", "'slugify'", "]", "=", "$", "app...
{@inheritDoc}
[ "{" ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/Bridge/Silex/SlugifyServiceProvider.php#L33-L49
cocur/slugify
src/Slugify.php
Slugify.slugify
public function slugify($string, $options = null) { // BC: the second argument used to be the separator if (is_string($options)) { $separator = $options; $options = []; $options['separator'] = $separator; } $options = array...
php
public function slugify($string, $options = null) { // BC: the second argument used to be the separator if (is_string($options)) { $separator = $options; $options = []; $options['separator'] = $separator; } $options = array...
[ "public", "function", "slugify", "(", "$", "string", ",", "$", "options", "=", "null", ")", "{", "// BC: the second argument used to be the separator", "if", "(", "is_string", "(", "$", "options", ")", ")", "{", "$", "separator", "=", "$", "options", ";", "$...
Returns the slug-version of the string. @param string $string String to slugify @param string|array|null $options Options @return string Slugified version of the string
[ "Returns", "the", "slug", "-", "version", "of", "the", "string", "." ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/Slugify.php#L99-L137
cocur/slugify
src/Slugify.php
Slugify.addRules
public function addRules(array $rules) { foreach ($rules as $character => $replacement) { $this->addRule($character, $replacement); } return $this; }
php
public function addRules(array $rules) { foreach ($rules as $character => $replacement) { $this->addRule($character, $replacement); } return $this; }
[ "public", "function", "addRules", "(", "array", "$", "rules", ")", "{", "foreach", "(", "$", "rules", "as", "$", "character", "=>", "$", "replacement", ")", "{", "$", "this", "->", "addRule", "(", "$", "character", ",", "$", "replacement", ")", ";", ...
Adds multiple rules to Slugify. @param array <string,string> $rules @return Slugify
[ "Adds", "multiple", "rules", "to", "Slugify", "." ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/Slugify.php#L161-L168
cocur/slugify
src/Bridge/Symfony/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('cocur_slugify'); // Keep compatibility with symfony/config < 4.2 if (\method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { $rootNode = $treeBui...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('cocur_slugify'); // Keep compatibility with symfony/config < 4.2 if (\method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { $rootNode = $treeBui...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'cocur_slugify'", ")", ";", "// Keep compatibility with symfony/config < 4.2", "if", "(", "\\", "method_exists", "(", "$", "treeBuilder", ",", "'getRootNo...
{@inheritdoc}
[ "{" ]
train
https://github.com/cocur/slugify/blob/d41701efe58ba2df9cae029c3d21e1518cc6780e/src/Bridge/Symfony/Configuration.php#L22-L46
laravel/scout
src/Searchable.php
Searchable.registerSearchableMacros
public function registerSearchableMacros() { $self = $this; BaseCollection::macro('searchable', function () use ($self) { $self->queueMakeSearchable($this); }); BaseCollection::macro('unsearchable', function () use ($self) { $self->queueRemoveFromSearch($thi...
php
public function registerSearchableMacros() { $self = $this; BaseCollection::macro('searchable', function () use ($self) { $self->queueMakeSearchable($this); }); BaseCollection::macro('unsearchable', function () use ($self) { $self->queueRemoveFromSearch($thi...
[ "public", "function", "registerSearchableMacros", "(", ")", "{", "$", "self", "=", "$", "this", ";", "BaseCollection", "::", "macro", "(", "'searchable'", ",", "function", "(", ")", "use", "(", "$", "self", ")", "{", "$", "self", "->", "queueMakeSearchable...
Register the searchable macros. @return void
[ "Register", "the", "searchable", "macros", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Searchable.php#L37-L48
laravel/scout
src/Searchable.php
Searchable.queueMakeSearchable
public function queueMakeSearchable($models) { if ($models->isEmpty()) { return; } if (! config('scout.queue')) { return $models->first()->searchableUsing()->update($models); } dispatch((new MakeSearchable($models)) ->onQueue($models-...
php
public function queueMakeSearchable($models) { if ($models->isEmpty()) { return; } if (! config('scout.queue')) { return $models->first()->searchableUsing()->update($models); } dispatch((new MakeSearchable($models)) ->onQueue($models-...
[ "public", "function", "queueMakeSearchable", "(", "$", "models", ")", "{", "if", "(", "$", "models", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "config", "(", "'scout.queue'", ")", ")", "{", "return", "$", "models", "->"...
Dispatch the job to make the given models searchable. @param \Illuminate\Database\Eloquent\Collection $models @return void
[ "Dispatch", "the", "job", "to", "make", "the", "given", "models", "searchable", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Searchable.php#L56-L69
laravel/scout
src/Searchable.php
Searchable.search
public static function search($query = '', $callback = null) { return app(Builder::class, [ 'model' => new static, 'query' => $query, 'callback' => $callback, 'softDelete'=> static::usesSoftDelete() && config('scout.soft_delete', false), ]); }
php
public static function search($query = '', $callback = null) { return app(Builder::class, [ 'model' => new static, 'query' => $query, 'callback' => $callback, 'softDelete'=> static::usesSoftDelete() && config('scout.soft_delete', false), ]); }
[ "public", "static", "function", "search", "(", "$", "query", "=", "''", ",", "$", "callback", "=", "null", ")", "{", "return", "app", "(", "Builder", "::", "class", ",", "[", "'model'", "=>", "new", "static", ",", "'query'", "=>", "$", "query", ",", ...
Perform a search against the model's indexed data. @param string $query @param \Closure $callback @return \Laravel\Scout\Builder
[ "Perform", "a", "search", "against", "the", "model", "s", "indexed", "data", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Searchable.php#L103-L111
laravel/scout
src/Searchable.php
Searchable.makeAllSearchable
public static function makeAllSearchable() { $self = new static; $softDelete = static::usesSoftDelete() && config('scout.soft_delete', false); $self->newQuery() ->when($softDelete, function ($query) { $query->withTrashed(); }) ->orderBy($...
php
public static function makeAllSearchable() { $self = new static; $softDelete = static::usesSoftDelete() && config('scout.soft_delete', false); $self->newQuery() ->when($softDelete, function ($query) { $query->withTrashed(); }) ->orderBy($...
[ "public", "static", "function", "makeAllSearchable", "(", ")", "{", "$", "self", "=", "new", "static", ";", "$", "softDelete", "=", "static", "::", "usesSoftDelete", "(", ")", "&&", "config", "(", "'scout.soft_delete'", ",", "false", ")", ";", "$", "self",...
Make all instances of the model searchable. @return void
[ "Make", "all", "instances", "of", "the", "model", "searchable", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Searchable.php#L118-L130
laravel/scout
src/Searchable.php
Searchable.getScoutModelsByIds
public function getScoutModelsByIds(Builder $builder, array $ids) { $query = static::usesSoftDelete() ? $this->withTrashed() : $this->newQuery(); if ($builder->queryCallback) { call_user_func($builder->queryCallback, $query); } return $query->whereIn( ...
php
public function getScoutModelsByIds(Builder $builder, array $ids) { $query = static::usesSoftDelete() ? $this->withTrashed() : $this->newQuery(); if ($builder->queryCallback) { call_user_func($builder->queryCallback, $query); } return $query->whereIn( ...
[ "public", "function", "getScoutModelsByIds", "(", "Builder", "$", "builder", ",", "array", "$", "ids", ")", "{", "$", "query", "=", "static", "::", "usesSoftDelete", "(", ")", "?", "$", "this", "->", "withTrashed", "(", ")", ":", "$", "this", "->", "ne...
Get the requested models from an array of object IDs. @param \Laravel\Scout\Builder $builder @param array $ids @return mixed
[ "Get", "the", "requested", "models", "from", "an", "array", "of", "object", "IDs", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Searchable.php#L171-L183
laravel/scout
src/Console/ImportCommand.php
ImportCommand.handle
public function handle(Dispatcher $events) { $class = $this->argument('model'); $model = new $class; $events->listen(ModelsImported::class, function ($event) use ($class) { $key = $event->models->last()->getScoutKey(); $this->line('<comment>Imported ['.$class.'] mo...
php
public function handle(Dispatcher $events) { $class = $this->argument('model'); $model = new $class; $events->listen(ModelsImported::class, function ($event) use ($class) { $key = $event->models->last()->getScoutKey(); $this->line('<comment>Imported ['.$class.'] mo...
[ "public", "function", "handle", "(", "Dispatcher", "$", "events", ")", "{", "$", "class", "=", "$", "this", "->", "argument", "(", "'model'", ")", ";", "$", "model", "=", "new", "$", "class", ";", "$", "events", "->", "listen", "(", "ModelsImported", ...
Execute the console command. @param \Illuminate\Contracts\Events\Dispatcher $events @return void
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Console/ImportCommand.php#L31-L48
laravel/scout
src/SearchableScope.php
SearchableScope.extend
public function extend(EloquentBuilder $builder) { $builder->macro('searchable', function (EloquentBuilder $builder, $chunk = null) { $builder->chunk($chunk ?: config('scout.chunk.searchable', 500), function ($models) { $models->filter->shouldBeSearchable()->searchable(); ...
php
public function extend(EloquentBuilder $builder) { $builder->macro('searchable', function (EloquentBuilder $builder, $chunk = null) { $builder->chunk($chunk ?: config('scout.chunk.searchable', 500), function ($models) { $models->filter->shouldBeSearchable()->searchable(); ...
[ "public", "function", "extend", "(", "EloquentBuilder", "$", "builder", ")", "{", "$", "builder", "->", "macro", "(", "'searchable'", ",", "function", "(", "EloquentBuilder", "$", "builder", ",", "$", "chunk", "=", "null", ")", "{", "$", "builder", "->", ...
Extend the query builder with the needed functions. @param \Illuminate\Database\Eloquent\Builder $builder @return void
[ "Extend", "the", "query", "builder", "with", "the", "needed", "functions", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/SearchableScope.php#L31-L48
laravel/scout
src/ModelObserver.php
ModelObserver.saved
public function saved($model) { if (static::syncingDisabledFor($model)) { return; } if (! $model->shouldBeSearchable()) { $model->unsearchable(); return; } $model->searchable(); }
php
public function saved($model) { if (static::syncingDisabledFor($model)) { return; } if (! $model->shouldBeSearchable()) { $model->unsearchable(); return; } $model->searchable(); }
[ "public", "function", "saved", "(", "$", "model", ")", "{", "if", "(", "static", "::", "syncingDisabledFor", "(", "$", "model", ")", ")", "{", "return", ";", "}", "if", "(", "!", "$", "model", "->", "shouldBeSearchable", "(", ")", ")", "{", "$", "m...
Handle the saved event for the model. @param \Illuminate\Database\Eloquent\Model $model @return void
[ "Handle", "the", "saved", "event", "for", "the", "model", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/ModelObserver.php#L57-L70
laravel/scout
src/ModelObserver.php
ModelObserver.deleted
public function deleted($model) { if (static::syncingDisabledFor($model)) { return; } if ($this->usesSoftDelete($model) && config('scout.soft_delete', false)) { $this->saved($model); } else { $model->unsearchable(); } }
php
public function deleted($model) { if (static::syncingDisabledFor($model)) { return; } if ($this->usesSoftDelete($model) && config('scout.soft_delete', false)) { $this->saved($model); } else { $model->unsearchable(); } }
[ "public", "function", "deleted", "(", "$", "model", ")", "{", "if", "(", "static", "::", "syncingDisabledFor", "(", "$", "model", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "usesSoftDelete", "(", "$", "model", ")", "&&", "config...
Handle the deleted event for the model. @param \Illuminate\Database\Eloquent\Model $model @return void
[ "Handle", "the", "deleted", "event", "for", "the", "model", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/ModelObserver.php#L78-L89
laravel/scout
src/ScoutServiceProvider.php
ScoutServiceProvider.register
public function register() { $this->app->singleton(EngineManager::class, function ($app) { return new EngineManager($app); }); if ($this->app->runningInConsole()) { $this->commands([ ImportCommand::class, FlushCommand::class, ...
php
public function register() { $this->app->singleton(EngineManager::class, function ($app) { return new EngineManager($app); }); if ($this->app->runningInConsole()) { $this->commands([ ImportCommand::class, FlushCommand::class, ...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "EngineManager", "::", "class", ",", "function", "(", "$", "app", ")", "{", "return", "new", "EngineManager", "(", "$", "app", ")", ";", "}", ")", ";",...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/ScoutServiceProvider.php#L16-L32
laravel/scout
src/EngineManager.php
EngineManager.createAlgoliaDriver
public function createAlgoliaDriver() { $this->ensureAlgoliaClientIsInstalled(); UserAgent::addCustomUserAgent('Laravel Scout', '7.0.0'); return new AlgoliaEngine( Algolia::create(config('scout.algolia.id'), config('scout.algolia.secret')), config('scout.soft_delete...
php
public function createAlgoliaDriver() { $this->ensureAlgoliaClientIsInstalled(); UserAgent::addCustomUserAgent('Laravel Scout', '7.0.0'); return new AlgoliaEngine( Algolia::create(config('scout.algolia.id'), config('scout.algolia.secret')), config('scout.soft_delete...
[ "public", "function", "createAlgoliaDriver", "(", ")", "{", "$", "this", "->", "ensureAlgoliaClientIsInstalled", "(", ")", ";", "UserAgent", "::", "addCustomUserAgent", "(", "'Laravel Scout'", ",", "'7.0.0'", ")", ";", "return", "new", "AlgoliaEngine", "(", "Algol...
Create an Algolia engine instance. @return \Laravel\Scout\Engines\AlgoliaEngine
[ "Create", "an", "Algolia", "engine", "instance", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/EngineManager.php#L30-L40
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.update
public function update($models) { if ($models->isEmpty()) { return; } $index = $this->algolia->initIndex($models->first()->searchableAs()); if ($this->usesSoftDelete($models->first()) && $this->softDelete) { $models->each->pushSoftDeleteMetadata(); }...
php
public function update($models) { if ($models->isEmpty()) { return; } $index = $this->algolia->initIndex($models->first()->searchableAs()); if ($this->usesSoftDelete($models->first()) && $this->softDelete) { $models->each->pushSoftDeleteMetadata(); }...
[ "public", "function", "update", "(", "$", "models", ")", "{", "if", "(", "$", "models", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "$", "index", "=", "$", "this", "->", "algolia", "->", "initIndex", "(", "$", "models", "->", "first", ...
Update the given model in the index. @param \Illuminate\Database\Eloquent\Collection $models @throws \Algolia\AlgoliaSearch\Exceptions\AlgoliaException @return void
[ "Update", "the", "given", "model", "in", "the", "index", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L45-L72
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.delete
public function delete($models) { $index = $this->algolia->initIndex($models->first()->searchableAs()); $index->deleteObjects( $models->map(function ($model) { return $model->getScoutKey(); })->values()->all() ); }
php
public function delete($models) { $index = $this->algolia->initIndex($models->first()->searchableAs()); $index->deleteObjects( $models->map(function ($model) { return $model->getScoutKey(); })->values()->all() ); }
[ "public", "function", "delete", "(", "$", "models", ")", "{", "$", "index", "=", "$", "this", "->", "algolia", "->", "initIndex", "(", "$", "models", "->", "first", "(", ")", "->", "searchableAs", "(", ")", ")", ";", "$", "index", "->", "deleteObject...
Remove the given model from the index. @param \Illuminate\Database\Eloquent\Collection $models @return void
[ "Remove", "the", "given", "model", "from", "the", "index", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L80-L89
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.search
public function search(Builder $builder) { return $this->performSearch($builder, array_filter([ 'numericFilters' => $this->filters($builder), 'hitsPerPage' => $builder->limit, ])); }
php
public function search(Builder $builder) { return $this->performSearch($builder, array_filter([ 'numericFilters' => $this->filters($builder), 'hitsPerPage' => $builder->limit, ])); }
[ "public", "function", "search", "(", "Builder", "$", "builder", ")", "{", "return", "$", "this", "->", "performSearch", "(", "$", "builder", ",", "array_filter", "(", "[", "'numericFilters'", "=>", "$", "this", "->", "filters", "(", "$", "builder", ")", ...
Perform the given search on the engine. @param \Laravel\Scout\Builder $builder @return mixed
[ "Perform", "the", "given", "search", "on", "the", "engine", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L97-L103
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.paginate
public function paginate(Builder $builder, $perPage, $page) { return $this->performSearch($builder, [ 'numericFilters' => $this->filters($builder), 'hitsPerPage' => $perPage, 'page' => $page - 1, ]); }
php
public function paginate(Builder $builder, $perPage, $page) { return $this->performSearch($builder, [ 'numericFilters' => $this->filters($builder), 'hitsPerPage' => $perPage, 'page' => $page - 1, ]); }
[ "public", "function", "paginate", "(", "Builder", "$", "builder", ",", "$", "perPage", ",", "$", "page", ")", "{", "return", "$", "this", "->", "performSearch", "(", "$", "builder", ",", "[", "'numericFilters'", "=>", "$", "this", "->", "filters", "(", ...
Perform the given search on the engine. @param \Laravel\Scout\Builder $builder @param int $perPage @param int $page @return mixed
[ "Perform", "the", "given", "search", "on", "the", "engine", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L113-L120
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.performSearch
protected function performSearch(Builder $builder, array $options = []) { $algolia = $this->algolia->initIndex( $builder->index ?: $builder->model->searchableAs() ); if ($builder->callback) { return call_user_func( $builder->callback, ...
php
protected function performSearch(Builder $builder, array $options = []) { $algolia = $this->algolia->initIndex( $builder->index ?: $builder->model->searchableAs() ); if ($builder->callback) { return call_user_func( $builder->callback, ...
[ "protected", "function", "performSearch", "(", "Builder", "$", "builder", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "algolia", "=", "$", "this", "->", "algolia", "->", "initIndex", "(", "$", "builder", "->", "index", "?", ":", "$", ...
Perform the given search on the engine. @param \Laravel\Scout\Builder $builder @param array $options @return mixed
[ "Perform", "the", "given", "search", "on", "the", "engine", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L129-L145
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.map
public function map(Builder $builder, $results, $model) { if (count($results['hits']) === 0) { return $model->newCollection(); } $objectIds = collect($results['hits'])->pluck('objectID')->values()->all(); $objectIdPositions = array_flip($objectIds); return $mode...
php
public function map(Builder $builder, $results, $model) { if (count($results['hits']) === 0) { return $model->newCollection(); } $objectIds = collect($results['hits'])->pluck('objectID')->values()->all(); $objectIdPositions = array_flip($objectIds); return $mode...
[ "public", "function", "map", "(", "Builder", "$", "builder", ",", "$", "results", ",", "$", "model", ")", "{", "if", "(", "count", "(", "$", "results", "[", "'hits'", "]", ")", "===", "0", ")", "{", "return", "$", "model", "->", "newCollection", "(...
Map the given results to instances of the given model. @param \Laravel\Scout\Builder $builder @param mixed $results @param \Illuminate\Database\Eloquent\Model $model @return \Illuminate\Database\Eloquent\Collection
[ "Map", "the", "given", "results", "to", "instances", "of", "the", "given", "model", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L179-L195
laravel/scout
src/Engines/AlgoliaEngine.php
AlgoliaEngine.flush
public function flush($model) { $index = $this->algolia->initIndex($model->searchableAs()); $index->clearObjects(); }
php
public function flush($model) { $index = $this->algolia->initIndex($model->searchableAs()); $index->clearObjects(); }
[ "public", "function", "flush", "(", "$", "model", ")", "{", "$", "index", "=", "$", "this", "->", "algolia", "->", "initIndex", "(", "$", "model", "->", "searchableAs", "(", ")", ")", ";", "$", "index", "->", "clearObjects", "(", ")", ";", "}" ]
Flush all of the model's records from the engine. @param \Illuminate\Database\Eloquent\Model $model @return void
[ "Flush", "all", "of", "the", "model", "s", "records", "from", "the", "engine", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/AlgoliaEngine.php#L214-L219
laravel/scout
src/Jobs/MakeSearchable.php
MakeSearchable.handle
public function handle() { if (count($this->models) === 0) { return; } $this->models->first()->searchableUsing()->update($this->models); }
php
public function handle() { if (count($this->models) === 0) { return; } $this->models->first()->searchableUsing()->update($this->models); }
[ "public", "function", "handle", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "models", ")", "===", "0", ")", "{", "return", ";", "}", "$", "this", "->", "models", "->", "first", "(", ")", "->", "searchableUsing", "(", ")", "->", "up...
Handle the job. @return void
[ "Handle", "the", "job", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Jobs/MakeSearchable.php#L36-L43
laravel/scout
src/Builder.php
Builder.paginate
public function paginate($perPage = null, $pageName = 'page', $page = null) { $engine = $this->engine(); $page = $page ?: Paginator::resolveCurrentPage($pageName); $perPage = $perPage ?: $this->model->getPerPage(); $results = $this->model->newCollection($engine->map( $...
php
public function paginate($perPage = null, $pageName = 'page', $page = null) { $engine = $this->engine(); $page = $page ?: Paginator::resolveCurrentPage($pageName); $perPage = $perPage ?: $this->model->getPerPage(); $results = $this->model->newCollection($engine->map( $...
[ "public", "function", "paginate", "(", "$", "perPage", "=", "null", ",", "$", "pageName", "=", "'page'", ",", "$", "page", "=", "null", ")", "{", "$", "engine", "=", "$", "this", "->", "engine", "(", ")", ";", "$", "page", "=", "$", "page", "?", ...
Paginate the given query into a simple paginator. @param int $perPage @param string $pageName @param int|null $page @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
[ "Paginate", "the", "given", "query", "into", "a", "simple", "paginator", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Builder.php#L261-L279
laravel/scout
src/Builder.php
Builder.paginateRaw
public function paginateRaw($perPage = null, $pageName = 'page', $page = null) { $engine = $this->engine(); $page = $page ?: Paginator::resolveCurrentPage($pageName); $perPage = $perPage ?: $this->model->getPerPage(); $results = $engine->paginate($this, $perPage, $page); ...
php
public function paginateRaw($perPage = null, $pageName = 'page', $page = null) { $engine = $this->engine(); $page = $page ?: Paginator::resolveCurrentPage($pageName); $perPage = $perPage ?: $this->model->getPerPage(); $results = $engine->paginate($this, $perPage, $page); ...
[ "public", "function", "paginateRaw", "(", "$", "perPage", "=", "null", ",", "$", "pageName", "=", "'page'", ",", "$", "page", "=", "null", ")", "{", "$", "engine", "=", "$", "this", "->", "engine", "(", ")", ";", "$", "page", "=", "$", "page", "?...
Paginate the given query into a simple paginator with raw data. @param int $perPage @param string $pageName @param int|null $page @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
[ "Paginate", "the", "given", "query", "into", "a", "simple", "paginator", "with", "raw", "data", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Builder.php#L289-L305
laravel/scout
src/Engines/Engine.php
Engine.get
public function get(Builder $builder) { return $this->map( $builder, $this->search($builder), $builder->model ); }
php
public function get(Builder $builder) { return $this->map( $builder, $this->search($builder), $builder->model ); }
[ "public", "function", "get", "(", "Builder", "$", "builder", ")", "{", "return", "$", "this", "->", "map", "(", "$", "builder", ",", "$", "this", "->", "search", "(", "$", "builder", ")", ",", "$", "builder", "->", "model", ")", ";", "}" ]
Get the results of the given query mapped onto models. @param \Laravel\Scout\Builder $builder @return \Illuminate\Database\Eloquent\Collection
[ "Get", "the", "results", "of", "the", "given", "query", "mapped", "onto", "models", "." ]
train
https://github.com/laravel/scout/blob/a643d5d5fd8d1598baa1e4fe4251931b0de58923/src/Engines/Engine.php#L94-L99
spatie/laravel-sitemap
src/Tags/Url.php
Url.addAlternate
public function addAlternate(string $url, string $locale = '') { $this->alternates[] = new Alternate($url, $locale); return $this; }
php
public function addAlternate(string $url, string $locale = '') { $this->alternates[] = new Alternate($url, $locale); return $this; }
[ "public", "function", "addAlternate", "(", "string", "$", "url", ",", "string", "$", "locale", "=", "''", ")", "{", "$", "this", "->", "alternates", "[", "]", "=", "new", "Alternate", "(", "$", "url", ",", "$", "locale", ")", ";", "return", "$", "t...
@param Alternate $alternate @param string $url @param string $locale @return $this
[ "@param", "Alternate", "$alternate" ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/Tags/Url.php#L102-L107
spatie/laravel-sitemap
src/Tags/Url.php
Url.segments
public function segments(int $index = null) { $segments = collect(explode('/', $this->path())) ->filter(function ($value) { return $value !== ''; }) ->values() ->toArray(); if (! is_null($index)) { return $this->segment($in...
php
public function segments(int $index = null) { $segments = collect(explode('/', $this->path())) ->filter(function ($value) { return $value !== ''; }) ->values() ->toArray(); if (! is_null($index)) { return $this->segment($in...
[ "public", "function", "segments", "(", "int", "$", "index", "=", "null", ")", "{", "$", "segments", "=", "collect", "(", "explode", "(", "'/'", ",", "$", "this", "->", "path", "(", ")", ")", ")", "->", "filter", "(", "function", "(", "$", "value", ...
@param int|null $index @return array|null|string
[ "@param", "int|null", "$index" ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/Tags/Url.php#L122-L136
spatie/laravel-sitemap
src/Sitemap.php
Sitemap.add
public function add($tag): self { if (is_string($tag)) { $tag = Url::create($tag); } if (! in_array($tag, $this->tags)) { $this->tags[] = $tag; } return $this; }
php
public function add($tag): self { if (is_string($tag)) { $tag = Url::create($tag); } if (! in_array($tag, $this->tags)) { $this->tags[] = $tag; } return $this; }
[ "public", "function", "add", "(", "$", "tag", ")", ":", "self", "{", "if", "(", "is_string", "(", "$", "tag", ")", ")", "{", "$", "tag", "=", "Url", "::", "create", "(", "$", "tag", ")", ";", "}", "if", "(", "!", "in_array", "(", "$", "tag", ...
@param string|\Spatie\Sitemap\Tags\Tag $tag @return $this
[ "@param", "string|", "\\", "Spatie", "\\", "Sitemap", "\\", "Tags", "\\", "Tag", "$tag" ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/Sitemap.php#L23-L34
spatie/laravel-sitemap
src/Crawler/Observer.php
Observer.crawled
public function crawled( UriInterface $url, ResponseInterface $response, ?UriInterface $foundOnUrl = null ) { ($this->hasCrawled)($url, $response); }
php
public function crawled( UriInterface $url, ResponseInterface $response, ?UriInterface $foundOnUrl = null ) { ($this->hasCrawled)($url, $response); }
[ "public", "function", "crawled", "(", "UriInterface", "$", "url", ",", "ResponseInterface", "$", "response", ",", "?", "UriInterface", "$", "foundOnUrl", "=", "null", ")", "{", "(", "$", "this", "->", "hasCrawled", ")", "(", "$", "url", ",", "$", "respon...
Called when the crawler has crawled the given url successfully. @param \Psr\Http\Message\UriInterface $url @param \Psr\Http\Message\ResponseInterface $response @param \Psr\Http\Message\UriInterface|null $foundOnUrl
[ "Called", "when", "the", "crawler", "has", "crawled", "the", "given", "url", "successfully", "." ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/Crawler/Observer.php#L43-L49
spatie/laravel-sitemap
src/SitemapGenerator.php
SitemapGenerator.writeToFile
public function writeToFile(string $path) { $sitemap = $this->getSitemap(); if ($this->maximumTagsPerSitemap) { $sitemap = SitemapIndex::create(); $format = str_replace('.xml', '_%d.xml', $path); // Parses each sub-sitemaps, writes and pushs them into the sitema...
php
public function writeToFile(string $path) { $sitemap = $this->getSitemap(); if ($this->maximumTagsPerSitemap) { $sitemap = SitemapIndex::create(); $format = str_replace('.xml', '_%d.xml', $path); // Parses each sub-sitemaps, writes and pushs them into the sitema...
[ "public", "function", "writeToFile", "(", "string", "$", "path", ")", "{", "$", "sitemap", "=", "$", "this", "->", "getSitemap", "(", ")", ";", "if", "(", "$", "this", "->", "maximumTagsPerSitemap", ")", "{", "$", "sitemap", "=", "SitemapIndex", "::", ...
@param string $path @return $this
[ "@param", "string", "$path" ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/SitemapGenerator.php#L140-L161
spatie/laravel-sitemap
src/SitemapIndex.php
SitemapIndex.add
public function add($tag) { if (is_string($tag)) { $tag = Sitemap::create($tag); } $this->tags[] = $tag; return $this; }
php
public function add($tag) { if (is_string($tag)) { $tag = Sitemap::create($tag); } $this->tags[] = $tag; return $this; }
[ "public", "function", "add", "(", "$", "tag", ")", "{", "if", "(", "is_string", "(", "$", "tag", ")", ")", "{", "$", "tag", "=", "Sitemap", "::", "create", "(", "$", "tag", ")", ";", "}", "$", "this", "->", "tags", "[", "]", "=", "$", "tag", ...
@param string|\Spatie\Sitemap\Tags\Tag $tag @return $this
[ "@param", "string|", "\\", "Spatie", "\\", "Sitemap", "\\", "Tags", "\\", "Tag", "$tag" ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/SitemapIndex.php#L26-L35
spatie/laravel-sitemap
src/SitemapIndex.php
SitemapIndex.getSitemap
public function getSitemap(string $url) { return collect($this->tags)->first(function (Tag $tag) use ($url) { return $tag->getType() === 'sitemap' && $tag->url === $url; }); }
php
public function getSitemap(string $url) { return collect($this->tags)->first(function (Tag $tag) use ($url) { return $tag->getType() === 'sitemap' && $tag->url === $url; }); }
[ "public", "function", "getSitemap", "(", "string", "$", "url", ")", "{", "return", "collect", "(", "$", "this", "->", "tags", ")", "->", "first", "(", "function", "(", "Tag", "$", "tag", ")", "use", "(", "$", "url", ")", "{", "return", "$", "tag", ...
Get sitemap tag. @param string $url @return \Spatie\Sitemap\Tags\Sitemap|null
[ "Get", "sitemap", "tag", "." ]
train
https://github.com/spatie/laravel-sitemap/blob/1bd689d14e807c3e6b739b89922a3475c3535ece/src/SitemapIndex.php#L44-L49
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ChainProcedureLoader.php
ChainProcedureLoader.load
public function load($id) { /** @var \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface $loader **/ foreach ($this->procedureLoaders as $loader) { try { $procedure = $loader->load($id); return $procedure; } catch (\Exception $e) {} ...
php
public function load($id) { /** @var \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface $loader **/ foreach ($this->procedureLoaders as $loader) { try { $procedure = $loader->load($id); return $procedure; } catch (\Exception $e) {} ...
[ "public", "function", "load", "(", "$", "id", ")", "{", "/** @var \\JonnyW\\PhantomJs\\Procedure\\ProcedureLoaderInterface $loader **/", "foreach", "(", "$", "this", "->", "procedureLoaders", "as", "$", "loader", ")", "{", "try", "{", "$", "procedure", "=", "$", "...
Load procedure instance by id. @access public @param string $id @throws \InvalidArgumentException @return \JonnyW\PhantomJs\Procedure\ProcedureInterface
[ "Load", "procedure", "instance", "by", "id", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ChainProcedureLoader.php#L57-L73
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ChainProcedureLoader.php
ChainProcedureLoader.loadTemplate
public function loadTemplate($id, $extension = 'proc') { /** @var \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface $loader **/ foreach ($this->procedureLoaders as $loader) { try { $template = $loader->loadTemplate($id, $extension); return $template;...
php
public function loadTemplate($id, $extension = 'proc') { /** @var \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface $loader **/ foreach ($this->procedureLoaders as $loader) { try { $template = $loader->loadTemplate($id, $extension); return $template;...
[ "public", "function", "loadTemplate", "(", "$", "id", ",", "$", "extension", "=", "'proc'", ")", "{", "/** @var \\JonnyW\\PhantomJs\\Procedure\\ProcedureLoaderInterface $loader **/", "foreach", "(", "$", "this", "->", "procedureLoaders", "as", "$", "loader", ")", "{",...
Load procedure template by id. @access public @param string $id @param string $extension (default: 'proc') @throws \InvalidArgumentException @return string
[ "Load", "procedure", "template", "by", "id", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ChainProcedureLoader.php#L84-L100
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Engine.php
Engine.getCommand
public function getCommand() { $path = $this->getPath(); $options = $this->getOptions(); $this->validateExecutable($path); if ($this->cache) { array_push($options, '--disk-cache=true'); } if ($this->debug) { array_push($options, '--debug=...
php
public function getCommand() { $path = $this->getPath(); $options = $this->getOptions(); $this->validateExecutable($path); if ($this->cache) { array_push($options, '--disk-cache=true'); } if ($this->debug) { array_push($options, '--debug=...
[ "public", "function", "getCommand", "(", ")", "{", "$", "path", "=", "$", "this", "->", "getPath", "(", ")", ";", "$", "options", "=", "$", "this", "->", "getOptions", "(", ")", ";", "$", "this", "->", "validateExecutable", "(", "$", "path", ")", "...
Get PhantomJs run command with loader run options. @access public @return string
[ "Get", "PhantomJs", "run", "command", "with", "loader", "run", "options", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Engine.php#L82-L98
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Engine.php
Engine.validateExecutable
private function validateExecutable($file) { if (!file_exists($file) || !is_executable($file)) { throw new InvalidExecutableException(sprintf('File does not exist or is not executable: %s', $file)); } return true; }
php
private function validateExecutable($file) { if (!file_exists($file) || !is_executable($file)) { throw new InvalidExecutableException(sprintf('File does not exist or is not executable: %s', $file)); } return true; }
[ "private", "function", "validateExecutable", "(", "$", "file", ")", "{", "if", "(", "!", "file_exists", "(", "$", "file", ")", "||", "!", "is_executable", "(", "$", "file", ")", ")", "{", "throw", "new", "InvalidExecutableException", "(", "sprintf", "(", ...
Validate execuable file. @access private @param string $file @return boolean @throws \JonnyW\PhantomJs\Exception\InvalidExecutableException
[ "Validate", "execuable", "file", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Engine.php#L242-L249
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.setMethod
public function setMethod($method) { $method = strtoupper($method); $reflection = new \ReflectionClass('\JonnyW\PhantomJs\Http\RequestInterface'); if (!$reflection->hasConstant('METHOD_' . $method)) { throw new InvalidMethodException(sprintf('Invalid method provided: %s', $m...
php
public function setMethod($method) { $method = strtoupper($method); $reflection = new \ReflectionClass('\JonnyW\PhantomJs\Http\RequestInterface'); if (!$reflection->hasConstant('METHOD_' . $method)) { throw new InvalidMethodException(sprintf('Invalid method provided: %s', $m...
[ "public", "function", "setMethod", "(", "$", "method", ")", "{", "$", "method", "=", "strtoupper", "(", "$", "method", ")", ";", "$", "reflection", "=", "new", "\\", "ReflectionClass", "(", "'\\JonnyW\\PhantomJs\\Http\\RequestInterface'", ")", ";", "if", "(", ...
Set request method @access public @param string $method @return \JonnyW\PhantomJs\Http\AbstractRequest @throws \JonnyW\PhantomJs\Exception\InvalidMethodException
[ "Set", "request", "method" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L150-L162
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.setViewportSize
public function setViewportSize($width, $height) { $this->viewportWidth = (int) $width; $this->viewportHeight = (int) $height; return $this; }
php
public function setViewportSize($width, $height) { $this->viewportWidth = (int) $width; $this->viewportHeight = (int) $height; return $this; }
[ "public", "function", "setViewportSize", "(", "$", "width", ",", "$", "height", ")", "{", "$", "this", "->", "viewportWidth", "=", "(", "int", ")", "$", "width", ";", "$", "this", "->", "viewportHeight", "=", "(", "int", ")", "$", "height", ";", "ret...
Set viewport size. @access public @param int $width @param int $height @return void
[ "Set", "viewport", "size", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L237-L243
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.getUrl
public function getUrl() { if (!in_array($this->getMethod(), array(RequestInterface::METHOD_GET, RequestInterface::METHOD_HEAD))) { return $this->url; } $url = $this->url; if (count($this->data)) { $url .= false === strpos($url, '?') ? '?' : '&'; ...
php
public function getUrl() { if (!in_array($this->getMethod(), array(RequestInterface::METHOD_GET, RequestInterface::METHOD_HEAD))) { return $this->url; } $url = $this->url; if (count($this->data)) { $url .= false === strpos($url, '?') ? '?' : '&'; ...
[ "public", "function", "getUrl", "(", ")", "{", "if", "(", "!", "in_array", "(", "$", "this", "->", "getMethod", "(", ")", ",", "array", "(", "RequestInterface", "::", "METHOD_GET", ",", "RequestInterface", "::", "METHOD_HEAD", ")", ")", ")", "{", "return...
Get request URL - Assembles query string for GET and HEAD requests @access public @return string
[ "Get", "request", "URL", "-", "Assembles", "query", "string", "for", "GET", "and", "HEAD", "requests" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L289-L304
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.getBody
public function getBody() { if (in_array($this->getMethod(), array(RequestInterface::METHOD_GET, RequestInterface::METHOD_HEAD))) { return ''; } return http_build_query($this->getRequestData()); }
php
public function getBody() { if (in_array($this->getMethod(), array(RequestInterface::METHOD_GET, RequestInterface::METHOD_HEAD))) { return ''; } return http_build_query($this->getRequestData()); }
[ "public", "function", "getBody", "(", ")", "{", "if", "(", "in_array", "(", "$", "this", "->", "getMethod", "(", ")", ",", "array", "(", "RequestInterface", "::", "METHOD_GET", ",", "RequestInterface", "::", "METHOD_HEAD", ")", ")", ")", "{", "return", "...
Get content body - Returns query string if not GET or HEAD @access public @return string
[ "Get", "content", "body", "-", "Returns", "query", "string", "if", "not", "GET", "or", "HEAD" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L313-L320
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.getRequestData
public function getRequestData($flat = true) { if ($flat) { return $this->flattenData($this->data); } return $this->data; }
php
public function getRequestData($flat = true) { if ($flat) { return $this->flattenData($this->data); } return $this->data; }
[ "public", "function", "getRequestData", "(", "$", "flat", "=", "true", ")", "{", "if", "(", "$", "flat", ")", "{", "return", "$", "this", "->", "flattenData", "(", "$", "this", "->", "data", ")", ";", "}", "return", "$", "this", "->", "data", ";", ...
Get request data @access public @param boolean $flat @return array
[ "Get", "request", "data" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L343-L350
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.addCookie
public function addCookie($name, $value, $path, $domain, $httpOnly = true, $secure = false, $expires = null) { $filter = function ($value) { return !is_null($value); }; $this->cookies['add'][] = array_filter(array( 'name' => $name, 'value' => $valu...
php
public function addCookie($name, $value, $path, $domain, $httpOnly = true, $secure = false, $expires = null) { $filter = function ($value) { return !is_null($value); }; $this->cookies['add'][] = array_filter(array( 'name' => $name, 'value' => $valu...
[ "public", "function", "addCookie", "(", "$", "name", ",", "$", "value", ",", "$", "path", ",", "$", "domain", ",", "$", "httpOnly", "=", "true", ",", "$", "secure", "=", "false", ",", "$", "expires", "=", "null", ")", "{", "$", "filter", "=", "fu...
Add cookie. @access public @param string $name @param mixed $value @param string $path @param string $domain @param bool $httpOnly (default: true) @par...
[ "Add", "cookie", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L448-L465
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/AbstractRequest.php
AbstractRequest.flattenData
protected function flattenData(array $data, $prefix = '', $format = '%s') { $flat = array(); foreach ($data as $name => $value) { $ref = $prefix . sprintf($format, $name); if (is_array($value)) { $flat += $this->flattenData($value, $ref, '[%s]'); ...
php
protected function flattenData(array $data, $prefix = '', $format = '%s') { $flat = array(); foreach ($data as $name => $value) { $ref = $prefix . sprintf($format, $name); if (is_array($value)) { $flat += $this->flattenData($value, $ref, '[%s]'); ...
[ "protected", "function", "flattenData", "(", "array", "$", "data", ",", "$", "prefix", "=", "''", ",", "$", "format", "=", "'%s'", ")", "{", "$", "flat", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "name", "=>", "$", "val...
Flatten data into single dimensional array @access protected @param array $data @param string $prefix @param string $format @return array
[ "Flatten", "data", "into", "single", "dimensional", "array" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/AbstractRequest.php#L532-L550
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureLoaderFactory.php
ProcedureLoaderFactory.createProcedureLoader
public function createProcedureLoader($directory) { $procedureFactory = $this->procedureFactory; $fileLocator = $this->createFileLocator($directory); $procedureLoader = new ProcedureLoader( $procedureFactory, $fileLocator ); return $procedureLoa...
php
public function createProcedureLoader($directory) { $procedureFactory = $this->procedureFactory; $fileLocator = $this->createFileLocator($directory); $procedureLoader = new ProcedureLoader( $procedureFactory, $fileLocator ); return $procedureLoa...
[ "public", "function", "createProcedureLoader", "(", "$", "directory", ")", "{", "$", "procedureFactory", "=", "$", "this", "->", "procedureFactory", ";", "$", "fileLocator", "=", "$", "this", "->", "createFileLocator", "(", "$", "directory", ")", ";", "$", "...
Create procedure loader instance. @access public @param string $directory @return \JonnyW\PhantomJs\Procedure\ProcedureLoader
[ "Create", "procedure", "loader", "instance", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureLoaderFactory.php#L47-L58
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureLoaderFactory.php
ProcedureLoaderFactory.createFileLocator
protected function createFileLocator($directory) { if (!is_dir($directory) || !is_readable($directory)) { throw new \InvalidArgumentException(sprintf('Could not create procedure loader as directory does not exist or is not readable: "%s"', $directory)); } return new FileLocator(...
php
protected function createFileLocator($directory) { if (!is_dir($directory) || !is_readable($directory)) { throw new \InvalidArgumentException(sprintf('Could not create procedure loader as directory does not exist or is not readable: "%s"', $directory)); } return new FileLocator(...
[ "protected", "function", "createFileLocator", "(", "$", "directory", ")", "{", "if", "(", "!", "is_dir", "(", "$", "directory", ")", "||", "!", "is_readable", "(", "$", "directory", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "spr...
Create file locator instance. @access protected @param string $directory @return \Symfony\Component\Config\FileLocator @throws \InvalidArgumentException
[ "Create", "file", "locator", "instance", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureLoaderFactory.php#L68-L75
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureCompiler.php
ProcedureCompiler.compile
public function compile(ProcedureInterface $procedure, InputInterface $input) { $cacheKey = sprintf('phantomjs_%s_%s', $input->getType(), md5($procedure->getTemplate())); if ($this->cacheEnabled && $this->cacheHandler->exists($cacheKey)) { $template = $this->cacheHandler->fetch($cacheKe...
php
public function compile(ProcedureInterface $procedure, InputInterface $input) { $cacheKey = sprintf('phantomjs_%s_%s', $input->getType(), md5($procedure->getTemplate())); if ($this->cacheEnabled && $this->cacheHandler->exists($cacheKey)) { $template = $this->cacheHandler->fetch($cacheKe...
[ "public", "function", "compile", "(", "ProcedureInterface", "$", "procedure", ",", "InputInterface", "$", "input", ")", "{", "$", "cacheKey", "=", "sprintf", "(", "'phantomjs_%s_%s'", ",", "$", "input", "->", "getType", "(", ")", ",", "md5", "(", "$", "pro...
Compile partials into procedure. @access public @param \JonnyW\PhantomJs\Procedure\ProcedureInterface $procedure @param \JonnyW\PhantomJs\Procedure\InputInterface $input @return void
[ "Compile", "partials", "into", "procedure", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureCompiler.php#L89-L115
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Validator/Esprima.php
Esprima.load
public function load() { if (!$this->esprima) { $this->esprima = $this->loadFile( $this->locator->locate($this->file) ); } return $this->esprima; }
php
public function load() { if (!$this->esprima) { $this->esprima = $this->loadFile( $this->locator->locate($this->file) ); } return $this->esprima; }
[ "public", "function", "load", "(", ")", "{", "if", "(", "!", "$", "this", "->", "esprima", ")", "{", "$", "this", "->", "esprima", "=", "$", "this", "->", "loadFile", "(", "$", "this", "->", "locator", "->", "locate", "(", "$", "this", "->", "fil...
Load esprima script. @access public @return string
[ "Load", "esprima", "script", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Validator/Esprima.php#L88-L98
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/Response.php
Response.import
public function import(array $data) { foreach ($data as $param => $value) { if ($param === 'headers') { continue; } if (property_exists($this, $param)) { $this->$param = $value; } } $this->headers = array(); ...
php
public function import(array $data) { foreach ($data as $param => $value) { if ($param === 'headers') { continue; } if (property_exists($this, $param)) { $this->$param = $value; } } $this->headers = array(); ...
[ "public", "function", "import", "(", "array", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "param", "=>", "$", "value", ")", "{", "if", "(", "$", "param", "===", "'headers'", ")", "{", "continue", ";", "}", "if", "(", "property_ex...
Import response data @access public @param array $data @return \JonnyW\PhantomJs\Http\Response
[ "Import", "response", "data" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/Response.php#L100-L120
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/Response.php
Response.setHeaders
protected function setHeaders(array $headers) { foreach ($headers as $header) { if (isset($header['name']) && isset($header['value'])) { $this->headers[$header['name']] = $header['value']; } } return $this; }
php
protected function setHeaders(array $headers) { foreach ($headers as $header) { if (isset($header['name']) && isset($header['value'])) { $this->headers[$header['name']] = $header['value']; } } return $this; }
[ "protected", "function", "setHeaders", "(", "array", "$", "headers", ")", "{", "foreach", "(", "$", "headers", "as", "$", "header", ")", "{", "if", "(", "isset", "(", "$", "header", "[", "'name'", "]", ")", "&&", "isset", "(", "$", "header", "[", "...
Set headers array @access protected @param array $headers @return \JonnyW\PhantomJs\Http\Response
[ "Set", "headers", "array" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/Response.php#L129-L139
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/Response.php
Response.getHeader
public function getHeader($code) { if (isset($this->headers[$code])) { return $this->headers[$code]; } return null; }
php
public function getHeader($code) { if (isset($this->headers[$code])) { return $this->headers[$code]; } return null; }
[ "public", "function", "getHeader", "(", "$", "code", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "headers", "[", "$", "code", "]", ")", ")", "{", "return", "$", "this", "->", "headers", "[", "$", "code", "]", ";", "}", "return", "null",...
Get HTTP header value for code @access public @param string $code @return mixed
[ "Get", "HTTP", "header", "value", "for", "code" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/Response.php#L159-L166
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Client.php
Client.getInstance
public static function getInstance() { if (!self::$instance instanceof ClientInterface) { $serviceContainer = ServiceContainer::getInstance(); self::$instance = new static( $serviceContainer->get('engine'), $serviceContainer->get('procedure_loader'),...
php
public static function getInstance() { if (!self::$instance instanceof ClientInterface) { $serviceContainer = ServiceContainer::getInstance(); self::$instance = new static( $serviceContainer->get('engine'), $serviceContainer->get('procedure_loader'),...
[ "public", "static", "function", "getInstance", "(", ")", "{", "if", "(", "!", "self", "::", "$", "instance", "instanceof", "ClientInterface", ")", "{", "$", "serviceContainer", "=", "ServiceContainer", "::", "getInstance", "(", ")", ";", "self", "::", "$", ...
Get singleton instance @access public @return \JonnyW\PhantomJs\Client
[ "Get", "singleton", "instance" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Client.php#L98-L113
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Client.php
Client.send
public function send(RequestInterface $request, ResponseInterface $response) { $procedure = $this->procedureLoader->load($this->procedure); $this->procedureCompiler->compile($procedure, $request); $procedure->run($request, $response); return $response; }
php
public function send(RequestInterface $request, ResponseInterface $response) { $procedure = $this->procedureLoader->load($this->procedure); $this->procedureCompiler->compile($procedure, $request); $procedure->run($request, $response); return $response; }
[ "public", "function", "send", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "procedure", "=", "$", "this", "->", "procedureLoader", "->", "load", "(", "$", "this", "->", "procedure", ")", ";", "$", "this...
Send request @access public @param \JonnyW\PhantomJs\Http\RequestInterface $request @param \JonnyW\PhantomJs\Http\ResponseInterface $response @return \JonnyW\PhantomJs\Http\ResponseInterface
[ "Send", "request" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Client.php#L156-L165
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/Procedure.php
Procedure.run
public function run(InputInterface $input, OutputInterface $output) { try { $executable = $this->write( $this->compile($input) ); $descriptorspec = array( array('pipe', 'r'), array('pipe', 'w'), array('pipe...
php
public function run(InputInterface $input, OutputInterface $output) { try { $executable = $this->write( $this->compile($input) ); $descriptorspec = array( array('pipe', 'r'), array('pipe', 'w'), array('pipe...
[ "public", "function", "run", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "try", "{", "$", "executable", "=", "$", "this", "->", "write", "(", "$", "this", "->", "compile", "(", "$", "input", ")", ")", ";", "$...
Run procedure. @access public @param \JonnyW\PhantomJs\Procedure\InputInterface $input @param \JonnyW\PhantomJs\Procedure\OutputInterface $output @throws \JonnyW\PhantomJs\Exception\ProcedureFailedException @throws \JonnyW\PhantomJs\Exception\NotWritableException @return void
[ "Run", "procedure", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/Procedure.php#L93-L140
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Parser/JsonParser.php
JsonParser.parse
public function parse($data) { if ($data === null || !is_string($data)) { return array(); } if (substr($data, 0, 1) !== '{' && substr($data, 0, 1) !== '[') { return array(); } return (array) json_decode($data, true); }
php
public function parse($data) { if ($data === null || !is_string($data)) { return array(); } if (substr($data, 0, 1) !== '{' && substr($data, 0, 1) !== '[') { return array(); } return (array) json_decode($data, true); }
[ "public", "function", "parse", "(", "$", "data", ")", "{", "if", "(", "$", "data", "===", "null", "||", "!", "is_string", "(", "$", "data", ")", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", "substr", "(", "$", "data", ",", "0", ...
Parse json string into array. @access public @param string $data @return \stdClass
[ "Parse", "json", "string", "into", "array", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Parser/JsonParser.php#L25-L37
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureValidator.php
ProcedureValidator.validateSyntax
protected function validateSyntax($procedure) { $input = new Input(); $output = new Output(); $input->set('procedure', $procedure); $input->set('engine', $this->engine->toString()); $validator = $this->procedureLoader->load('validator'); $validator->run($input, $ou...
php
protected function validateSyntax($procedure) { $input = new Input(); $output = new Output(); $input->set('procedure', $procedure); $input->set('engine', $this->engine->toString()); $validator = $this->procedureLoader->load('validator'); $validator->run($input, $ou...
[ "protected", "function", "validateSyntax", "(", "$", "procedure", ")", "{", "$", "input", "=", "new", "Input", "(", ")", ";", "$", "output", "=", "new", "Output", "(", ")", ";", "$", "input", "->", "set", "(", "'procedure'", ",", "$", "procedure", ")...
Validate syntax. @access protected @param string $procedure @return void @throws \JonnyW\PhantomJs\Exception\SyntaxException
[ "Validate", "syntax", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureValidator.php#L75-L91
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureLoader.php
ProcedureLoader.load
public function load($id) { $procedure = $this->procedureFactory->createProcedure(); $procedure->setTemplate( $this->loadTemplate($id) ); return $procedure; }
php
public function load($id) { $procedure = $this->procedureFactory->createProcedure(); $procedure->setTemplate( $this->loadTemplate($id) ); return $procedure; }
[ "public", "function", "load", "(", "$", "id", ")", "{", "$", "procedure", "=", "$", "this", "->", "procedureFactory", "->", "createProcedure", "(", ")", ";", "$", "procedure", "->", "setTemplate", "(", "$", "this", "->", "loadTemplate", "(", "$", "id", ...
Load procedure instance by id. @access public @param string $id @return \JonnyW\PhantomJs\Procedure\ProcedureInterface
[ "Load", "procedure", "instance", "by", "id", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureLoader.php#L57-L65
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureLoader.php
ProcedureLoader.loadTemplate
public function loadTemplate($id, $extension = 'proc') { $path = $this->locator->locate(sprintf('%s.%s', $id, $extension)); return $this->loadFile($path); }
php
public function loadTemplate($id, $extension = 'proc') { $path = $this->locator->locate(sprintf('%s.%s', $id, $extension)); return $this->loadFile($path); }
[ "public", "function", "loadTemplate", "(", "$", "id", ",", "$", "extension", "=", "'proc'", ")", "{", "$", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "sprintf", "(", "'%s.%s'", ",", "$", "id", ",", "$", "extension", ")", ")", "...
Load procedure template by id. @access public @param string $id @param string $extension (default: 'proc') @return string
[ "Load", "procedure", "template", "by", "id", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureLoader.php#L75-L80
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureLoader.php
ProcedureLoader.loadFile
protected function loadFile($file) { if (!stream_is_local($file)) { throw new \InvalidArgumentException(sprintf('Procedure file is not a local file: "%s"', $file)); } if (!file_exists($file)) { throw new NotExistsException(sprintf('Procedure file does not exist: "%s"...
php
protected function loadFile($file) { if (!stream_is_local($file)) { throw new \InvalidArgumentException(sprintf('Procedure file is not a local file: "%s"', $file)); } if (!file_exists($file)) { throw new NotExistsException(sprintf('Procedure file does not exist: "%s"...
[ "protected", "function", "loadFile", "(", "$", "file", ")", "{", "if", "(", "!", "stream_is_local", "(", "$", "file", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Procedure file is not a local file: \"%s\"'", ",", "$", ...
Load procedure file content. @access protected @param string $file @return string @throws \InvalidArgumentException @throws \JonnyW\PhantomJs\Exception\NotExistsException
[ "Load", "procedure", "file", "content", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureLoader.php#L91-L102
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Procedure/ProcedureFactory.php
ProcedureFactory.createProcedure
public function createProcedure() { $procedure = new Procedure( $this->engine, $this->parser, $this->cacheHandler, $this->renderer ); return $procedure; }
php
public function createProcedure() { $procedure = new Procedure( $this->engine, $this->parser, $this->cacheHandler, $this->renderer ); return $procedure; }
[ "public", "function", "createProcedure", "(", ")", "{", "$", "procedure", "=", "new", "Procedure", "(", "$", "this", "->", "engine", ",", "$", "this", "->", "parser", ",", "$", "this", "->", "cacheHandler", ",", "$", "this", "->", "renderer", ")", ";",...
Create new procedure instance. @access public @return \JonnyW\PhantomJs\Procedure\Procedure
[ "Create", "new", "procedure", "instance", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Procedure/ProcedureFactory.php#L79-L89
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Template/TemplateRenderer.php
TemplateRenderer.render
public function render($template, array $context = array()) { $template = $this->twig->createTemplate($template); return $template->render($context); }
php
public function render($template, array $context = array()) { $template = $this->twig->createTemplate($template); return $template->render($context); }
[ "public", "function", "render", "(", "$", "template", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "template", "=", "$", "this", "->", "twig", "->", "createTemplate", "(", "$", "template", ")", ";", "return", "$", "template", ...
Render template. @access public @param string $template @param array $context (default: array()) @return string
[ "Render", "template", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Template/TemplateRenderer.php#L45-L50
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/MessageFactory.php
MessageFactory.createRequest
public function createRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) { return new Request($url, $method, $timeout); }
php
public function createRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) { return new Request($url, $method, $timeout); }
[ "public", "function", "createRequest", "(", "$", "url", "=", "null", ",", "$", "method", "=", "RequestInterface", "::", "METHOD_GET", ",", "$", "timeout", "=", "5000", ")", "{", "return", "new", "Request", "(", "$", "url", ",", "$", "method", ",", "$",...
Create request instance. @access public @param string $url @param string $method @param int $timeout @return \JonnyW\PhantomJs\Http\Request
[ "Create", "request", "instance", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/MessageFactory.php#L50-L53
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/MessageFactory.php
MessageFactory.createCaptureRequest
public function createCaptureRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) { return new CaptureRequest($url, $method, $timeout); }
php
public function createCaptureRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) { return new CaptureRequest($url, $method, $timeout); }
[ "public", "function", "createCaptureRequest", "(", "$", "url", "=", "null", ",", "$", "method", "=", "RequestInterface", "::", "METHOD_GET", ",", "$", "timeout", "=", "5000", ")", "{", "return", "new", "CaptureRequest", "(", "$", "url", ",", "$", "method",...
Create capture request instance. @access public @param string $url @param string $method @param int $timeout @return \JonnyW\PhantomJs\Http\CaptureRequest
[ "Create", "capture", "request", "instance", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/MessageFactory.php#L64-L67
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/MessageFactory.php
MessageFactory.createPdfRequest
public function createPdfRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) { return new PdfRequest($url, $method, $timeout); }
php
public function createPdfRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) { return new PdfRequest($url, $method, $timeout); }
[ "public", "function", "createPdfRequest", "(", "$", "url", "=", "null", ",", "$", "method", "=", "RequestInterface", "::", "METHOD_GET", ",", "$", "timeout", "=", "5000", ")", "{", "return", "new", "PdfRequest", "(", "$", "url", ",", "$", "method", ",", ...
Create PDF request instance. @access public @param string $url @param string $method @param int $timeout @return \JonnyW\PhantomJs\Http\PdfRequest
[ "Create", "PDF", "request", "instance", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/MessageFactory.php#L78-L81
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php
ServiceContainer.getInstance
public static function getInstance() { if (null === self::$instance) { self::$instance = new static(); $loader = new YamlFileLoader(self::$instance, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('config.yml'); $loader->load('services.yml'); ...
php
public static function getInstance() { if (null === self::$instance) { self::$instance = new static(); $loader = new YamlFileLoader(self::$instance, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('config.yml'); $loader->load('services.yml'); ...
[ "public", "static", "function", "getInstance", "(", ")", "{", "if", "(", "null", "===", "self", "::", "$", "instance", ")", "{", "self", "::", "$", "instance", "=", "new", "static", "(", ")", ";", "$", "loader", "=", "new", "YamlFileLoader", "(", "se...
Get singleton instance @access public @return static
[ "Get", "singleton", "instance" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php#L36-L50
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Cache/FileCache.php
FileCache.save
public function save($id, $data) { $file = $this->getFilename($id); if (!$this->isWritable($file)) { throw new NotWritableException(sprintf('File could not be written to system as target is not writable: %s', $file)); } if ($this->writeData($file, $data) === false) { ...
php
public function save($id, $data) { $file = $this->getFilename($id); if (!$this->isWritable($file)) { throw new NotWritableException(sprintf('File could not be written to system as target is not writable: %s', $file)); } if ($this->writeData($file, $data) === false) { ...
[ "public", "function", "save", "(", "$", "id", ",", "$", "data", ")", "{", "$", "file", "=", "$", "this", "->", "getFilename", "(", "$", "id", ")", ";", "if", "(", "!", "$", "this", "->", "isWritable", "(", "$", "file", ")", ")", "{", "throw", ...
Write data to storage. @access public @param string $id @param string $data @return string @throws \JonnyW\PhantomJs\Exception\NotWritableException
[ "Write", "data", "to", "storage", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Cache/FileCache.php#L60-L76
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Cache/FileCache.php
FileCache.fetch
public function fetch($id) { $file = $this->getFilename($id); if (!$this->exists($id)) { throw new NotExistsException(sprintf('Could not fetch data from file as file does not exist: %s', $file)); } return $this->readData($file); }
php
public function fetch($id) { $file = $this->getFilename($id); if (!$this->exists($id)) { throw new NotExistsException(sprintf('Could not fetch data from file as file does not exist: %s', $file)); } return $this->readData($file); }
[ "public", "function", "fetch", "(", "$", "id", ")", "{", "$", "file", "=", "$", "this", "->", "getFilename", "(", "$", "id", ")", ";", "if", "(", "!", "$", "this", "->", "exists", "(", "$", "id", ")", ")", "{", "throw", "new", "NotExistsException...
Fetch data from file. @access public @param string $id @return mixed|void @throws \JonnyW\PhantomJs\Exception\NotExistsException
[ "Fetch", "data", "from", "file", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Cache/FileCache.php#L86-L95
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Cache/FileCache.php
FileCache.delete
public function delete($id) { $files = glob($this->getFilename($id)); if (count($files)) { array_map('unlink', $files); } }
php
public function delete($id) { $files = glob($this->getFilename($id)); if (count($files)) { array_map('unlink', $files); } }
[ "public", "function", "delete", "(", "$", "id", ")", "{", "$", "files", "=", "glob", "(", "$", "this", "->", "getFilename", "(", "$", "id", ")", ")", ";", "if", "(", "count", "(", "$", "files", ")", ")", "{", "array_map", "(", "'unlink'", ",", ...
Delete data from storage. @access public @param string $id @return void
[ "Delete", "data", "from", "storage", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Cache/FileCache.php#L104-L111
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Cache/FileCache.php
FileCache.isWritable
protected function isWritable($file) { return (bool) ((file_exists($file) && is_writable($file)) || (!file_exists($file) && is_writable(dirname($file)))); }
php
protected function isWritable($file) { return (bool) ((file_exists($file) && is_writable($file)) || (!file_exists($file) && is_writable(dirname($file)))); }
[ "protected", "function", "isWritable", "(", "$", "file", ")", "{", "return", "(", "bool", ")", "(", "(", "file_exists", "(", "$", "file", ")", "&&", "is_writable", "(", "$", "file", ")", ")", "||", "(", "!", "file_exists", "(", "$", "file", ")", "&...
Is data writeable. @access protected @param $file @return boolean
[ "Is", "data", "writeable", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Cache/FileCache.php#L132-L135
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Cache/FileCache.php
FileCache.getFileName
protected function getFileName($id) { if (is_dir($id)) { return sprintf('%1$s/%2$s.%3$s', rtrim($id, DIRECTORY_SEPARATOR), StringUtils::random(20), $this->extension); } $dirName = dirname($id); if (!file_exists($id) && $dirName === '.') { return sprintf('%1...
php
protected function getFileName($id) { if (is_dir($id)) { return sprintf('%1$s/%2$s.%3$s', rtrim($id, DIRECTORY_SEPARATOR), StringUtils::random(20), $this->extension); } $dirName = dirname($id); if (!file_exists($id) && $dirName === '.') { return sprintf('%1...
[ "protected", "function", "getFileName", "(", "$", "id", ")", "{", "if", "(", "is_dir", "(", "$", "id", ")", ")", "{", "return", "sprintf", "(", "'%1$s/%2$s.%3$s'", ",", "rtrim", "(", "$", "id", ",", "DIRECTORY_SEPARATOR", ")", ",", "StringUtils", "::", ...
Get filename @access protected @param string $id @return string @throws \JonnyW\PhantomJs\Exception\NotWritableException
[ "Get", "filename" ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Cache/FileCache.php#L170-L187
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/CaptureRequest.php
CaptureRequest.setCaptureDimensions
public function setCaptureDimensions($width, $height, $top = 0, $left = 0) { $this->rectWidth = (int) $width; $this->rectHeight = (int) $height; $this->rectTop = (int) $top; $this->rectLeft = (int) $left; return $this; }
php
public function setCaptureDimensions($width, $height, $top = 0, $left = 0) { $this->rectWidth = (int) $width; $this->rectHeight = (int) $height; $this->rectTop = (int) $top; $this->rectLeft = (int) $left; return $this; }
[ "public", "function", "setCaptureDimensions", "(", "$", "width", ",", "$", "height", ",", "$", "top", "=", "0", ",", "$", "left", "=", "0", ")", "{", "$", "this", "->", "rectWidth", "=", "(", "int", ")", "$", "width", ";", "$", "this", "->", "rec...
Set viewport size. @param int $width @param int $height @param int $top (default: 0) @param int $left (default: 0) @return \JonnyW\PhantomJs\Http\AbstractRequest
[ "Set", "viewport", "size", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/CaptureRequest.php#L137-L145
jonnnnyw/php-phantomjs
src/JonnyW/PhantomJs/Http/CaptureRequest.php
CaptureRequest.setOutputFile
public function setOutputFile($file) { if (!is_writable(dirname($file))) { throw new NotWritableException(sprintf('Output file is not writeable by PhantomJs: %s', $file)); } $this->outputFile = $file; return $this; }
php
public function setOutputFile($file) { if (!is_writable(dirname($file))) { throw new NotWritableException(sprintf('Output file is not writeable by PhantomJs: %s', $file)); } $this->outputFile = $file; return $this; }
[ "public", "function", "setOutputFile", "(", "$", "file", ")", "{", "if", "(", "!", "is_writable", "(", "dirname", "(", "$", "file", ")", ")", ")", "{", "throw", "new", "NotWritableException", "(", "sprintf", "(", "'Output file is not writeable by PhantomJs: %s'"...
Set file to save output. @param string $file @throws \JonnyW\PhantomJs\Exception\NotWritableException @return \JonnyW\PhantomJs\Http\CaptureRequest
[ "Set", "file", "to", "save", "output", "." ]
train
https://github.com/jonnnnyw/php-phantomjs/blob/f35764503f6828908fd1108c960080edf915eabe/src/JonnyW/PhantomJs/Http/CaptureRequest.php#L196-L205
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.appliesTo
public function appliesTo(string $name): bool { if ($name === $this->name) { return true; } $segment_name = $this->name.'/'; return (strncmp($segment_name, $name, strlen($segment_name)) == 0); }
php
public function appliesTo(string $name): bool { if ($name === $this->name) { return true; } $segment_name = $this->name.'/'; return (strncmp($segment_name, $name, strlen($segment_name)) == 0); }
[ "public", "function", "appliesTo", "(", "string", "$", "name", ")", ":", "bool", "{", "if", "(", "$", "name", "===", "$", "this", "->", "name", ")", "{", "return", "true", ";", "}", "$", "segment_name", "=", "$", "this", "->", "name", ".", "'/'", ...
checks whether the container can be applied to given name @param string $name @return bool
[ "checks", "whether", "the", "container", "can", "be", "applied", "to", "given", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L136-L144