id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
226,800
platforg/adobe-connect
src/AdobeConnect/ApiClient.php
ApiClient.scoExpandedContents
public function scoExpandedContents($sco_id, array $filters = array()) { $response = $this->call('sco-expanded-contents', array_merge(array( 'sco-id' => $sco_id, ), $filters)); return $response->xpath('/results/expanded-scos/sco'); }
php
public function scoExpandedContents($sco_id, array $filters = array()) { $response = $this->call('sco-expanded-contents', array_merge(array( 'sco-id' => $sco_id, ), $filters)); return $response->xpath('/results/expanded-scos/sco'); }
[ "public", "function", "scoExpandedContents", "(", "$", "sco_id", ",", "array", "$", "filters", "=", "array", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "call", "(", "'sco-expanded-contents'", ",", "array_merge", "(", "array", "(", "'sco-id'", "=>", "$", "sco_id", ",", ")", ",", "$", "filters", ")", ")", ";", "return", "$", "response", "->", "xpath", "(", "'/results/expanded-scos/sco'", ")", ";", "}" ]
Lists all of the SCOs in a folder, including the contents of subfolders, and any type of enclosing SCO. @param int $sco_id The unique ID of a folder for which you want to list contents. @param array $filters A filter to reduce the volume of the response. @return array An array with a list of SCOs within another SCO. Each element is a \SimpleXMLElement object.
[ "Lists", "all", "of", "the", "SCOs", "in", "a", "folder", "including", "the", "contents", "of", "subfolders", "and", "any", "type", "of", "enclosing", "SCO", "." ]
70f47a00e282ebc3b6491a2ec0e68a770dbfa549
https://github.com/platforg/adobe-connect/blob/70f47a00e282ebc3b6491a2ec0e68a770dbfa549/src/AdobeConnect/ApiClient.php#L497-L504
226,801
platforg/adobe-connect
src/AdobeConnect/ApiClient.php
ApiClient.scoInfo
public function scoInfo($sco_id) { $response = $this->call('sco-info', array( 'sco-id' => $sco_id, )); return array( 'sco' => current($response->xpath('/results/sco')), 'source-sco' => $response->xpath('/results/source-sco/source-sco'), ); }
php
public function scoInfo($sco_id) { $response = $this->call('sco-info', array( 'sco-id' => $sco_id, )); return array( 'sco' => current($response->xpath('/results/sco')), 'source-sco' => $response->xpath('/results/source-sco/source-sco'), ); }
[ "public", "function", "scoInfo", "(", "$", "sco_id", ")", "{", "$", "response", "=", "$", "this", "->", "call", "(", "'sco-info'", ",", "array", "(", "'sco-id'", "=>", "$", "sco_id", ",", ")", ")", ";", "return", "array", "(", "'sco'", "=>", "current", "(", "$", "response", "->", "xpath", "(", "'/results/sco'", ")", ")", ",", "'source-sco'", "=>", "$", "response", "->", "xpath", "(", "'/results/source-sco/source-sco'", ")", ",", ")", ";", "}" ]
Provides information about a SCO on Adobe Connect. The object can have any valid SCO type. @param int $sco_id The unique ID of a SCO on the server. @return array An array with two elements - \SimpleXMLElement sco, - array source-sco each element is a \SimpleXMLElement
[ "Provides", "information", "about", "a", "SCO", "on", "Adobe", "Connect", ".", "The", "object", "can", "have", "any", "valid", "SCO", "type", "." ]
70f47a00e282ebc3b6491a2ec0e68a770dbfa549
https://github.com/platforg/adobe-connect/blob/70f47a00e282ebc3b6491a2ec0e68a770dbfa549/src/AdobeConnect/ApiClient.php#L515-L525
226,802
platforg/adobe-connect
src/AdobeConnect/ApiClient.php
ApiClient.scoSearch
public function scoSearch($query, array $filters = array()) { $response = $this->call('sco-search', array_merge(array( 'query' => $query, ), $filters)); return $response->xpath('/results/sco-search-info/sco'); }
php
public function scoSearch($query, array $filters = array()) { $response = $this->call('sco-search', array_merge(array( 'query' => $query, ), $filters)); return $response->xpath('/results/sco-search-info/sco'); }
[ "public", "function", "scoSearch", "(", "$", "query", ",", "array", "$", "filters", "=", "array", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "call", "(", "'sco-search'", ",", "array_merge", "(", "array", "(", "'query'", "=>", "$", "query", ",", ")", ",", "$", "filters", ")", ")", ";", "return", "$", "response", "->", "xpath", "(", "'/results/sco-search-info/sco'", ")", ";", "}" ]
Provides a list of all SCOs that have content matching the search text. @param string $query A string to search for. To use any of these special characters in the query string, escape them with a backslash before the character: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ The query string is not case-sensitive and allows wildcard characters * and ? at the end of the query string. @return array An array with a list of SCOs that have content matching the query. Each element is a \SimpleXMLElement object.
[ "Provides", "a", "list", "of", "all", "SCOs", "that", "have", "content", "matching", "the", "search", "text", "." ]
70f47a00e282ebc3b6491a2ec0e68a770dbfa549
https://github.com/platforg/adobe-connect/blob/70f47a00e282ebc3b6491a2ec0e68a770dbfa549/src/AdobeConnect/ApiClient.php#L573-L580
226,803
middlewares/honeypot
src/Honeypot.php
Honeypot.getField
public static function getField(string $name = null): string { $name = $name ?: self::$currentName; return sprintf('<input type="text" name="%s">', $name); }
php
public static function getField(string $name = null): string { $name = $name ?: self::$currentName; return sprintf('<input type="text" name="%s">', $name); }
[ "public", "static", "function", "getField", "(", "string", "$", "name", "=", "null", ")", ":", "string", "{", "$", "name", "=", "$", "name", "?", ":", "self", "::", "$", "currentName", ";", "return", "sprintf", "(", "'<input type=\"text\" name=\"%s\">'", ",", "$", "name", ")", ";", "}" ]
Build a new honeypot field.
[ "Build", "a", "new", "honeypot", "field", "." ]
b8ab328b8afee108a03318bfb9c90d2e3d1225c7
https://github.com/middlewares/honeypot/blob/b8ab328b8afee108a03318bfb9c90d2e3d1225c7/src/Honeypot.php#L31-L36
226,804
middlewares/honeypot
src/Honeypot.php
Honeypot.getHiddenField
public static function getHiddenField(string $name = null): string { $name = $name ?: self::$currentName; return sprintf('<input type="text" name="%s" style="display: none">', $name); }
php
public static function getHiddenField(string $name = null): string { $name = $name ?: self::$currentName; return sprintf('<input type="text" name="%s" style="display: none">', $name); }
[ "public", "static", "function", "getHiddenField", "(", "string", "$", "name", "=", "null", ")", ":", "string", "{", "$", "name", "=", "$", "name", "?", ":", "self", "::", "$", "currentName", ";", "return", "sprintf", "(", "'<input type=\"text\" name=\"%s\" style=\"display: none\">'", ",", "$", "name", ")", ";", "}" ]
Build a new honeypot field, hidden via inline CSS.
[ "Build", "a", "new", "honeypot", "field", "hidden", "via", "inline", "CSS", "." ]
b8ab328b8afee108a03318bfb9c90d2e3d1225c7
https://github.com/middlewares/honeypot/blob/b8ab328b8afee108a03318bfb9c90d2e3d1225c7/src/Honeypot.php#L41-L46
226,805
CoopBelvedere/laravel-basecamp-api
src/Sections/ProjectConstructions.php
ProjectConstructions.show
public function show($id) { $projectConstructions = $this->client->get( sprintf('templates/%d/project_constructions/%d.json', $this->parent, $id) ); return $this->response($projectConstructions); }
php
public function show($id) { $projectConstructions = $this->client->get( sprintf('templates/%d/project_constructions/%d.json', $this->parent, $id) ); return $this->response($projectConstructions); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "projectConstructions", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'templates/%d/project_constructions/%d.json'", ",", "$", "this", "->", "parent", ",", "$", "id", ")", ")", ";", "return", "$", "this", "->", "response", "(", "$", "projectConstructions", ")", ";", "}" ]
Get a project construction. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "project", "construction", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/ProjectConstructions.php#L13-L20
226,806
CoopBelvedere/laravel-basecamp-api
src/Sections/ProjectConstructions.php
ProjectConstructions.store
public function store(array $data) { $projectConstruction = $this->client->post( sprintf('templates/%d/project_constructions.json', $this->parent), [ 'json' => $data, ] ); return $this->response($projectConstruction); }
php
public function store(array $data) { $projectConstruction = $this->client->post( sprintf('templates/%d/project_constructions.json', $this->parent), [ 'json' => $data, ] ); return $this->response($projectConstruction); }
[ "public", "function", "store", "(", "array", "$", "data", ")", "{", "$", "projectConstruction", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'templates/%d/project_constructions.json'", ",", "$", "this", "->", "parent", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "$", "this", "->", "response", "(", "$", "projectConstruction", ")", ";", "}" ]
Create a project construction. @param array $data @return \Illuminate\Support\Collection
[ "Create", "a", "project", "construction", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/ProjectConstructions.php#L28-L38
226,807
CoopBelvedere/laravel-basecamp-api
src/Sections/Attachments.php
Attachments.store
public function store($name, $path) { $rawData = file_get_contents($path); $attachment = $this->client->post('attachments.json', [ 'query' => [ 'name' => $name, ], 'body' => $rawData, 'headers' => [ 'Content-Type' => mime_content_type($path), 'Content-Length' => filesize($path), ], ]); return $this->response($attachment); }
php
public function store($name, $path) { $rawData = file_get_contents($path); $attachment = $this->client->post('attachments.json', [ 'query' => [ 'name' => $name, ], 'body' => $rawData, 'headers' => [ 'Content-Type' => mime_content_type($path), 'Content-Length' => filesize($path), ], ]); return $this->response($attachment); }
[ "public", "function", "store", "(", "$", "name", ",", "$", "path", ")", "{", "$", "rawData", "=", "file_get_contents", "(", "$", "path", ")", ";", "$", "attachment", "=", "$", "this", "->", "client", "->", "post", "(", "'attachments.json'", ",", "[", "'query'", "=>", "[", "'name'", "=>", "$", "name", ",", "]", ",", "'body'", "=>", "$", "rawData", ",", "'headers'", "=>", "[", "'Content-Type'", "=>", "mime_content_type", "(", "$", "path", ")", ",", "'Content-Length'", "=>", "filesize", "(", "$", "path", ")", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "response", "(", "$", "attachment", ")", ";", "}" ]
Store a new attachment. @param string $name @param string $path @return \Illuminate\Support\Collection
[ "Store", "a", "new", "attachment", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Attachments.php#L16-L32
226,808
Dachande663/PHP-Validation
src/HybridLogic/Validation/Rule/Matches.php
Matches.get_error_message
public function get_error_message($field, $value, $validator) { return $validator->get_label($field) . ' must match ' . $validator->get_label($this->compare_against); }
php
public function get_error_message($field, $value, $validator) { return $validator->get_label($field) . ' must match ' . $validator->get_label($this->compare_against); }
[ "public", "function", "get_error_message", "(", "$", "field", ",", "$", "value", ",", "$", "validator", ")", "{", "return", "$", "validator", "->", "get_label", "(", "$", "field", ")", ".", "' must match '", ".", "$", "validator", "->", "get_label", "(", "$", "this", "->", "compare_against", ")", ";", "}" ]
Return error message for this Rule @param string Field name @param string Field value @param Validator Validator object @return string Error message
[ "Return", "error", "message", "for", "this", "Rule" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Rule/Matches.php#L55-L57
226,809
CoopBelvedere/laravel-basecamp-api
src/Sections/Campfires.php
Campfires.index
public function index($page = null) { $url = 'chats.json'; $campfires = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($campfires, Campfire::class); }
php
public function index($page = null) { $url = 'chats.json'; $campfires = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($campfires, Campfire::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "'chats.json'", ";", "$", "campfires", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "campfires", ",", "Campfire", "::", "class", ")", ";", "}" ]
Index all campfires. @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "campfires", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Campfires.php#L16-L27
226,810
CoopBelvedere/laravel-basecamp-api
src/Sections/Campfires.php
Campfires.show
public function show($id) { $campfire = $this->client->get( sprintf('buckets/%d/chats/%d.json', $this->bucket, $id) ); return new Campfire($this->response($campfire)); }
php
public function show($id) { $campfire = $this->client->get( sprintf('buckets/%d/chats/%d.json', $this->bucket, $id) ); return new Campfire($this->response($campfire)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "campfire", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/chats/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "Campfire", "(", "$", "this", "->", "response", "(", "$", "campfire", ")", ")", ";", "}" ]
Get a campfire. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "campfire", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Campfires.php#L35-L42
226,811
CoopBelvedere/laravel-basecamp-api
src/Sections/Campfires.php
Campfires.lines
public function lines($page = null) { $url = sprintf('buckets/%d/chats/%d/lines.json', $this->bucket, $this->parent); $lines = $this->client->get($url, [ 'query' => [ 'page' => $page, ] ]); return $this->indexResponse($lines, CampfireLine::class); }
php
public function lines($page = null) { $url = sprintf('buckets/%d/chats/%d/lines.json', $this->bucket, $this->parent); $lines = $this->client->get($url, [ 'query' => [ 'page' => $page, ] ]); return $this->indexResponse($lines, CampfireLine::class); }
[ "public", "function", "lines", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/chats/%d/lines.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "lines", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'page'", "=>", "$", "page", ",", "]", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "lines", ",", "CampfireLine", "::", "class", ")", ";", "}" ]
Get a campfire lines. @param int $page @return \Illuminate\Support\Collection
[ "Get", "a", "campfire", "lines", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Campfires.php#L50-L61
226,812
CoopBelvedere/laravel-basecamp-api
src/Sections/Campfires.php
Campfires.line
public function line($line) { $line = $this->client->get( sprintf('buckets/%d/chats/%d/lines/%d.json', $this->bucket, $this->parent, $line) ); return new CampfireLine($this->response($line)); }
php
public function line($line) { $line = $this->client->get( sprintf('buckets/%d/chats/%d/lines/%d.json', $this->bucket, $this->parent, $line) ); return new CampfireLine($this->response($line)); }
[ "public", "function", "line", "(", "$", "line", ")", "{", "$", "line", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/chats/%d/lines/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ",", "$", "line", ")", ")", ";", "return", "new", "CampfireLine", "(", "$", "this", "->", "response", "(", "$", "line", ")", ")", ";", "}" ]
Get a single campfire line. @param int $line @return \Illuminate\Support\Collection
[ "Get", "a", "single", "campfire", "line", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Campfires.php#L69-L76
226,813
CoopBelvedere/laravel-basecamp-api
src/Sections/Campfires.php
Campfires.storeLine
public function storeLine($content) { $line = $this->client->post( sprintf('buckets/%d/chats/%d/lines.json', $this->bucket, $this->parent), [ 'json' => [ 'content' => $content, ], ] ); return new CampfireLine($this->response($line)); }
php
public function storeLine($content) { $line = $this->client->post( sprintf('buckets/%d/chats/%d/lines.json', $this->bucket, $this->parent), [ 'json' => [ 'content' => $content, ], ] ); return new CampfireLine($this->response($line)); }
[ "public", "function", "storeLine", "(", "$", "content", ")", "{", "$", "line", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'buckets/%d/chats/%d/lines.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ",", "[", "'json'", "=>", "[", "'content'", "=>", "$", "content", ",", "]", ",", "]", ")", ";", "return", "new", "CampfireLine", "(", "$", "this", "->", "response", "(", "$", "line", ")", ")", ";", "}" ]
Create a Campfire line. @param string $content @return \Illuminate\Support\Collection
[ "Create", "a", "Campfire", "line", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Campfires.php#L84-L96
226,814
CoopBelvedere/laravel-basecamp-api
src/Sections/Documents.php
Documents.show
public function show($id) { $document = $this->client->get( sprintf('buckets/%d/documents/%d.json', $this->bucket, $id) ); return new Document($this->response($document)); }
php
public function show($id) { $document = $this->client->get( sprintf('buckets/%d/documents/%d.json', $this->bucket, $id) ); return new Document($this->response($document)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "document", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/documents/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "Document", "(", "$", "this", "->", "response", "(", "$", "document", ")", ")", ";", "}" ]
Get a document. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "document", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Documents.php#L37-L44
226,815
CoopBelvedere/laravel-basecamp-api
src/Sections/Documents.php
Documents.store
public function store($data) { $document = $this->client->post( sprintf('buckets/%d/vaults/%d/documents.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new Document($this->response($document)); }
php
public function store($data) { $document = $this->client->post( sprintf('buckets/%d/vaults/%d/documents.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new Document($this->response($document)); }
[ "public", "function", "store", "(", "$", "data", ")", "{", "$", "document", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'buckets/%d/vaults/%d/documents.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Document", "(", "$", "this", "->", "response", "(", "$", "document", ")", ")", ";", "}" ]
Store a document. @param array $data @return \Illuminate\Support\Collection
[ "Store", "a", "document", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Documents.php#L52-L62
226,816
CoopBelvedere/laravel-basecamp-api
src/Sections/Documents.php
Documents.update
public function update($id, $data) { $document = $this->client->put( sprintf('buckets/%d/documents/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new Document($this->response($document)); }
php
public function update($id, $data) { $document = $this->client->put( sprintf('buckets/%d/documents/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new Document($this->response($document)); }
[ "public", "function", "update", "(", "$", "id", ",", "$", "data", ")", "{", "$", "document", "=", "$", "this", "->", "client", "->", "put", "(", "sprintf", "(", "'buckets/%d/documents/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Document", "(", "$", "this", "->", "response", "(", "$", "document", ")", ")", ";", "}" ]
Update a document. @param int $id @param array $data @return \Illuminate\Support\Collection
[ "Update", "a", "document", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Documents.php#L71-L81
226,817
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm.wrap
public function wrap(string $key, string $kek): string { $key_len = strlen($key); // rfc3394 dictates n to be at least 2 if ($key_len < 16) { throw new \UnexpectedValueException( "Key length must be at least 16 octets."); } if (0 !== $key_len % 8) { throw new \UnexpectedValueException( "Key length must be a multiple of 64 bits."); } $this->_checkKEKSize($kek); // P = plaintext as 64 bit blocks $P = []; $i = 1; foreach (str_split($key, 8) as $val) { $P[$i++] = $val; } $C = $this->_wrapBlocks($P, $kek, $this->_iv); return implode("", $C); }
php
public function wrap(string $key, string $kek): string { $key_len = strlen($key); // rfc3394 dictates n to be at least 2 if ($key_len < 16) { throw new \UnexpectedValueException( "Key length must be at least 16 octets."); } if (0 !== $key_len % 8) { throw new \UnexpectedValueException( "Key length must be a multiple of 64 bits."); } $this->_checkKEKSize($kek); // P = plaintext as 64 bit blocks $P = []; $i = 1; foreach (str_split($key, 8) as $val) { $P[$i++] = $val; } $C = $this->_wrapBlocks($P, $kek, $this->_iv); return implode("", $C); }
[ "public", "function", "wrap", "(", "string", "$", "key", ",", "string", "$", "kek", ")", ":", "string", "{", "$", "key_len", "=", "strlen", "(", "$", "key", ")", ";", "// rfc3394 dictates n to be at least 2", "if", "(", "$", "key_len", "<", "16", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Key length must be at least 16 octets.\"", ")", ";", "}", "if", "(", "0", "!==", "$", "key_len", "%", "8", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Key length must be a multiple of 64 bits.\"", ")", ";", "}", "$", "this", "->", "_checkKEKSize", "(", "$", "kek", ")", ";", "// P = plaintext as 64 bit blocks", "$", "P", "=", "[", "]", ";", "$", "i", "=", "1", ";", "foreach", "(", "str_split", "(", "$", "key", ",", "8", ")", "as", "$", "val", ")", "{", "$", "P", "[", "$", "i", "++", "]", "=", "$", "val", ";", "}", "$", "C", "=", "$", "this", "->", "_wrapBlocks", "(", "$", "P", ",", "$", "kek", ",", "$", "this", "->", "_iv", ")", ";", "return", "implode", "(", "\"\"", ",", "$", "C", ")", ";", "}" ]
Wrap a key using given key encryption key. Key length must be at least 64 bits (8 octets) and a multiple of 64 bits (8 octets). Use <i>wrapPad</i> to wrap a key of arbitrary length. Key encryption key must have a size of underlying AES algorithm, ie. 128, 196 or 256 bits. @param string $key Key to wrap @param string $kek Key encryption key @throws \UnexpectedValueException If the key length is invalid @return string Ciphertext
[ "Wrap", "a", "key", "using", "given", "key", "encryption", "key", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L79-L100
226,818
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm.unwrap
public function unwrap(string $ciphertext, string $kek): string { if (0 !== strlen($ciphertext) % 8) { throw new \UnexpectedValueException( "Ciphertext length must be a multiple of 64 bits."); } $this->_checkKEKSize($kek); // C = ciphertext as 64 bit blocks with integrity check value prepended $C = str_split($ciphertext, 8); list($A, $R) = $this->_unwrapBlocks($C, $kek); // check integrity value if (!hash_equals($this->_iv, $A)) { throw new \UnexpectedValueException("Integrity check failed."); } // output the plaintext $P = array_slice($R, 1, null, true); return implode("", $P); }
php
public function unwrap(string $ciphertext, string $kek): string { if (0 !== strlen($ciphertext) % 8) { throw new \UnexpectedValueException( "Ciphertext length must be a multiple of 64 bits."); } $this->_checkKEKSize($kek); // C = ciphertext as 64 bit blocks with integrity check value prepended $C = str_split($ciphertext, 8); list($A, $R) = $this->_unwrapBlocks($C, $kek); // check integrity value if (!hash_equals($this->_iv, $A)) { throw new \UnexpectedValueException("Integrity check failed."); } // output the plaintext $P = array_slice($R, 1, null, true); return implode("", $P); }
[ "public", "function", "unwrap", "(", "string", "$", "ciphertext", ",", "string", "$", "kek", ")", ":", "string", "{", "if", "(", "0", "!==", "strlen", "(", "$", "ciphertext", ")", "%", "8", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Ciphertext length must be a multiple of 64 bits.\"", ")", ";", "}", "$", "this", "->", "_checkKEKSize", "(", "$", "kek", ")", ";", "// C = ciphertext as 64 bit blocks with integrity check value prepended", "$", "C", "=", "str_split", "(", "$", "ciphertext", ",", "8", ")", ";", "list", "(", "$", "A", ",", "$", "R", ")", "=", "$", "this", "->", "_unwrapBlocks", "(", "$", "C", ",", "$", "kek", ")", ";", "// check integrity value", "if", "(", "!", "hash_equals", "(", "$", "this", "->", "_iv", ",", "$", "A", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Integrity check failed.\"", ")", ";", "}", "// output the plaintext", "$", "P", "=", "array_slice", "(", "$", "R", ",", "1", ",", "null", ",", "true", ")", ";", "return", "implode", "(", "\"\"", ",", "$", "P", ")", ";", "}" ]
Unwrap a key from a ciphertext using given key encryption key. @param string $ciphertext Ciphertext of the wrapped key @param string $kek Key encryption key @throws \UnexpectedValueException If the ciphertext is invalid @return string Unwrapped key
[ "Unwrap", "a", "key", "from", "a", "ciphertext", "using", "given", "key", "encryption", "key", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L110-L127
226,819
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm.wrapPad
public function wrapPad(string $key, string $kek): string { if (!strlen($key)) { throw new \UnexpectedValueException( "Key must have at least one octet."); } $this->_checkKEKSize($kek); list($key, $aiv) = $this->_padKey($key); // If the padded key contains exactly eight octets, // let the ciphertext be: // C[0] | C[1] = ENC(K, A | P[1]). if (8 == strlen($key)) { return $this->_encrypt($kek, $aiv . $key); } // build plaintext blocks and apply normal wrapping with AIV as an // initial value $P = []; $i = 1; foreach (str_split($key, 8) as $val) { $P[$i++] = $val; } $C = $this->_wrapBlocks($P, $kek, $aiv); return implode("", $C); }
php
public function wrapPad(string $key, string $kek): string { if (!strlen($key)) { throw new \UnexpectedValueException( "Key must have at least one octet."); } $this->_checkKEKSize($kek); list($key, $aiv) = $this->_padKey($key); // If the padded key contains exactly eight octets, // let the ciphertext be: // C[0] | C[1] = ENC(K, A | P[1]). if (8 == strlen($key)) { return $this->_encrypt($kek, $aiv . $key); } // build plaintext blocks and apply normal wrapping with AIV as an // initial value $P = []; $i = 1; foreach (str_split($key, 8) as $val) { $P[$i++] = $val; } $C = $this->_wrapBlocks($P, $kek, $aiv); return implode("", $C); }
[ "public", "function", "wrapPad", "(", "string", "$", "key", ",", "string", "$", "kek", ")", ":", "string", "{", "if", "(", "!", "strlen", "(", "$", "key", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Key must have at least one octet.\"", ")", ";", "}", "$", "this", "->", "_checkKEKSize", "(", "$", "kek", ")", ";", "list", "(", "$", "key", ",", "$", "aiv", ")", "=", "$", "this", "->", "_padKey", "(", "$", "key", ")", ";", "// If the padded key contains exactly eight octets,", "// let the ciphertext be:", "// C[0] | C[1] = ENC(K, A | P[1]).", "if", "(", "8", "==", "strlen", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "_encrypt", "(", "$", "kek", ",", "$", "aiv", ".", "$", "key", ")", ";", "}", "// build plaintext blocks and apply normal wrapping with AIV as an", "// initial value", "$", "P", "=", "[", "]", ";", "$", "i", "=", "1", ";", "foreach", "(", "str_split", "(", "$", "key", ",", "8", ")", "as", "$", "val", ")", "{", "$", "P", "[", "$", "i", "++", "]", "=", "$", "val", ";", "}", "$", "C", "=", "$", "this", "->", "_wrapBlocks", "(", "$", "P", ",", "$", "kek", ",", "$", "aiv", ")", ";", "return", "implode", "(", "\"\"", ",", "$", "C", ")", ";", "}" ]
Wrap a key of arbitrary length using given key encryption key. This variant of wrapping does not place any restriction on key size. Key encryption key has the same restrictions as with <i>wrap</i> method. @param string $key Key to wrap @param string $kek Key encryption key @throws \UnexpectedValueException If the key length is invalid @return string Ciphertext
[ "Wrap", "a", "key", "of", "arbitrary", "length", "using", "given", "key", "encryption", "key", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L141-L164
226,820
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm.unwrapPad
public function unwrapPad(string $ciphertext, string $kek): string { if (0 !== strlen($ciphertext) % 8) { throw new \UnexpectedValueException( "Ciphertext length must be a multiple of 64 bits."); } $this->_checkKEKSize($kek); list($P, $A) = $this->_unwrapPaddedCiphertext($ciphertext, $kek); // check message integrity $this->_checkPaddedIntegrity($A); // verify padding $len = $this->_verifyPadding($P, $A); // remove padding and return unwrapped key return substr(implode("", $P), 0, $len); }
php
public function unwrapPad(string $ciphertext, string $kek): string { if (0 !== strlen($ciphertext) % 8) { throw new \UnexpectedValueException( "Ciphertext length must be a multiple of 64 bits."); } $this->_checkKEKSize($kek); list($P, $A) = $this->_unwrapPaddedCiphertext($ciphertext, $kek); // check message integrity $this->_checkPaddedIntegrity($A); // verify padding $len = $this->_verifyPadding($P, $A); // remove padding and return unwrapped key return substr(implode("", $P), 0, $len); }
[ "public", "function", "unwrapPad", "(", "string", "$", "ciphertext", ",", "string", "$", "kek", ")", ":", "string", "{", "if", "(", "0", "!==", "strlen", "(", "$", "ciphertext", ")", "%", "8", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Ciphertext length must be a multiple of 64 bits.\"", ")", ";", "}", "$", "this", "->", "_checkKEKSize", "(", "$", "kek", ")", ";", "list", "(", "$", "P", ",", "$", "A", ")", "=", "$", "this", "->", "_unwrapPaddedCiphertext", "(", "$", "ciphertext", ",", "$", "kek", ")", ";", "// check message integrity", "$", "this", "->", "_checkPaddedIntegrity", "(", "$", "A", ")", ";", "// verify padding", "$", "len", "=", "$", "this", "->", "_verifyPadding", "(", "$", "P", ",", "$", "A", ")", ";", "// remove padding and return unwrapped key", "return", "substr", "(", "implode", "(", "\"\"", ",", "$", "P", ")", ",", "0", ",", "$", "len", ")", ";", "}" ]
Unwrap a key from a padded ciphertext using given key encryption key. This variant of unwrapping must be used if the key was wrapped using <i>wrapPad</i>. @param string $ciphertext Ciphertext of the wrapped and padded key @param string $kek Key encryption key @throws \UnexpectedValueException If the ciphertext is invalid @return string Unwrapped key
[ "Unwrap", "a", "key", "from", "a", "padded", "ciphertext", "using", "given", "key", "encryption", "key", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L177-L191
226,821
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm._checkKEKSize
protected function _checkKEKSize(string $kek): self { $len = $this->_keySize(); if (strlen($kek) != $len) { throw new \UnexpectedValueException("KEK size must be $len bytes."); } return $this; }
php
protected function _checkKEKSize(string $kek): self { $len = $this->_keySize(); if (strlen($kek) != $len) { throw new \UnexpectedValueException("KEK size must be $len bytes."); } return $this; }
[ "protected", "function", "_checkKEKSize", "(", "string", "$", "kek", ")", ":", "self", "{", "$", "len", "=", "$", "this", "->", "_keySize", "(", ")", ";", "if", "(", "strlen", "(", "$", "kek", ")", "!=", "$", "len", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"KEK size must be $len bytes.\"", ")", ";", "}", "return", "$", "this", ";", "}" ]
Check KEK size. @param string $kek @throws \UnexpectedValueException @return self
[ "Check", "KEK", "size", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L200-L207
226,822
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm._wrapBlocks
protected function _wrapBlocks(array $P, string $kek, string $iv): array { $n = count($P); // Set A = IV $A = $iv; // For i = 1 to n // R[i] = P[i] $R = $P; // For j = 0 to 5 for ($j = 0; $j <= 5; ++$j) { // For i = 1 to n for ($i = 1; $i <= $n; ++$i) { // B = AES(K, A | R[i]) $B = $this->_encrypt($kek, $A . $R[$i]); // A = MSB(64, B) ^ t where t = (n*j)+i $t = $n * $j + $i; $A = $this->_msb64($B) ^ $this->_uint64($t); // R[i] = LSB(64, B) $R[$i] = $this->_lsb64($B); } } // Set C[0] = A $C = [$A]; // For i = 1 to n for ($i = 1; $i <= $n; ++$i) { // C[i] = R[i] $C[$i] = $R[$i]; } return $C; }
php
protected function _wrapBlocks(array $P, string $kek, string $iv): array { $n = count($P); // Set A = IV $A = $iv; // For i = 1 to n // R[i] = P[i] $R = $P; // For j = 0 to 5 for ($j = 0; $j <= 5; ++$j) { // For i = 1 to n for ($i = 1; $i <= $n; ++$i) { // B = AES(K, A | R[i]) $B = $this->_encrypt($kek, $A . $R[$i]); // A = MSB(64, B) ^ t where t = (n*j)+i $t = $n * $j + $i; $A = $this->_msb64($B) ^ $this->_uint64($t); // R[i] = LSB(64, B) $R[$i] = $this->_lsb64($B); } } // Set C[0] = A $C = [$A]; // For i = 1 to n for ($i = 1; $i <= $n; ++$i) { // C[i] = R[i] $C[$i] = $R[$i]; } return $C; }
[ "protected", "function", "_wrapBlocks", "(", "array", "$", "P", ",", "string", "$", "kek", ",", "string", "$", "iv", ")", ":", "array", "{", "$", "n", "=", "count", "(", "$", "P", ")", ";", "// Set A = IV", "$", "A", "=", "$", "iv", ";", "// For i = 1 to n", "// R[i] = P[i]", "$", "R", "=", "$", "P", ";", "// For j = 0 to 5", "for", "(", "$", "j", "=", "0", ";", "$", "j", "<=", "5", ";", "++", "$", "j", ")", "{", "// For i = 1 to n", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<=", "$", "n", ";", "++", "$", "i", ")", "{", "// B = AES(K, A | R[i])", "$", "B", "=", "$", "this", "->", "_encrypt", "(", "$", "kek", ",", "$", "A", ".", "$", "R", "[", "$", "i", "]", ")", ";", "// A = MSB(64, B) ^ t where t = (n*j)+i", "$", "t", "=", "$", "n", "*", "$", "j", "+", "$", "i", ";", "$", "A", "=", "$", "this", "->", "_msb64", "(", "$", "B", ")", "^", "$", "this", "->", "_uint64", "(", "$", "t", ")", ";", "// R[i] = LSB(64, B)", "$", "R", "[", "$", "i", "]", "=", "$", "this", "->", "_lsb64", "(", "$", "B", ")", ";", "}", "}", "// Set C[0] = A", "$", "C", "=", "[", "$", "A", "]", ";", "// For i = 1 to n", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<=", "$", "n", ";", "++", "$", "i", ")", "{", "// C[i] = R[i]", "$", "C", "[", "$", "i", "]", "=", "$", "R", "[", "$", "i", "]", ";", "}", "return", "$", "C", ";", "}" ]
Apply Key Wrap to data blocks. Uses alternative version of the key wrap procedure described in the RFC. @link https://tools.ietf.org/html/rfc3394#section-2.2.1 @param string[] $P Plaintext, n 64-bit values <code>{P1, P2, ..., Pn}</code> @param string $kek Key encryption key @param string $iv Initial value @return string[] Ciphertext, (n+1) 64-bit values <code>{C0, C1, ..., Cn}</code>
[ "Apply", "Key", "Wrap", "to", "data", "blocks", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L222-L251
226,823
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm._unwrapPaddedCiphertext
protected function _unwrapPaddedCiphertext(string $ciphertext, string $kek): array { // split to blocks $C = str_split($ciphertext, 8); $n = count($C) - 1; // if key consists of only one block, recover AIV and padded key as: // A | P[1] = DEC(K, C[0] | C[1]) if ($n == 1) { $P = str_split($this->_decrypt($kek, $C[0] . $C[1]), 8); $A = $P[0]; unset($P[0]); } else { // apply normal unwrapping list($A, $R) = $this->_unwrapBlocks($C, $kek); $P = array_slice($R, 1, null, true); } return [$P, $A]; }
php
protected function _unwrapPaddedCiphertext(string $ciphertext, string $kek): array { // split to blocks $C = str_split($ciphertext, 8); $n = count($C) - 1; // if key consists of only one block, recover AIV and padded key as: // A | P[1] = DEC(K, C[0] | C[1]) if ($n == 1) { $P = str_split($this->_decrypt($kek, $C[0] . $C[1]), 8); $A = $P[0]; unset($P[0]); } else { // apply normal unwrapping list($A, $R) = $this->_unwrapBlocks($C, $kek); $P = array_slice($R, 1, null, true); } return [$P, $A]; }
[ "protected", "function", "_unwrapPaddedCiphertext", "(", "string", "$", "ciphertext", ",", "string", "$", "kek", ")", ":", "array", "{", "// split to blocks", "$", "C", "=", "str_split", "(", "$", "ciphertext", ",", "8", ")", ";", "$", "n", "=", "count", "(", "$", "C", ")", "-", "1", ";", "// if key consists of only one block, recover AIV and padded key as:", "// A | P[1] = DEC(K, C[0] | C[1])", "if", "(", "$", "n", "==", "1", ")", "{", "$", "P", "=", "str_split", "(", "$", "this", "->", "_decrypt", "(", "$", "kek", ",", "$", "C", "[", "0", "]", ".", "$", "C", "[", "1", "]", ")", ",", "8", ")", ";", "$", "A", "=", "$", "P", "[", "0", "]", ";", "unset", "(", "$", "P", "[", "0", "]", ")", ";", "}", "else", "{", "// apply normal unwrapping", "list", "(", "$", "A", ",", "$", "R", ")", "=", "$", "this", "->", "_unwrapBlocks", "(", "$", "C", ",", "$", "kek", ")", ";", "$", "P", "=", "array_slice", "(", "$", "R", ",", "1", ",", "null", ",", "true", ")", ";", "}", "return", "[", "$", "P", ",", "$", "A", "]", ";", "}" ]
Unwrap the padded ciphertext producing plaintext and integrity value. @param string $ciphertext Ciphertext @param string $kek Encryption key @return array Tuple of plaintext <code>{P1, P2, ..., Pn}</code> and integrity value <code>A</code>
[ "Unwrap", "the", "padded", "ciphertext", "producing", "plaintext", "and", "integrity", "value", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L261-L278
226,824
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm._unwrapBlocks
protected function _unwrapBlocks(array $C, string $kek): array { $n = count($C) - 1; if (!$n) { throw new \UnexpectedValueException("No blocks."); } // Set A = C[0] $A = $C[0]; // For i = 1 to n // R[i] = C[i] $R = $C; // For j = 5 to 0 for ($j = 5; $j >= 0; --$j) { // For i = n to 1 for ($i = $n; $i >= 1; --$i) { // B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i $t = $n * $j + $i; $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)) . $R[$i]); // A = MSB(64, B) $A = $this->_msb64($B); // R[i] = LSB(64, B) $R[$i] = $this->_lsb64($B); } } return array($A, $R); }
php
protected function _unwrapBlocks(array $C, string $kek): array { $n = count($C) - 1; if (!$n) { throw new \UnexpectedValueException("No blocks."); } // Set A = C[0] $A = $C[0]; // For i = 1 to n // R[i] = C[i] $R = $C; // For j = 5 to 0 for ($j = 5; $j >= 0; --$j) { // For i = n to 1 for ($i = $n; $i >= 1; --$i) { // B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i $t = $n * $j + $i; $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)) . $R[$i]); // A = MSB(64, B) $A = $this->_msb64($B); // R[i] = LSB(64, B) $R[$i] = $this->_lsb64($B); } } return array($A, $R); }
[ "protected", "function", "_unwrapBlocks", "(", "array", "$", "C", ",", "string", "$", "kek", ")", ":", "array", "{", "$", "n", "=", "count", "(", "$", "C", ")", "-", "1", ";", "if", "(", "!", "$", "n", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"No blocks.\"", ")", ";", "}", "// Set A = C[0]", "$", "A", "=", "$", "C", "[", "0", "]", ";", "// For i = 1 to n", "// R[i] = C[i]", "$", "R", "=", "$", "C", ";", "// For j = 5 to 0", "for", "(", "$", "j", "=", "5", ";", "$", "j", ">=", "0", ";", "--", "$", "j", ")", "{", "// For i = n to 1", "for", "(", "$", "i", "=", "$", "n", ";", "$", "i", ">=", "1", ";", "--", "$", "i", ")", "{", "// B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i", "$", "t", "=", "$", "n", "*", "$", "j", "+", "$", "i", ";", "$", "B", "=", "$", "this", "->", "_decrypt", "(", "$", "kek", ",", "(", "$", "A", "^", "$", "this", "->", "_uint64", "(", "$", "t", ")", ")", ".", "$", "R", "[", "$", "i", "]", ")", ";", "// A = MSB(64, B)", "$", "A", "=", "$", "this", "->", "_msb64", "(", "$", "B", ")", ";", "// R[i] = LSB(64, B)", "$", "R", "[", "$", "i", "]", "=", "$", "this", "->", "_lsb64", "(", "$", "B", ")", ";", "}", "}", "return", "array", "(", "$", "A", ",", "$", "R", ")", ";", "}" ]
Apply Key Unwrap to data blocks. Uses the index based version of key unwrap procedure described in the RFC. Does not compute step 3. @link https://tools.ietf.org/html/rfc3394#section-2.2.2 @param string[] $C Ciphertext, (n+1) 64-bit values <code>{C0, C1, ..., Cn}</code> @param string $kek Key encryption key @throws \UnexpectedValueException @return array Tuple of integrity value <code>A</code> and register <code>R</code>
[ "Apply", "Key", "Unwrap", "to", "data", "blocks", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L296-L321
226,825
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm._padKey
protected function _padKey(string $key): array { $len = strlen($key); // append padding if (0 != $len % 8) { $key .= str_repeat("\0", 8 - $len % 8); } // compute AIV $mli = pack("N", $len); $aiv = self::AIV_HI . $mli; return [$key, $aiv]; }
php
protected function _padKey(string $key): array { $len = strlen($key); // append padding if (0 != $len % 8) { $key .= str_repeat("\0", 8 - $len % 8); } // compute AIV $mli = pack("N", $len); $aiv = self::AIV_HI . $mli; return [$key, $aiv]; }
[ "protected", "function", "_padKey", "(", "string", "$", "key", ")", ":", "array", "{", "$", "len", "=", "strlen", "(", "$", "key", ")", ";", "// append padding", "if", "(", "0", "!=", "$", "len", "%", "8", ")", "{", "$", "key", ".=", "str_repeat", "(", "\"\\0\"", ",", "8", "-", "$", "len", "%", "8", ")", ";", "}", "// compute AIV", "$", "mli", "=", "pack", "(", "\"N\"", ",", "$", "len", ")", ";", "$", "aiv", "=", "self", "::", "AIV_HI", ".", "$", "mli", ";", "return", "[", "$", "key", ",", "$", "aiv", "]", ";", "}" ]
Pad a key with zeroes and compute alternative initial value. @param string $key Key @return array Tuple of padded key and AIV
[ "Pad", "a", "key", "with", "zeroes", "and", "compute", "alternative", "initial", "value", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L329-L340
226,826
sop/aes-kw
lib/AESKW/Algorithm.php
Algorithm._verifyPadding
protected function _verifyPadding(array $P, string $A): int { // extract mli $mli = substr($A, -4); $len = unpack("N1", $mli)[1]; // check under and overflow $n = count($P); if (8 * ($n - 1) >= $len || $len > 8 * $n) { throw new \UnexpectedValueException("Invalid message length."); } // if key is padded $b = 8 - ($len % 8); if ($b < 8) { // last block (note that the first index in P is 1) $Pn = $P[$n]; // check that padding consists of zeroes if (substr($Pn, -$b) != str_repeat("\0", $b)) { throw new \UnexpectedValueException("Invalid padding."); } } return $len; }
php
protected function _verifyPadding(array $P, string $A): int { // extract mli $mli = substr($A, -4); $len = unpack("N1", $mli)[1]; // check under and overflow $n = count($P); if (8 * ($n - 1) >= $len || $len > 8 * $n) { throw new \UnexpectedValueException("Invalid message length."); } // if key is padded $b = 8 - ($len % 8); if ($b < 8) { // last block (note that the first index in P is 1) $Pn = $P[$n]; // check that padding consists of zeroes if (substr($Pn, -$b) != str_repeat("\0", $b)) { throw new \UnexpectedValueException("Invalid padding."); } } return $len; }
[ "protected", "function", "_verifyPadding", "(", "array", "$", "P", ",", "string", "$", "A", ")", ":", "int", "{", "// extract mli", "$", "mli", "=", "substr", "(", "$", "A", ",", "-", "4", ")", ";", "$", "len", "=", "unpack", "(", "\"N1\"", ",", "$", "mli", ")", "[", "1", "]", ";", "// check under and overflow", "$", "n", "=", "count", "(", "$", "P", ")", ";", "if", "(", "8", "*", "(", "$", "n", "-", "1", ")", ">=", "$", "len", "||", "$", "len", ">", "8", "*", "$", "n", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Invalid message length.\"", ")", ";", "}", "// if key is padded", "$", "b", "=", "8", "-", "(", "$", "len", "%", "8", ")", ";", "if", "(", "$", "b", "<", "8", ")", "{", "// last block (note that the first index in P is 1)", "$", "Pn", "=", "$", "P", "[", "$", "n", "]", ";", "// check that padding consists of zeroes", "if", "(", "substr", "(", "$", "Pn", ",", "-", "$", "b", ")", "!=", "str_repeat", "(", "\"\\0\"", ",", "$", "b", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Invalid padding.\"", ")", ";", "}", "}", "return", "$", "len", ";", "}" ]
Verify that the padding of the plaintext is valid. @param array $P Plaintext, n 64-bit values <code>{P1, P2, ..., Pn}</code> @param string $A Integrity check value @throws \UnexpectedValueException @return int Message length without padding
[ "Verify", "that", "the", "padding", "of", "the", "plaintext", "is", "valid", "." ]
bc02a44212687a2e61b2042609f3f4bf3c34f01f
https://github.com/sop/aes-kw/blob/bc02a44212687a2e61b2042609f3f4bf3c34f01f/lib/AESKW/Algorithm.php#L365-L386
226,827
Dachande663/PHP-Validation
src/HybridLogic/Validation/Validator.php
Validator.get_label
public function get_label($field) { return isset($this->labels[$field]) ? $this->labels[$field] : $this->humanize_field_name($field); }
php
public function get_label($field) { return isset($this->labels[$field]) ? $this->labels[$field] : $this->humanize_field_name($field); }
[ "public", "function", "get_label", "(", "$", "field", ")", "{", "return", "isset", "(", "$", "this", "->", "labels", "[", "$", "field", "]", ")", "?", "$", "this", "->", "labels", "[", "$", "field", "]", ":", "$", "this", "->", "humanize_field_name", "(", "$", "field", ")", ";", "}" ]
Get field label @return string Label
[ "Get", "field", "label" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Validator.php#L61-L63
226,828
Dachande663/PHP-Validation
src/HybridLogic/Validation/Validator.php
Validator.add_filter
public function add_filter($field, $filter) { if(!is_callable($filter)) return $this; if(!isset($this->filters[$field])) $this->filters[$field] = array(); $this->filters[$field][] = $filter; return $this; }
php
public function add_filter($field, $filter) { if(!is_callable($filter)) return $this; if(!isset($this->filters[$field])) $this->filters[$field] = array(); $this->filters[$field][] = $filter; return $this; }
[ "public", "function", "add_filter", "(", "$", "field", ",", "$", "filter", ")", "{", "if", "(", "!", "is_callable", "(", "$", "filter", ")", ")", "return", "$", "this", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "filters", "[", "$", "field", "]", ")", ")", "$", "this", "->", "filters", "[", "$", "field", "]", "=", "array", "(", ")", ";", "$", "this", "->", "filters", "[", "$", "field", "]", "[", "]", "=", "$", "filter", ";", "return", "$", "this", ";", "}" ]
Add a Filter to this Field @param string Field name @param callable Filter callback @return self
[ "Add", "a", "Filter", "to", "this", "Field" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Validator.php#L74-L83
226,829
Dachande663/PHP-Validation
src/HybridLogic/Validation/Validator.php
Validator.add_rule
public function add_rule($field, $rule) { if(!$rule instanceof \HybridLogic\Validation\Rule) return $this; if(!isset($this->labels[$field])) { $this->set_label($field, $this->humanize_field_name($field)); } if(!isset($this->rules[$field])) $this->rules[$field] = array(); $this->rules[$field][] = $rule; return $this; }
php
public function add_rule($field, $rule) { if(!$rule instanceof \HybridLogic\Validation\Rule) return $this; if(!isset($this->labels[$field])) { $this->set_label($field, $this->humanize_field_name($field)); } if(!isset($this->rules[$field])) $this->rules[$field] = array(); $this->rules[$field][] = $rule; return $this; }
[ "public", "function", "add_rule", "(", "$", "field", ",", "$", "rule", ")", "{", "if", "(", "!", "$", "rule", "instanceof", "\\", "HybridLogic", "\\", "Validation", "\\", "Rule", ")", "return", "$", "this", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "labels", "[", "$", "field", "]", ")", ")", "{", "$", "this", "->", "set_label", "(", "$", "field", ",", "$", "this", "->", "humanize_field_name", "(", "$", "field", ")", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "rules", "[", "$", "field", "]", ")", ")", "$", "this", "->", "rules", "[", "$", "field", "]", "=", "array", "(", ")", ";", "$", "this", "->", "rules", "[", "$", "field", "]", "[", "]", "=", "$", "rule", ";", "return", "$", "this", ";", "}" ]
Add a Rule to this Field @param string Field name @param callable Validation rule @return self
[ "Add", "a", "Rule", "to", "this", "Field" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Validator.php#L94-L107
226,830
Dachande663/PHP-Validation
src/HybridLogic/Validation/Validator.php
Validator.is_valid
public function is_valid(array $data) { $this->data = $this->apply_filters($data); $this->errors = $this->test_rules(); return empty($this->errors); }
php
public function is_valid(array $data) { $this->data = $this->apply_filters($data); $this->errors = $this->test_rules(); return empty($this->errors); }
[ "public", "function", "is_valid", "(", "array", "$", "data", ")", "{", "$", "this", "->", "data", "=", "$", "this", "->", "apply_filters", "(", "$", "data", ")", ";", "$", "this", "->", "errors", "=", "$", "this", "->", "test_rules", "(", ")", ";", "return", "empty", "(", "$", "this", "->", "errors", ")", ";", "}" ]
Validate this object! @param array Input data to validate @return bool True if valid
[ "Validate", "this", "object!" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Validator.php#L128-L136
226,831
Dachande663/PHP-Validation
src/HybridLogic/Validation/Validator.php
Validator.get_data
public function get_data($field = null, $default = null) { if($field === null) return $this->data; return array_key_exists($field, $this->data) ? $this->data[$field] : $default; }
php
public function get_data($field = null, $default = null) { if($field === null) return $this->data; return array_key_exists($field, $this->data) ? $this->data[$field] : $default; }
[ "public", "function", "get_data", "(", "$", "field", "=", "null", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "field", "===", "null", ")", "return", "$", "this", "->", "data", ";", "return", "array_key_exists", "(", "$", "field", ",", "$", "this", "->", "data", ")", "?", "$", "this", "->", "data", "[", "$", "field", "]", ":", "$", "default", ";", "}" ]
Return validated data @param string Return just a single field @param mixed Default value @return array Field data
[ "Return", "validated", "data" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Validator.php#L147-L150
226,832
Dachande663/PHP-Validation
src/HybridLogic/Validation/Validator.php
Validator.apply_filters
protected function apply_filters(array $data) { if(empty($this->filters)) return $data; foreach($this->filters as $field => $filters) { if(!isset($data[$field])) continue; $value = $data[$field]; foreach($filters as $filter) { $value = call_user_func($filter, $value); } $data[$field] = $value; } return $data; }
php
protected function apply_filters(array $data) { if(empty($this->filters)) return $data; foreach($this->filters as $field => $filters) { if(!isset($data[$field])) continue; $value = $data[$field]; foreach($filters as $filter) { $value = call_user_func($filter, $value); } $data[$field] = $value; } return $data; }
[ "protected", "function", "apply_filters", "(", "array", "$", "data", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "filters", ")", ")", "return", "$", "data", ";", "foreach", "(", "$", "this", "->", "filters", "as", "$", "field", "=>", "$", "filters", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "$", "field", "]", ")", ")", "continue", ";", "$", "value", "=", "$", "data", "[", "$", "field", "]", ";", "foreach", "(", "$", "filters", "as", "$", "filter", ")", "{", "$", "value", "=", "call_user_func", "(", "$", "filter", ",", "$", "value", ")", ";", "}", "$", "data", "[", "$", "field", "]", "=", "$", "value", ";", "}", "return", "$", "data", ";", "}" ]
Apply any defined filters @param array Input data @return array Filtered data
[ "Apply", "any", "defined", "filters" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Validator.php#L237-L257
226,833
CoopBelvedere/laravel-basecamp-api
src/Models/Campfire.php
Campfire.lines
public function lines($nextPage = null) { return Basecamp::campfires($this->bucket->id, $this->id) ->lines($nextPage); }
php
public function lines($nextPage = null) { return Basecamp::campfires($this->bucket->id, $this->id) ->lines($nextPage); }
[ "public", "function", "lines", "(", "$", "nextPage", "=", "null", ")", "{", "return", "Basecamp", "::", "campfires", "(", "$", "this", "->", "bucket", "->", "id", ",", "$", "this", "->", "id", ")", "->", "lines", "(", "$", "nextPage", ")", ";", "}" ]
Get a Campfire lines. @param string $nextPage @return \Illuminate\Http\Collection
[ "Get", "a", "Campfire", "lines", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Campfire.php#L25-L29
226,834
CoopBelvedere/laravel-basecamp-api
src/Models/Campfire.php
Campfire.line
public function line($id) { return Basecamp::campfires($this->bucket->id, $this->id)->line($id); }
php
public function line($id) { return Basecamp::campfires($this->bucket->id, $this->id)->line($id); }
[ "public", "function", "line", "(", "$", "id", ")", "{", "return", "Basecamp", "::", "campfires", "(", "$", "this", "->", "bucket", "->", "id", ",", "$", "this", "->", "id", ")", "->", "line", "(", "$", "id", ")", ";", "}" ]
Get a single campfire lines. @param int $id @return \Illuminate\Http\Collection
[ "Get", "a", "single", "campfire", "lines", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Campfire.php#L37-L40
226,835
CoopBelvedere/laravel-basecamp-api
src/Models/Campfire.php
Campfire.storeLine
public function storeLine($content) { return Basecamp::campfires($this->bucket->id, $this->id) ->storeLine($content); }
php
public function storeLine($content) { return Basecamp::campfires($this->bucket->id, $this->id) ->storeLine($content); }
[ "public", "function", "storeLine", "(", "$", "content", ")", "{", "return", "Basecamp", "::", "campfires", "(", "$", "this", "->", "bucket", "->", "id", ",", "$", "this", "->", "id", ")", "->", "storeLine", "(", "$", "content", ")", ";", "}" ]
Add a campfire line. @param string $content @return \Illuminate\Http\Collection
[ "Add", "a", "campfire", "line", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Campfire.php#L48-L52
226,836
PurpleBooth/htmlstrip
src/PurpleBooth/Parser.php
Parser.startElement
public function startElement($parser, $name, $attrs) { $this->blockBegin($name, $attrs); switch ($name) { case 'LI': $this->appendBlockText('* '); break; } }
php
public function startElement($parser, $name, $attrs) { $this->blockBegin($name, $attrs); switch ($name) { case 'LI': $this->appendBlockText('* '); break; } }
[ "public", "function", "startElement", "(", "$", "parser", ",", "$", "name", ",", "$", "attrs", ")", "{", "$", "this", "->", "blockBegin", "(", "$", "name", ",", "$", "attrs", ")", ";", "switch", "(", "$", "name", ")", "{", "case", "'LI'", ":", "$", "this", "->", "appendBlockText", "(", "'* '", ")", ";", "break", ";", "}", "}" ]
Function called on the start of an element. Mostly used to prepend text to things, like the "*"s on LIs @see xml_set_element_handler() @param resource $parser @param string $name @param array $attrs
[ "Function", "called", "on", "the", "start", "of", "an", "element", "." ]
af2f64fd87df8d3a534d0f362fc3be1754ffb25b
https://github.com/PurpleBooth/htmlstrip/blob/af2f64fd87df8d3a534d0f362fc3be1754ffb25b/src/PurpleBooth/Parser.php#L63-L73
226,837
PurpleBooth/htmlstrip
src/PurpleBooth/Parser.php
Parser.blockBegin
private function blockBegin($name, $attributes) { $this->transformedTextStack->push(''); $this->blockTypeStack->push($name); $this->blockAttributesStack->push($attributes); }
php
private function blockBegin($name, $attributes) { $this->transformedTextStack->push(''); $this->blockTypeStack->push($name); $this->blockAttributesStack->push($attributes); }
[ "private", "function", "blockBegin", "(", "$", "name", ",", "$", "attributes", ")", "{", "$", "this", "->", "transformedTextStack", "->", "push", "(", "''", ")", ";", "$", "this", "->", "blockTypeStack", "->", "push", "(", "$", "name", ")", ";", "$", "this", "->", "blockAttributesStack", "->", "push", "(", "$", "attributes", ")", ";", "}" ]
Called when we begin a block. We build a series of stacks to represent the tree of the document We operate at this level of the stack when we're editing content @param string $name @param array $attributes
[ "Called", "when", "we", "begin", "a", "block", "." ]
af2f64fd87df8d3a534d0f362fc3be1754ffb25b
https://github.com/PurpleBooth/htmlstrip/blob/af2f64fd87df8d3a534d0f362fc3be1754ffb25b/src/PurpleBooth/Parser.php#L85-L90
226,838
PurpleBooth/htmlstrip
src/PurpleBooth/Parser.php
Parser.endElement
public function endElement($parser, $name) { switch ($name) { case 'P': $this->appendBlockText("\n\n"); break; case 'UL': $this->appendBlockText("\n\n"); break; case 'LI': $this->appendBlockText("\n"); break; case 'DIV': $this->appendBlockText("\n\n\n"); break; case 'A': $attrs = $this->blockAttributesStack->top(); if (isset($attrs['HREF'])) { $this->appendBlockText(" ({$attrs['HREF']})"); } } $blockContent = $this->blockFinished(); if (count($this->transformedTextStack)) { $this->appendBlockText($blockContent); } else { $this->text .= $blockContent; } }
php
public function endElement($parser, $name) { switch ($name) { case 'P': $this->appendBlockText("\n\n"); break; case 'UL': $this->appendBlockText("\n\n"); break; case 'LI': $this->appendBlockText("\n"); break; case 'DIV': $this->appendBlockText("\n\n\n"); break; case 'A': $attrs = $this->blockAttributesStack->top(); if (isset($attrs['HREF'])) { $this->appendBlockText(" ({$attrs['HREF']})"); } } $blockContent = $this->blockFinished(); if (count($this->transformedTextStack)) { $this->appendBlockText($blockContent); } else { $this->text .= $blockContent; } }
[ "public", "function", "endElement", "(", "$", "parser", ",", "$", "name", ")", "{", "switch", "(", "$", "name", ")", "{", "case", "'P'", ":", "$", "this", "->", "appendBlockText", "(", "\"\\n\\n\"", ")", ";", "break", ";", "case", "'UL'", ":", "$", "this", "->", "appendBlockText", "(", "\"\\n\\n\"", ")", ";", "break", ";", "case", "'LI'", ":", "$", "this", "->", "appendBlockText", "(", "\"\\n\"", ")", ";", "break", ";", "case", "'DIV'", ":", "$", "this", "->", "appendBlockText", "(", "\"\\n\\n\\n\"", ")", ";", "break", ";", "case", "'A'", ":", "$", "attrs", "=", "$", "this", "->", "blockAttributesStack", "->", "top", "(", ")", ";", "if", "(", "isset", "(", "$", "attrs", "[", "'HREF'", "]", ")", ")", "{", "$", "this", "->", "appendBlockText", "(", "\" ({$attrs['HREF']})\"", ")", ";", "}", "}", "$", "blockContent", "=", "$", "this", "->", "blockFinished", "(", ")", ";", "if", "(", "count", "(", "$", "this", "->", "transformedTextStack", ")", ")", "{", "$", "this", "->", "appendBlockText", "(", "$", "blockContent", ")", ";", "}", "else", "{", "$", "this", "->", "text", ".=", "$", "blockContent", ";", "}", "}" ]
When we reach a closing element do something. This is mostly used to add stuff to the end of a statement, like putting new lines where div tags close @see xml_set_element_handler() @param resource $parser @param string $name
[ "When", "we", "reach", "a", "closing", "element", "do", "something", "." ]
af2f64fd87df8d3a534d0f362fc3be1754ffb25b
https://github.com/PurpleBooth/htmlstrip/blob/af2f64fd87df8d3a534d0f362fc3be1754ffb25b/src/PurpleBooth/Parser.php#L133-L167
226,839
PurpleBooth/htmlstrip
src/PurpleBooth/Parser.php
Parser.blockFinished
private function blockFinished() { $transformedText = $this->transformedTextStack->pop(); $this->blockTypeStack->pop(); $this->blockAttributesStack->pop(); return $transformedText; }
php
private function blockFinished() { $transformedText = $this->transformedTextStack->pop(); $this->blockTypeStack->pop(); $this->blockAttributesStack->pop(); return $transformedText; }
[ "private", "function", "blockFinished", "(", ")", "{", "$", "transformedText", "=", "$", "this", "->", "transformedTextStack", "->", "pop", "(", ")", ";", "$", "this", "->", "blockTypeStack", "->", "pop", "(", ")", ";", "$", "this", "->", "blockAttributesStack", "->", "pop", "(", ")", ";", "return", "$", "transformedText", ";", "}" ]
Get the transformed text off the stack, and clear down the other stacks. @return string
[ "Get", "the", "transformed", "text", "off", "the", "stack", "and", "clear", "down", "the", "other", "stacks", "." ]
af2f64fd87df8d3a534d0f362fc3be1754ffb25b
https://github.com/PurpleBooth/htmlstrip/blob/af2f64fd87df8d3a534d0f362fc3be1754ffb25b/src/PurpleBooth/Parser.php#L174-L181
226,840
PurpleBooth/htmlstrip
src/PurpleBooth/Parser.php
Parser.getText
public function getText() { $text = trim($this->text); $lines = explode("\n", $text); return implode("\n", array_map('trim', $lines)); }
php
public function getText() { $text = trim($this->text); $lines = explode("\n", $text); return implode("\n", array_map('trim', $lines)); }
[ "public", "function", "getText", "(", ")", "{", "$", "text", "=", "trim", "(", "$", "this", "->", "text", ")", ";", "$", "lines", "=", "explode", "(", "\"\\n\"", ",", "$", "text", ")", ";", "return", "implode", "(", "\"\\n\"", ",", "array_map", "(", "'trim'", ",", "$", "lines", ")", ")", ";", "}" ]
This gets the text that has been parsed and returns it. @return string
[ "This", "gets", "the", "text", "that", "has", "been", "parsed", "and", "returns", "it", "." ]
af2f64fd87df8d3a534d0f362fc3be1754ffb25b
https://github.com/PurpleBooth/htmlstrip/blob/af2f64fd87df8d3a534d0f362fc3be1754ffb25b/src/PurpleBooth/Parser.php#L203-L209
226,841
CoopBelvedere/laravel-basecamp-api
src/Models/Webhook.php
Webhook.update
public function update(array $data) { $webhook = Basecamp::webhooks($this->bucket->id) ->update($this->id, $data); $this->setAttributes($webhook); return $webhook; }
php
public function update(array $data) { $webhook = Basecamp::webhooks($this->bucket->id) ->update($this->id, $data); $this->setAttributes($webhook); return $webhook; }
[ "public", "function", "update", "(", "array", "$", "data", ")", "{", "$", "webhook", "=", "Basecamp", "::", "webhooks", "(", "$", "this", "->", "bucket", "->", "id", ")", "->", "update", "(", "$", "this", "->", "id", ",", "$", "data", ")", ";", "$", "this", "->", "setAttributes", "(", "$", "webhook", ")", ";", "return", "$", "webhook", ";", "}" ]
Update the webhook. @param array $data @return \Illuminate\Http\Collection
[ "Update", "the", "webhook", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Webhook.php#L15-L23
226,842
CoopBelvedere/laravel-basecamp-api
src/Sections/TodoLists.php
TodoLists.index
public function index($page = null, $status = null) { $url = sprintf('buckets/%d/todosets/%d/todolists.json', $this->bucket, $this->parent); $todolists = $this->client->get($url, [ 'query' => [ 'status' => $status, 'page' => $page, ], ]); return $this->indexResponse($todolists, TodoList::class); }
php
public function index($page = null, $status = null) { $url = sprintf('buckets/%d/todosets/%d/todolists.json', $this->bucket, $this->parent); $todolists = $this->client->get($url, [ 'query' => [ 'status' => $status, 'page' => $page, ], ]); return $this->indexResponse($todolists, TodoList::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ",", "$", "status", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/todosets/%d/todolists.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "todolists", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'status'", "=>", "$", "status", ",", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "todolists", ",", "TodoList", "::", "class", ")", ";", "}" ]
Index all to-do lists. @param int $page @param string $status @return \Illuminate\Support\Collection
[ "Index", "all", "to", "-", "do", "lists", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/TodoLists.php#L16-L28
226,843
CoopBelvedere/laravel-basecamp-api
src/Sections/TodoLists.php
TodoLists.show
public function show($id) { $todolist = $this->client->get( sprintf('buckets/%d/todolists/%d.json', $this->bucket, $id) ); return new TodoList($this->response($todolist)); }
php
public function show($id) { $todolist = $this->client->get( sprintf('buckets/%d/todolists/%d.json', $this->bucket, $id) ); return new TodoList($this->response($todolist)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "todolist", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/todolists/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "TodoList", "(", "$", "this", "->", "response", "(", "$", "todolist", ")", ")", ";", "}" ]
Get a to-do list. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "to", "-", "do", "list", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/TodoLists.php#L58-L65
226,844
CoopBelvedere/laravel-basecamp-api
src/Sections/TodoLists.php
TodoLists.store
public function store(array $data) { $todolist = $this->client->post( sprintf('buckets/%d/todosets/%d/todolists.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new TodoList($this->response($todolist)); }
php
public function store(array $data) { $todolist = $this->client->post( sprintf('buckets/%d/todosets/%d/todolists.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new TodoList($this->response($todolist)); }
[ "public", "function", "store", "(", "array", "$", "data", ")", "{", "$", "todolist", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'buckets/%d/todosets/%d/todolists.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "TodoList", "(", "$", "this", "->", "response", "(", "$", "todolist", ")", ")", ";", "}" ]
Store a to-do list. @param array $data @return \Illuminate\Support\Collection
[ "Store", "a", "to", "-", "do", "list", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/TodoLists.php#L73-L83
226,845
CoopBelvedere/laravel-basecamp-api
src/Sections/TodoLists.php
TodoLists.update
public function update($id, array $data) { $todolist = $this->client->put( sprintf('buckets/%d/todolists/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new TodoList($this->response($todolist)); }
php
public function update($id, array $data) { $todolist = $this->client->put( sprintf('buckets/%d/todolists/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new TodoList($this->response($todolist)); }
[ "public", "function", "update", "(", "$", "id", ",", "array", "$", "data", ")", "{", "$", "todolist", "=", "$", "this", "->", "client", "->", "put", "(", "sprintf", "(", "'buckets/%d/todolists/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "TodoList", "(", "$", "this", "->", "response", "(", "$", "todolist", ")", ")", ";", "}" ]
Update a to-do list. @param int $id @param array $data @return \Illuminate\Support\Collection
[ "Update", "a", "to", "-", "do", "list", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/TodoLists.php#L92-L102
226,846
async-interop/promise
src/Promise/ErrorHandler.php
ErrorHandler.set
public static function set(callable $onError = null) { $previous = self::$callback; self::$callback = $onError; return $previous; }
php
public static function set(callable $onError = null) { $previous = self::$callback; self::$callback = $onError; return $previous; }
[ "public", "static", "function", "set", "(", "callable", "$", "onError", "=", "null", ")", "{", "$", "previous", "=", "self", "::", "$", "callback", ";", "self", "::", "$", "callback", "=", "$", "onError", ";", "return", "$", "previous", ";", "}" ]
Set a new handler that will be notified on uncaught errors during promise resolution callback invocations. This callback can attempt to log the error or exit the execution of the script if it sees need. It receives the exception as first and only parameter. As it's already a last chance handler, the script will be aborted using E_USER_ERROR if the handler throws. Thus it's suggested to always wrap the body of your callback in a generic `try` / `catch` block, if you want to avoid that. @param callable|null $onError Callback to invoke on errors or `null` to reset. @return callable|null Previous callback.
[ "Set", "a", "new", "handler", "that", "will", "be", "notified", "on", "uncaught", "errors", "during", "promise", "resolution", "callback", "invocations", "." ]
645370c29d47ce8da57a504bcfbdd4d8de4d255d
https://github.com/async-interop/promise/blob/645370c29d47ce8da57a504bcfbdd4d8de4d255d/src/Promise/ErrorHandler.php#L39-L44
226,847
async-interop/promise
src/Promise/ErrorHandler.php
ErrorHandler.notify
public static function notify($error) { // No type declaration, because of PHP 5 + PHP 7 support. if (!$error instanceof \Exception && !$error instanceof \Throwable) { // We have this error handler specifically so we never throw from Promise::when(), so it doesn't make sense // to throw here. We just forward a generic exception to the registered handlers. $error = new \Exception(\sprintf( "Promise implementation called %s() with an invalid argument of type '%s'", __METHOD__, \is_object($error) ? \get_class($error) : \gettype($error) )); } if (self::$callback === null) { self::triggerErrorHandler( "An exception has been thrown from an AsyncInterop\\Promise::when() handler, but no handler has been" . " registered via AsyncInterop\\Promise\\ErrorHandler::set(). A handler has to be registered to" . " prevent exceptions from going unnoticed. Do NOT install an empty handler that just does nothing." . " If the handler is called, there is ALWAYS something wrong.", $error ); return; } try { \call_user_func(self::$callback, $error); } catch (\Exception $e) { self::triggerErrorHandler( "An exception has been thrown from the promise error handler registered to" . " AsyncInterop\\Promise\\ErrorHandler::set().", $e ); } catch (\Throwable $e) { self::triggerErrorHandler( "An exception has been thrown from the promise error handler registered to" . " AsyncInterop\\Promise\\ErrorHandler::set().", $e ); } }
php
public static function notify($error) { // No type declaration, because of PHP 5 + PHP 7 support. if (!$error instanceof \Exception && !$error instanceof \Throwable) { // We have this error handler specifically so we never throw from Promise::when(), so it doesn't make sense // to throw here. We just forward a generic exception to the registered handlers. $error = new \Exception(\sprintf( "Promise implementation called %s() with an invalid argument of type '%s'", __METHOD__, \is_object($error) ? \get_class($error) : \gettype($error) )); } if (self::$callback === null) { self::triggerErrorHandler( "An exception has been thrown from an AsyncInterop\\Promise::when() handler, but no handler has been" . " registered via AsyncInterop\\Promise\\ErrorHandler::set(). A handler has to be registered to" . " prevent exceptions from going unnoticed. Do NOT install an empty handler that just does nothing." . " If the handler is called, there is ALWAYS something wrong.", $error ); return; } try { \call_user_func(self::$callback, $error); } catch (\Exception $e) { self::triggerErrorHandler( "An exception has been thrown from the promise error handler registered to" . " AsyncInterop\\Promise\\ErrorHandler::set().", $e ); } catch (\Throwable $e) { self::triggerErrorHandler( "An exception has been thrown from the promise error handler registered to" . " AsyncInterop\\Promise\\ErrorHandler::set().", $e ); } }
[ "public", "static", "function", "notify", "(", "$", "error", ")", "{", "// No type declaration, because of PHP 5 + PHP 7 support.", "if", "(", "!", "$", "error", "instanceof", "\\", "Exception", "&&", "!", "$", "error", "instanceof", "\\", "Throwable", ")", "{", "// We have this error handler specifically so we never throw from Promise::when(), so it doesn't make sense", "// to throw here. We just forward a generic exception to the registered handlers.", "$", "error", "=", "new", "\\", "Exception", "(", "\\", "sprintf", "(", "\"Promise implementation called %s() with an invalid argument of type '%s'\"", ",", "__METHOD__", ",", "\\", "is_object", "(", "$", "error", ")", "?", "\\", "get_class", "(", "$", "error", ")", ":", "\\", "gettype", "(", "$", "error", ")", ")", ")", ";", "}", "if", "(", "self", "::", "$", "callback", "===", "null", ")", "{", "self", "::", "triggerErrorHandler", "(", "\"An exception has been thrown from an AsyncInterop\\\\Promise::when() handler, but no handler has been\"", ".", "\" registered via AsyncInterop\\\\Promise\\\\ErrorHandler::set(). A handler has to be registered to\"", ".", "\" prevent exceptions from going unnoticed. Do NOT install an empty handler that just does nothing.\"", ".", "\" If the handler is called, there is ALWAYS something wrong.\"", ",", "$", "error", ")", ";", "return", ";", "}", "try", "{", "\\", "call_user_func", "(", "self", "::", "$", "callback", ",", "$", "error", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "self", "::", "triggerErrorHandler", "(", "\"An exception has been thrown from the promise error handler registered to\"", ".", "\" AsyncInterop\\\\Promise\\\\ErrorHandler::set().\"", ",", "$", "e", ")", ";", "}", "catch", "(", "\\", "Throwable", "$", "e", ")", "{", "self", "::", "triggerErrorHandler", "(", "\"An exception has been thrown from the promise error handler registered to\"", ".", "\" AsyncInterop\\\\Promise\\\\ErrorHandler::set().\"", ",", "$", "e", ")", ";", "}", "}" ]
Notifies the registered handler, that an exception occurred. This method MUST be called by every promise implementation if a callback passed to `Promise::when()` throws upon invocation. It MUST NOT be called otherwise. @param \Exception|\Throwable $error Exception that occurred.
[ "Notifies", "the", "registered", "handler", "that", "an", "exception", "occurred", "." ]
645370c29d47ce8da57a504bcfbdd4d8de4d255d
https://github.com/async-interop/promise/blob/645370c29d47ce8da57a504bcfbdd4d8de4d255d/src/Promise/ErrorHandler.php#L54-L94
226,848
CoopBelvedere/laravel-basecamp-api
src/Sections/Todos.php
Todos.index
public function index($page = null, $status = null) { $url = sprintf('buckets/%d/todolists/%d/todos.json', $this->bucket, $this->parent); $todos = $this->client->get($url, [ 'query' => [ 'status' => $status, 'page' => $page, ], ]); return $this->indexResponse($todos, Todo::class); }
php
public function index($page = null, $status = null) { $url = sprintf('buckets/%d/todolists/%d/todos.json', $this->bucket, $this->parent); $todos = $this->client->get($url, [ 'query' => [ 'status' => $status, 'page' => $page, ], ]); return $this->indexResponse($todos, Todo::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ",", "$", "status", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/todolists/%d/todos.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "todos", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'status'", "=>", "$", "status", ",", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "todos", ",", "Todo", "::", "class", ")", ";", "}" ]
Index all the to-dos. @param int $page @param string $status @return \Illuminate\Support\Collection
[ "Index", "all", "the", "to", "-", "dos", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Todos.php#L16-L28
226,849
CoopBelvedere/laravel-basecamp-api
src/Sections/Todos.php
Todos.show
public function show($id) { $todo = $this->client->get( sprintf('buckets/%d/todos/%d.json', $this->bucket, $id) ); return new Todo($this->response($todo)); }
php
public function show($id) { $todo = $this->client->get( sprintf('buckets/%d/todos/%d.json', $this->bucket, $id) ); return new Todo($this->response($todo)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "todo", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/todos/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "Todo", "(", "$", "this", "->", "response", "(", "$", "todo", ")", ")", ";", "}" ]
Get a to-do. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "to", "-", "do", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Todos.php#L58-L65
226,850
CoopBelvedere/laravel-basecamp-api
src/Sections/Todos.php
Todos.store
public function store(array $data) { $todo = $this->client->post( sprintf('buckets/%d/todolists/%d/todos.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new Todo($this->response($todo)); }
php
public function store(array $data) { $todo = $this->client->post( sprintf('buckets/%d/todolists/%d/todos.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new Todo($this->response($todo)); }
[ "public", "function", "store", "(", "array", "$", "data", ")", "{", "$", "todo", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'buckets/%d/todolists/%d/todos.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Todo", "(", "$", "this", "->", "response", "(", "$", "todo", ")", ")", ";", "}" ]
Store a to-do. @param array $data @return \Illuminate\Support\Collection
[ "Store", "a", "to", "-", "do", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Todos.php#L73-L83
226,851
CoopBelvedere/laravel-basecamp-api
src/Sections/Todos.php
Todos.update
public function update($id, array $data) { $todo = $this->client->put( sprintf('buckets/%d/todos/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new Todo($this->response($todo)); }
php
public function update($id, array $data) { $todo = $this->client->put( sprintf('buckets/%d/todos/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new Todo($this->response($todo)); }
[ "public", "function", "update", "(", "$", "id", ",", "array", "$", "data", ")", "{", "$", "todo", "=", "$", "this", "->", "client", "->", "put", "(", "sprintf", "(", "'buckets/%d/todos/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Todo", "(", "$", "this", "->", "response", "(", "$", "todo", ")", ")", ";", "}" ]
Update a to-do. @param int $id @param array $data @return \Illuminate\Support\Collection
[ "Update", "a", "to", "-", "do", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Todos.php#L92-L102
226,852
CoopBelvedere/laravel-basecamp-api
src/Sections/Events.php
Events.index
public function index($page = null) { $url = sprintf('buckets/%d/recordings/%d/events.json', $this->bucket, $this->parent); $events = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($events, Event::class); }
php
public function index($page = null) { $url = sprintf('buckets/%d/recordings/%d/events.json', $this->bucket, $this->parent); $events = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($events, Event::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/recordings/%d/events.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "events", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "events", ",", "Event", "::", "class", ")", ";", "}" ]
Index all events. @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "events", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Events.php#L15-L26
226,853
thephpleague/omnipay-pin
src/Message/AbstractRequest.php
AbstractRequest.sendRequest
public function sendRequest($action, $data = null, $method = RequestInterface::POST) { // don't throw exceptions for 4xx errors $this->httpClient->getEventDispatcher()->addListener( 'request.error', function ($event) { if ($event['response']->isClientError()) { $event->stopPropagation(); } } ); // Return the response we get back from Pin Payments return $this->httpClient->createRequest( $method, $this->getEndpoint() . $action, array('Authorization' => 'Basic ' . base64_encode($this->getSecretKey() . ':')), $data )->send(); }
php
public function sendRequest($action, $data = null, $method = RequestInterface::POST) { // don't throw exceptions for 4xx errors $this->httpClient->getEventDispatcher()->addListener( 'request.error', function ($event) { if ($event['response']->isClientError()) { $event->stopPropagation(); } } ); // Return the response we get back from Pin Payments return $this->httpClient->createRequest( $method, $this->getEndpoint() . $action, array('Authorization' => 'Basic ' . base64_encode($this->getSecretKey() . ':')), $data )->send(); }
[ "public", "function", "sendRequest", "(", "$", "action", ",", "$", "data", "=", "null", ",", "$", "method", "=", "RequestInterface", "::", "POST", ")", "{", "// don't throw exceptions for 4xx errors", "$", "this", "->", "httpClient", "->", "getEventDispatcher", "(", ")", "->", "addListener", "(", "'request.error'", ",", "function", "(", "$", "event", ")", "{", "if", "(", "$", "event", "[", "'response'", "]", "->", "isClientError", "(", ")", ")", "{", "$", "event", "->", "stopPropagation", "(", ")", ";", "}", "}", ")", ";", "// Return the response we get back from Pin Payments", "return", "$", "this", "->", "httpClient", "->", "createRequest", "(", "$", "method", ",", "$", "this", "->", "getEndpoint", "(", ")", ".", "$", "action", ",", "array", "(", "'Authorization'", "=>", "'Basic '", ".", "base64_encode", "(", "$", "this", "->", "getSecretKey", "(", ")", ".", "':'", ")", ")", ",", "$", "data", ")", "->", "send", "(", ")", ";", "}" ]
Send a request to the gateway. @param string $action @param array $data @param string $method @return HttpResponse
[ "Send", "a", "request", "to", "the", "gateway", "." ]
5b5403952e22663160341ddb0bc6a998b856c765
https://github.com/thephpleague/omnipay-pin/blob/5b5403952e22663160341ddb0bc6a998b856c765/src/Message/AbstractRequest.php#L122-L141
226,854
Dachande663/PHP-Validation
src/HybridLogic/Validation/Rule/InArray.php
InArray.jquery__get_rule_definition
public function jquery__get_rule_definition() { $keys = $this->match_keys ? array_keys($this->array) : array_values($this->array); $array = array_fill_keys($keys, 1); return array( 'php_inarray' => $array, ); }
php
public function jquery__get_rule_definition() { $keys = $this->match_keys ? array_keys($this->array) : array_values($this->array); $array = array_fill_keys($keys, 1); return array( 'php_inarray' => $array, ); }
[ "public", "function", "jquery__get_rule_definition", "(", ")", "{", "$", "keys", "=", "$", "this", "->", "match_keys", "?", "array_keys", "(", "$", "this", "->", "array", ")", ":", "array_values", "(", "$", "this", "->", "array", ")", ";", "$", "array", "=", "array_fill_keys", "(", "$", "keys", ",", "1", ")", ";", "return", "array", "(", "'php_inarray'", "=>", "$", "array", ",", ")", ";", "}" ]
jQuery Validation rule definition @return array Rule
[ "jQuery", "Validation", "rule", "definition" ]
17be45d5c5c5897e33032c89efa2f6769af5de41
https://github.com/Dachande663/PHP-Validation/blob/17be45d5c5c5897e33032c89efa2f6769af5de41/src/HybridLogic/Validation/Rule/InArray.php#L86-L94
226,855
THECALLR/sdk-php
src/CALLR/API/Client.php
Client.setCustomHeaders
public function setCustomHeaders(array $headers) { foreach ($headers as $k => &$v) { if (strpos($v, ':') === false) { $v = $k.': '.$v; } } $this->headers = $headers; }
php
public function setCustomHeaders(array $headers) { foreach ($headers as $k => &$v) { if (strpos($v, ':') === false) { $v = $k.': '.$v; } } $this->headers = $headers; }
[ "public", "function", "setCustomHeaders", "(", "array", "$", "headers", ")", "{", "foreach", "(", "$", "headers", "as", "$", "k", "=>", "&", "$", "v", ")", "{", "if", "(", "strpos", "(", "$", "v", ",", "':'", ")", "===", "false", ")", "{", "$", "v", "=", "$", "k", ".", "': '", ".", "$", "v", ";", "}", "}", "$", "this", "->", "headers", "=", "$", "headers", ";", "}" ]
Set custom HTTP headers. @param array $headers { @var string $key HTTP header key @var string $value HTTP header value }
[ "Set", "custom", "HTTP", "headers", "." ]
3b6ade63a515dcf993cd2c8812950e39737fd3b9
https://github.com/THECALLR/sdk-php/blob/3b6ade63a515dcf993cd2c8812950e39737fd3b9/src/CALLR/API/Client.php#L72-L80
226,856
nstapelbroek/culpa-laravel-5
src/Database/Schema/Blueprint.php
Blueprint.blameable
public function blameable($fields = array('created', 'updated', 'deleted'), $nullable = false) { if (in_array('created', $fields)) { $this->createdBy($nullable); } if (in_array('updated', $fields)) { $this->updatedBy($nullable); } if (in_array('deleted', $fields)) { $this->deletedBy($nullable); } }
php
public function blameable($fields = array('created', 'updated', 'deleted'), $nullable = false) { if (in_array('created', $fields)) { $this->createdBy($nullable); } if (in_array('updated', $fields)) { $this->updatedBy($nullable); } if (in_array('deleted', $fields)) { $this->deletedBy($nullable); } }
[ "public", "function", "blameable", "(", "$", "fields", "=", "array", "(", "'created'", ",", "'updated'", ",", "'deleted'", ")", ",", "$", "nullable", "=", "false", ")", "{", "if", "(", "in_array", "(", "'created'", ",", "$", "fields", ")", ")", "{", "$", "this", "->", "createdBy", "(", "$", "nullable", ")", ";", "}", "if", "(", "in_array", "(", "'updated'", ",", "$", "fields", ")", ")", "{", "$", "this", "->", "updatedBy", "(", "$", "nullable", ")", ";", "}", "if", "(", "in_array", "(", "'deleted'", ",", "$", "fields", ")", ")", "{", "$", "this", "->", "deletedBy", "(", "$", "nullable", ")", ";", "}", "}" ]
Single method to configure all blameable fields in the table @param array $fields @param bool $nullable determine if the column can be NULL @throws \Exception @see Blueprint::createdBy() @see Blueprint::updatedBy() @see Blueprint::deletedBy()
[ "Single", "method", "to", "configure", "all", "blameable", "fields", "in", "the", "table" ]
1a65af243fa52565c4a76c0446a80540bc5fded2
https://github.com/nstapelbroek/culpa-laravel-5/blob/1a65af243fa52565c4a76c0446a80540bc5fded2/src/Database/Schema/Blueprint.php#L18-L31
226,857
nstapelbroek/culpa-laravel-5
src/Database/Schema/Blueprint.php
Blueprint.createdBy
public function createdBy($nullable = false) { $columnName = Config::get('culpa.default_fields.created'); if (!$columnName) { throw new \Exception('No column for the created field is configured, did you publish the Culpa config?'); } $field = $this->integer($columnName)->unsigned(); if (true === $nullable) { $field->nullable(); } $this->addCulpaForeign($columnName); return $field; }
php
public function createdBy($nullable = false) { $columnName = Config::get('culpa.default_fields.created'); if (!$columnName) { throw new \Exception('No column for the created field is configured, did you publish the Culpa config?'); } $field = $this->integer($columnName)->unsigned(); if (true === $nullable) { $field->nullable(); } $this->addCulpaForeign($columnName); return $field; }
[ "public", "function", "createdBy", "(", "$", "nullable", "=", "false", ")", "{", "$", "columnName", "=", "Config", "::", "get", "(", "'culpa.default_fields.created'", ")", ";", "if", "(", "!", "$", "columnName", ")", "{", "throw", "new", "\\", "Exception", "(", "'No column for the created field is configured, did you publish the Culpa config?'", ")", ";", "}", "$", "field", "=", "$", "this", "->", "integer", "(", "$", "columnName", ")", "->", "unsigned", "(", ")", ";", "if", "(", "true", "===", "$", "nullable", ")", "{", "$", "field", "->", "nullable", "(", ")", ";", "}", "$", "this", "->", "addCulpaForeign", "(", "$", "columnName", ")", ";", "return", "$", "field", ";", "}" ]
Add the blameable creator field @see Illuminate\Database\Schema\Blueprint::integer() @param bool $nullable determine if the column can be NULL @return \Illuminate\Support\Fluent @throws \Exception
[ "Add", "the", "blameable", "creator", "field" ]
1a65af243fa52565c4a76c0446a80540bc5fded2
https://github.com/nstapelbroek/culpa-laravel-5/blob/1a65af243fa52565c4a76c0446a80540bc5fded2/src/Database/Schema/Blueprint.php#L41-L57
226,858
nstapelbroek/culpa-laravel-5
src/Database/Schema/Blueprint.php
Blueprint.addCulpaForeign
protected function addCulpaForeign($columnName) { $foreignTable = Config::get('culpa.users.table'); if ($foreignTable) { $this->foreign($columnName)->references('id')->on($foreignTable); } }
php
protected function addCulpaForeign($columnName) { $foreignTable = Config::get('culpa.users.table'); if ($foreignTable) { $this->foreign($columnName)->references('id')->on($foreignTable); } }
[ "protected", "function", "addCulpaForeign", "(", "$", "columnName", ")", "{", "$", "foreignTable", "=", "Config", "::", "get", "(", "'culpa.users.table'", ")", ";", "if", "(", "$", "foreignTable", ")", "{", "$", "this", "->", "foreign", "(", "$", "columnName", ")", "->", "references", "(", "'id'", ")", "->", "on", "(", "$", "foreignTable", ")", ";", "}", "}" ]
Add a foreign key constraint to the users table Failing to configure a users table in the configuration does not break this method, although you should never neglect the foreign keys, the schema blueprint can function without them. @param $columnName @return void
[ "Add", "a", "foreign", "key", "constraint", "to", "the", "users", "table" ]
1a65af243fa52565c4a76c0446a80540bc5fded2
https://github.com/nstapelbroek/culpa-laravel-5/blob/1a65af243fa52565c4a76c0446a80540bc5fded2/src/Database/Schema/Blueprint.php#L119-L125
226,859
CoopBelvedere/laravel-basecamp-api
src/Sections/AbstractSection.php
AbstractSection.indexResponse
public function indexResponse($response, $class) { $resources = $this->response($response); $collection = (new IndexCollection($resources))->map( function($resource) use ($class) { return new $class($resource); } ); $link = $response->getHeader('Link')[0] ?? null; $total = $response->getHeader('X-Total-Count')[0] ?? null; $collection->setPagination($this->getPageNumber($link), (int) $total); return $collection; }
php
public function indexResponse($response, $class) { $resources = $this->response($response); $collection = (new IndexCollection($resources))->map( function($resource) use ($class) { return new $class($resource); } ); $link = $response->getHeader('Link')[0] ?? null; $total = $response->getHeader('X-Total-Count')[0] ?? null; $collection->setPagination($this->getPageNumber($link), (int) $total); return $collection; }
[ "public", "function", "indexResponse", "(", "$", "response", ",", "$", "class", ")", "{", "$", "resources", "=", "$", "this", "->", "response", "(", "$", "response", ")", ";", "$", "collection", "=", "(", "new", "IndexCollection", "(", "$", "resources", ")", ")", "->", "map", "(", "function", "(", "$", "resource", ")", "use", "(", "$", "class", ")", "{", "return", "new", "$", "class", "(", "$", "resource", ")", ";", "}", ")", ";", "$", "link", "=", "$", "response", "->", "getHeader", "(", "'Link'", ")", "[", "0", "]", "??", "null", ";", "$", "total", "=", "$", "response", "->", "getHeader", "(", "'X-Total-Count'", ")", "[", "0", "]", "??", "null", ";", "$", "collection", "->", "setPagination", "(", "$", "this", "->", "getPageNumber", "(", "$", "link", ")", ",", "(", "int", ")", "$", "total", ")", ";", "return", "$", "collection", ";", "}" ]
Return an index response with pagination. @param \GuzzleHttp\Psr7\Response $response @param string $class @return \Illuminate\Support\Collection
[ "Return", "an", "index", "response", "with", "pagination", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/AbstractSection.php#L63-L79
226,860
CoopBelvedere/laravel-basecamp-api
src/Sections/AbstractSection.php
AbstractSection.getPageNumber
protected function getPageNumber($link) { if ($link) { $url = str_replace( 'rel="next"', '', preg_replace('/[<>;\ ]/', '', $link) ); parse_str(parse_url($url, PHP_URL_QUERY), $output); return (int) $output['page']; } return null; }
php
protected function getPageNumber($link) { if ($link) { $url = str_replace( 'rel="next"', '', preg_replace('/[<>;\ ]/', '', $link) ); parse_str(parse_url($url, PHP_URL_QUERY), $output); return (int) $output['page']; } return null; }
[ "protected", "function", "getPageNumber", "(", "$", "link", ")", "{", "if", "(", "$", "link", ")", "{", "$", "url", "=", "str_replace", "(", "'rel=\"next\"'", ",", "''", ",", "preg_replace", "(", "'/[<>;\\ ]/'", ",", "''", ",", "$", "link", ")", ")", ";", "parse_str", "(", "parse_url", "(", "$", "url", ",", "PHP_URL_QUERY", ")", ",", "$", "output", ")", ";", "return", "(", "int", ")", "$", "output", "[", "'page'", "]", ";", "}", "return", "null", ";", "}" ]
Format the link request header. @param string $link @return string
[ "Format", "the", "link", "request", "header", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/AbstractSection.php#L87-L99
226,861
CoopBelvedere/laravel-basecamp-api
src/Sections/Questions.php
Questions.index
public function index($page = null) { $url = sprintf('buckets/%d/questionnaires/%d/questions.json', $this->bucket, $this->parent); $questions = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($questions, Question::class); }
php
public function index($page = null) { $url = sprintf('buckets/%d/questionnaires/%d/questions.json', $this->bucket, $this->parent); $questions = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($questions, Question::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/questionnaires/%d/questions.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "questions", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "questions", ",", "Question", "::", "class", ")", ";", "}" ]
Index all the questions. @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "the", "questions", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Questions.php#L15-L26
226,862
CoopBelvedere/laravel-basecamp-api
src/Sections/Questions.php
Questions.show
public function show($id) { $question = $this->client->get( sprintf('buckets/%d/questions/%d.json', $this->bucket, $id) ); return new Question($this->response($question)); }
php
public function show($id) { $question = $this->client->get( sprintf('buckets/%d/questions/%d.json', $this->bucket, $id) ); return new Question($this->response($question)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "question", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/questions/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "Question", "(", "$", "this", "->", "response", "(", "$", "question", ")", ")", ";", "}" ]
Get a question. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "question", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Questions.php#L34-L41
226,863
CoopBelvedere/laravel-basecamp-api
src/Sections/Recordings.php
Recordings.index
public function index($type, array $parameters = array(), $page = null) { $url = 'projects/recordings.json'; $recordings = $this->client->get($url, [ 'query' => array_merge([ 'type' => $type, 'page' => $page, ], $parameters) ]); return $this->indexResponse($recordings, Recording::class); }
php
public function index($type, array $parameters = array(), $page = null) { $url = 'projects/recordings.json'; $recordings = $this->client->get($url, [ 'query' => array_merge([ 'type' => $type, 'page' => $page, ], $parameters) ]); return $this->indexResponse($recordings, Recording::class); }
[ "public", "function", "index", "(", "$", "type", ",", "array", "$", "parameters", "=", "array", "(", ")", ",", "$", "page", "=", "null", ")", "{", "$", "url", "=", "'projects/recordings.json'", ";", "$", "recordings", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "array_merge", "(", "[", "'type'", "=>", "$", "type", ",", "'page'", "=>", "$", "page", ",", "]", ",", "$", "parameters", ")", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "recordings", ",", "Recording", "::", "class", ")", ";", "}" ]
Index all recordings. @param string $type @param array $parameters @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "recordings", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Recordings.php#L17-L29
226,864
clue/php-shell-react
src/DeferredShell.php
DeferredShell.close
public function close() { $this->ending = true; foreach ($this->pending as $deferred) { $deferred->reject(new RuntimeException('Shell is ending')); } $this->pending = array(); $this->buffer = ''; $this->stream->removeListener('data', array($this, 'handleData')); $this->stream->removeListener('end', array($this, 'handleEnd')); $this->stream->close(); }
php
public function close() { $this->ending = true; foreach ($this->pending as $deferred) { $deferred->reject(new RuntimeException('Shell is ending')); } $this->pending = array(); $this->buffer = ''; $this->stream->removeListener('data', array($this, 'handleData')); $this->stream->removeListener('end', array($this, 'handleEnd')); $this->stream->close(); }
[ "public", "function", "close", "(", ")", "{", "$", "this", "->", "ending", "=", "true", ";", "foreach", "(", "$", "this", "->", "pending", "as", "$", "deferred", ")", "{", "$", "deferred", "->", "reject", "(", "new", "RuntimeException", "(", "'Shell is ending'", ")", ")", ";", "}", "$", "this", "->", "pending", "=", "array", "(", ")", ";", "$", "this", "->", "buffer", "=", "''", ";", "$", "this", "->", "stream", "->", "removeListener", "(", "'data'", ",", "array", "(", "$", "this", ",", "'handleData'", ")", ")", ";", "$", "this", "->", "stream", "->", "removeListener", "(", "'end'", ",", "array", "(", "$", "this", ",", "'handleEnd'", ")", ")", ";", "$", "this", "->", "stream", "->", "close", "(", ")", ";", "}" ]
hard-close the shell now and reject all pending commands @see self::end()
[ "hard", "-", "close", "the", "shell", "now", "and", "reject", "all", "pending", "commands" ]
02cd3c9627176afc429d0c5eda9afaee5fbeb9de
https://github.com/clue/php-shell-react/blob/02cd3c9627176afc429d0c5eda9afaee5fbeb9de/src/DeferredShell.php#L118-L132
226,865
CoopBelvedere/laravel-basecamp-api
src/Models/Chatbot.php
Chatbot.update
public function update(array $data) { $chatbot = Basecamp::chatbots($this->bucket->id, $this->campfire->id) ->update($this->id, $data); $this->setAttributes($chatbot); return $chatbot; }
php
public function update(array $data) { $chatbot = Basecamp::chatbots($this->bucket->id, $this->campfire->id) ->update($this->id, $data); $this->setAttributes($chatbot); return $chatbot; }
[ "public", "function", "update", "(", "array", "$", "data", ")", "{", "$", "chatbot", "=", "Basecamp", "::", "chatbots", "(", "$", "this", "->", "bucket", "->", "id", ",", "$", "this", "->", "campfire", "->", "id", ")", "->", "update", "(", "$", "this", "->", "id", ",", "$", "data", ")", ";", "$", "this", "->", "setAttributes", "(", "$", "chatbot", ")", ";", "return", "$", "chatbot", ";", "}" ]
Update the chatbot. @param array $data @return string
[ "Update", "the", "chatbot", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Chatbot.php#L26-L34
226,866
CoopBelvedere/laravel-basecamp-api
src/Models/Chatbot.php
Chatbot.destroy
public function destroy() { return Basecamp::chatbots($this->bucket->id, $this->campfire->id) ->destroy($this->id); }
php
public function destroy() { return Basecamp::chatbots($this->bucket->id, $this->campfire->id) ->destroy($this->id); }
[ "public", "function", "destroy", "(", ")", "{", "return", "Basecamp", "::", "chatbots", "(", "$", "this", "->", "bucket", "->", "id", ",", "$", "this", "->", "campfire", "->", "id", ")", "->", "destroy", "(", "$", "this", "->", "id", ")", ";", "}" ]
Delete the chatbot. @return string
[ "Delete", "the", "chatbot", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Chatbot.php#L41-L45
226,867
CoopBelvedere/laravel-basecamp-api
src/Models/Project.php
Project.campfire
public function campfire() { $campfire = collect($this->dock)->where('name', 'chat')->first(); $campfire->bucket = $this; return new Campfire($campfire); }
php
public function campfire() { $campfire = collect($this->dock)->where('name', 'chat')->first(); $campfire->bucket = $this; return new Campfire($campfire); }
[ "public", "function", "campfire", "(", ")", "{", "$", "campfire", "=", "collect", "(", "$", "this", "->", "dock", ")", "->", "where", "(", "'name'", ",", "'chat'", ")", "->", "first", "(", ")", ";", "$", "campfire", "->", "bucket", "=", "$", "this", ";", "return", "new", "Campfire", "(", "$", "campfire", ")", ";", "}" ]
Get the project campfire. @return \Illuminate\Http\Collection
[ "Get", "the", "project", "campfire", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Project.php#L14-L19
226,868
CoopBelvedere/laravel-basecamp-api
src/Models/Project.php
Project.messageBoard
public function messageBoard() { $messageBoard = collect($this->dock)->where('name', 'message_board') ->first(); $messageBoard->bucket = $this; return new MessageBoard($messageBoard); }
php
public function messageBoard() { $messageBoard = collect($this->dock)->where('name', 'message_board') ->first(); $messageBoard->bucket = $this; return new MessageBoard($messageBoard); }
[ "public", "function", "messageBoard", "(", ")", "{", "$", "messageBoard", "=", "collect", "(", "$", "this", "->", "dock", ")", "->", "where", "(", "'name'", ",", "'message_board'", ")", "->", "first", "(", ")", ";", "$", "messageBoard", "->", "bucket", "=", "$", "this", ";", "return", "new", "MessageBoard", "(", "$", "messageBoard", ")", ";", "}" ]
Get the project message board. @return \Illuminate\Http\Collection
[ "Get", "the", "project", "message", "board", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Project.php#L26-L32
226,869
CoopBelvedere/laravel-basecamp-api
src/Models/Project.php
Project.todoSet
public function todoSet() { $todos = collect($this->dock)->where('name', 'todoset')->first(); $todos->bucket = $this; return new TodoSet($todos); }
php
public function todoSet() { $todos = collect($this->dock)->where('name', 'todoset')->first(); $todos->bucket = $this; return new TodoSet($todos); }
[ "public", "function", "todoSet", "(", ")", "{", "$", "todos", "=", "collect", "(", "$", "this", "->", "dock", ")", "->", "where", "(", "'name'", ",", "'todoset'", ")", "->", "first", "(", ")", ";", "$", "todos", "->", "bucket", "=", "$", "this", ";", "return", "new", "TodoSet", "(", "$", "todos", ")", ";", "}" ]
Get the project todos. @return \Illuminate\Http\Collection
[ "Get", "the", "project", "todos", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Project.php#L39-L44
226,870
CoopBelvedere/laravel-basecamp-api
src/Models/Project.php
Project.schedule
public function schedule() { $schedule = collect($this->dock)->where('name', 'schedule')->first(); $schedule->bucket = $this; return new Schedule($schedule); }
php
public function schedule() { $schedule = collect($this->dock)->where('name', 'schedule')->first(); $schedule->bucket = $this; return new Schedule($schedule); }
[ "public", "function", "schedule", "(", ")", "{", "$", "schedule", "=", "collect", "(", "$", "this", "->", "dock", ")", "->", "where", "(", "'name'", ",", "'schedule'", ")", "->", "first", "(", ")", ";", "$", "schedule", "->", "bucket", "=", "$", "this", ";", "return", "new", "Schedule", "(", "$", "schedule", ")", ";", "}" ]
Get the project schedule. @return \Illuminate\Http\Collection
[ "Get", "the", "project", "schedule", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Project.php#L51-L56
226,871
CoopBelvedere/laravel-basecamp-api
src/Models/Project.php
Project.questionnaire
public function questionnaire() { $questionnaire = collect($this->dock)->where('name', 'questionnaire') ->first(); $questionnaire->bucket = $this; return new Questionnaire($questionnaire); }
php
public function questionnaire() { $questionnaire = collect($this->dock)->where('name', 'questionnaire') ->first(); $questionnaire->bucket = $this; return new Questionnaire($questionnaire); }
[ "public", "function", "questionnaire", "(", ")", "{", "$", "questionnaire", "=", "collect", "(", "$", "this", "->", "dock", ")", "->", "where", "(", "'name'", ",", "'questionnaire'", ")", "->", "first", "(", ")", ";", "$", "questionnaire", "->", "bucket", "=", "$", "this", ";", "return", "new", "Questionnaire", "(", "$", "questionnaire", ")", ";", "}" ]
Get the project automatic check-ins. @return \Illuminate\Http\Collection
[ "Get", "the", "project", "automatic", "check", "-", "ins", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Project.php#L63-L69
226,872
CoopBelvedere/laravel-basecamp-api
src/Models/Project.php
Project.update
public function update(array $data) { $project = Basecamp::projects()->update($this->id, $data); $this->setAttributes($project); return $project; }
php
public function update(array $data) { $project = Basecamp::projects()->update($this->id, $data); $this->setAttributes($project); return $project; }
[ "public", "function", "update", "(", "array", "$", "data", ")", "{", "$", "project", "=", "Basecamp", "::", "projects", "(", ")", "->", "update", "(", "$", "this", "->", "id", ",", "$", "data", ")", ";", "$", "this", "->", "setAttributes", "(", "$", "project", ")", ";", "return", "$", "project", ";", "}" ]
Update the project. @param array $data @return \Illuminate\Http\Collection
[ "Update", "the", "project", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Project.php#L141-L148
226,873
neilime/zf2-assets-bundle
src/AssetsBundle/Service/Service.php
Service.displayAssets
protected function displayAssets(array $aAssetFiles) { // Retrieve options $oOptions = $this->getOptions(); // Arbitrary last modified time in production $iLastModifiedTime = $oOptions->isProduction() ? $oOptions->getLastModifiedTime() : null; // Use to cache loaded plugins $aRendererPlugins = array(); // Render asset files foreach ($aAssetFiles as $oAssetFile) { if (!($oAssetFile instanceof \AssetsBundle\AssetFile\AssetFile)) { throw new \InvalidArgumentException(sprintf( 'Asset file expects an instance of "AssetsBundle\AssetFile\AssetFile", "%s" given', is_object($oAssetFile) ? get_class($oAssetFile) : gettype($oAssetFile) )); } switch ($sAssetFileType = $oAssetFile->getAssetFileType()) { case \AssetsBundle\AssetFile\AssetFile::ASSET_JS: $oRendererPlugin = isset($aRendererPlugins[$sAssetFileType]) ? $aRendererPlugins[$sAssetFileType] : $aRendererPlugins[$sAssetFileType] = $oOptions->getViewHelperPluginForAssetFileType($sAssetFileType); $oRendererPlugin->appendFile($oOptions->getAssetFileBaseUrl($oAssetFile, $iLastModifiedTime)); break; case \AssetsBundle\AssetFile\AssetFile::ASSET_CSS: $oRendererPlugin = isset($aRendererPlugins[$sAssetFileType]) ? $aRendererPlugins[$sAssetFileType] : $aRendererPlugins[$sAssetFileType] = $oOptions->getViewHelperPluginForAssetFileType($sAssetFileType); $oRendererPlugin->appendStylesheet($oOptions->getAssetFileBaseUrl($oAssetFile, $iLastModifiedTime), 'all'); break; default: throw new \DomainException('Asset\'s type "' . $oAssetFile->getAssetFileType() . '" can not be rendering as asset'); } } return $this; }
php
protected function displayAssets(array $aAssetFiles) { // Retrieve options $oOptions = $this->getOptions(); // Arbitrary last modified time in production $iLastModifiedTime = $oOptions->isProduction() ? $oOptions->getLastModifiedTime() : null; // Use to cache loaded plugins $aRendererPlugins = array(); // Render asset files foreach ($aAssetFiles as $oAssetFile) { if (!($oAssetFile instanceof \AssetsBundle\AssetFile\AssetFile)) { throw new \InvalidArgumentException(sprintf( 'Asset file expects an instance of "AssetsBundle\AssetFile\AssetFile", "%s" given', is_object($oAssetFile) ? get_class($oAssetFile) : gettype($oAssetFile) )); } switch ($sAssetFileType = $oAssetFile->getAssetFileType()) { case \AssetsBundle\AssetFile\AssetFile::ASSET_JS: $oRendererPlugin = isset($aRendererPlugins[$sAssetFileType]) ? $aRendererPlugins[$sAssetFileType] : $aRendererPlugins[$sAssetFileType] = $oOptions->getViewHelperPluginForAssetFileType($sAssetFileType); $oRendererPlugin->appendFile($oOptions->getAssetFileBaseUrl($oAssetFile, $iLastModifiedTime)); break; case \AssetsBundle\AssetFile\AssetFile::ASSET_CSS: $oRendererPlugin = isset($aRendererPlugins[$sAssetFileType]) ? $aRendererPlugins[$sAssetFileType] : $aRendererPlugins[$sAssetFileType] = $oOptions->getViewHelperPluginForAssetFileType($sAssetFileType); $oRendererPlugin->appendStylesheet($oOptions->getAssetFileBaseUrl($oAssetFile, $iLastModifiedTime), 'all'); break; default: throw new \DomainException('Asset\'s type "' . $oAssetFile->getAssetFileType() . '" can not be rendering as asset'); } } return $this; }
[ "protected", "function", "displayAssets", "(", "array", "$", "aAssetFiles", ")", "{", "// Retrieve options", "$", "oOptions", "=", "$", "this", "->", "getOptions", "(", ")", ";", "// Arbitrary last modified time in production", "$", "iLastModifiedTime", "=", "$", "oOptions", "->", "isProduction", "(", ")", "?", "$", "oOptions", "->", "getLastModifiedTime", "(", ")", ":", "null", ";", "// Use to cache loaded plugins", "$", "aRendererPlugins", "=", "array", "(", ")", ";", "// Render asset files", "foreach", "(", "$", "aAssetFiles", "as", "$", "oAssetFile", ")", "{", "if", "(", "!", "(", "$", "oAssetFile", "instanceof", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Asset file expects an instance of \"AssetsBundle\\AssetFile\\AssetFile\", \"%s\" given'", ",", "is_object", "(", "$", "oAssetFile", ")", "?", "get_class", "(", "$", "oAssetFile", ")", ":", "gettype", "(", "$", "oAssetFile", ")", ")", ")", ";", "}", "switch", "(", "$", "sAssetFileType", "=", "$", "oAssetFile", "->", "getAssetFileType", "(", ")", ")", "{", "case", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_JS", ":", "$", "oRendererPlugin", "=", "isset", "(", "$", "aRendererPlugins", "[", "$", "sAssetFileType", "]", ")", "?", "$", "aRendererPlugins", "[", "$", "sAssetFileType", "]", ":", "$", "aRendererPlugins", "[", "$", "sAssetFileType", "]", "=", "$", "oOptions", "->", "getViewHelperPluginForAssetFileType", "(", "$", "sAssetFileType", ")", ";", "$", "oRendererPlugin", "->", "appendFile", "(", "$", "oOptions", "->", "getAssetFileBaseUrl", "(", "$", "oAssetFile", ",", "$", "iLastModifiedTime", ")", ")", ";", "break", ";", "case", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_CSS", ":", "$", "oRendererPlugin", "=", "isset", "(", "$", "aRendererPlugins", "[", "$", "sAssetFileType", "]", ")", "?", "$", "aRendererPlugins", "[", "$", "sAssetFileType", "]", ":", "$", "aRendererPlugins", "[", "$", "sAssetFileType", "]", "=", "$", "oOptions", "->", "getViewHelperPluginForAssetFileType", "(", "$", "sAssetFileType", ")", ";", "$", "oRendererPlugin", "->", "appendStylesheet", "(", "$", "oOptions", "->", "getAssetFileBaseUrl", "(", "$", "oAssetFile", ",", "$", "iLastModifiedTime", ")", ",", "'all'", ")", ";", "break", ";", "default", ":", "throw", "new", "\\", "DomainException", "(", "'Asset\\'s type \"'", ".", "$", "oAssetFile", "->", "getAssetFileType", "(", ")", ".", "'\" can not be rendering as asset'", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Display assets through renderer @param array $aAssetFiles @return \AssetsBundle\Service\Service @throws \InvalidArgumentException @throws \DomainException
[ "Display", "assets", "through", "renderer" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/Service/Service.php#L149-L183
226,874
neilime/zf2-assets-bundle
src/AssetsBundle/Service/Service.php
Service.consoleError
public function consoleError(\Zend\Mvc\MvcEvent $oEvent) { if (($oRequest = $oEvent->getRequest()) instanceof \Zend\Console\Request && $oRequest->getParam('controller') === 'AssetsBundle\Controller\Tools' ) { $oConsole = $oEvent->getApplication()->getServiceManager()->get('console'); $oConsole->writeLine(PHP_EOL . '======================================================================', \Zend\Console\ColorInterface::GRAY); $oConsole->writeLine('An error occured', \Zend\Console\ColorInterface::RED); $oConsole->writeLine('======================================================================', \Zend\Console\ColorInterface::GRAY); if (!($oException = $oEvent->getParam('exception')) instanceof \Exception) { $oException = new \RuntimeException($oEvent->getError()); } $oConsole->writeLine($oException . PHP_EOL); } }
php
public function consoleError(\Zend\Mvc\MvcEvent $oEvent) { if (($oRequest = $oEvent->getRequest()) instanceof \Zend\Console\Request && $oRequest->getParam('controller') === 'AssetsBundle\Controller\Tools' ) { $oConsole = $oEvent->getApplication()->getServiceManager()->get('console'); $oConsole->writeLine(PHP_EOL . '======================================================================', \Zend\Console\ColorInterface::GRAY); $oConsole->writeLine('An error occured', \Zend\Console\ColorInterface::RED); $oConsole->writeLine('======================================================================', \Zend\Console\ColorInterface::GRAY); if (!($oException = $oEvent->getParam('exception')) instanceof \Exception) { $oException = new \RuntimeException($oEvent->getError()); } $oConsole->writeLine($oException . PHP_EOL); } }
[ "public", "function", "consoleError", "(", "\\", "Zend", "\\", "Mvc", "\\", "MvcEvent", "$", "oEvent", ")", "{", "if", "(", "(", "$", "oRequest", "=", "$", "oEvent", "->", "getRequest", "(", ")", ")", "instanceof", "\\", "Zend", "\\", "Console", "\\", "Request", "&&", "$", "oRequest", "->", "getParam", "(", "'controller'", ")", "===", "'AssetsBundle\\Controller\\Tools'", ")", "{", "$", "oConsole", "=", "$", "oEvent", "->", "getApplication", "(", ")", "->", "getServiceManager", "(", ")", "->", "get", "(", "'console'", ")", ";", "$", "oConsole", "->", "writeLine", "(", "PHP_EOL", ".", "'======================================================================'", ",", "\\", "Zend", "\\", "Console", "\\", "ColorInterface", "::", "GRAY", ")", ";", "$", "oConsole", "->", "writeLine", "(", "'An error occured'", ",", "\\", "Zend", "\\", "Console", "\\", "ColorInterface", "::", "RED", ")", ";", "$", "oConsole", "->", "writeLine", "(", "'======================================================================'", ",", "\\", "Zend", "\\", "Console", "\\", "ColorInterface", "::", "GRAY", ")", ";", "if", "(", "!", "(", "$", "oException", "=", "$", "oEvent", "->", "getParam", "(", "'exception'", ")", ")", "instanceof", "\\", "Exception", ")", "{", "$", "oException", "=", "new", "\\", "RuntimeException", "(", "$", "oEvent", "->", "getError", "(", ")", ")", ";", "}", "$", "oConsole", "->", "writeLine", "(", "$", "oException", ".", "PHP_EOL", ")", ";", "}", "}" ]
Display errors to the console, if an error appends during a ToolsController action @param \Zend\Mvc\MvcEvent $oEvent
[ "Display", "errors", "to", "the", "console", "if", "an", "error", "appends", "during", "a", "ToolsController", "action" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/Service/Service.php#L190-L204
226,875
CoopBelvedere/laravel-basecamp-api
src/Models/Upload.php
Upload.update
public function update(array $data) { $upload = Basecamp::uploads($this->bucket->id) ->update($this->id, $data); $this->setAttributes($upload); return $upload; }
php
public function update(array $data) { $upload = Basecamp::uploads($this->bucket->id) ->update($this->id, $data); $this->setAttributes($upload); return $upload; }
[ "public", "function", "update", "(", "array", "$", "data", ")", "{", "$", "upload", "=", "Basecamp", "::", "uploads", "(", "$", "this", "->", "bucket", "->", "id", ")", "->", "update", "(", "$", "this", "->", "id", ",", "$", "data", ")", ";", "$", "this", "->", "setAttributes", "(", "$", "upload", ")", ";", "return", "$", "upload", ";", "}" ]
Update the upload. @param array $data @return \Illuminate\Http\Collection
[ "Update", "the", "upload", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Upload.php#L17-L25
226,876
CoopBelvedere/laravel-basecamp-api
src/Sections/ClientCorrespondences.php
ClientCorrespondences.index
public function index($page = null) { $url = sprintf('buckets/%d/client/correspondences.json', $this->bucket); $correspondences = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($correspondences, ClientCorrespondence::class); }
php
public function index($page = null) { $url = sprintf('buckets/%d/client/correspondences.json', $this->bucket); $correspondences = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->indexResponse($correspondences, ClientCorrespondence::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/client/correspondences.json'", ",", "$", "this", "->", "bucket", ")", ";", "$", "correspondences", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "correspondences", ",", "ClientCorrespondence", "::", "class", ")", ";", "}" ]
Index all correspondences. @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "correspondences", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/ClientCorrespondences.php#L15-L26
226,877
CoopBelvedere/laravel-basecamp-api
src/Sections/ClientCorrespondences.php
ClientCorrespondences.show
public function show($id) { $correspondence = $this->client->get( sprintf('buckets/%d/client/correspondences/%d.json', $this->bucket, $id) ); return new ClientCorrespondence($this->response($correspondence)); }
php
public function show($id) { $correspondence = $this->client->get( sprintf('buckets/%d/client/correspondences/%d.json', $this->bucket, $id) ); return new ClientCorrespondence($this->response($correspondence)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "correspondence", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/client/correspondences/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "ClientCorrespondence", "(", "$", "this", "->", "response", "(", "$", "correspondence", ")", ")", ";", "}" ]
Get a client correspondence. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "client", "correspondence", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/ClientCorrespondences.php#L34-L41
226,878
CoopBelvedere/laravel-basecamp-api
src/Models/Template.php
Template.update
public function update(array $data) { $template = Basecamp::templates()->update($this->id, $data); $this->setAttributes($template); return $template; }
php
public function update(array $data) { $template = Basecamp::templates()->update($this->id, $data); $this->setAttributes($template); return $template; }
[ "public", "function", "update", "(", "array", "$", "data", ")", "{", "$", "template", "=", "Basecamp", "::", "templates", "(", ")", "->", "update", "(", "$", "this", "->", "id", ",", "$", "data", ")", ";", "$", "this", "->", "setAttributes", "(", "$", "template", ")", ";", "return", "$", "template", ";", "}" ]
Update the template. @param array $data @return \Illuminate\Http\Collection
[ "Update", "the", "template", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/Template.php#L14-L21
226,879
OXID-eSales/oxideshop-doctrine-migration-wrapper
src/Migrations.php
Migrations.execute
public function execute($command, $edition = null) { $migrationPaths = $this->getMigrationPaths($edition); foreach ($migrationPaths as $migrationEdition => $migrationPath) { $doctrineApplication = $this->doctrineApplicationBuilder->build(); $input = $this->formDoctrineInput($command, $migrationPath, $this->dbFilePath); if ($this->shouldRunCommand($command, $migrationPath)) { $errorCode = $doctrineApplication->run($input, $this->output); if ($errorCode) { return $errorCode; } } } return 0; }
php
public function execute($command, $edition = null) { $migrationPaths = $this->getMigrationPaths($edition); foreach ($migrationPaths as $migrationEdition => $migrationPath) { $doctrineApplication = $this->doctrineApplicationBuilder->build(); $input = $this->formDoctrineInput($command, $migrationPath, $this->dbFilePath); if ($this->shouldRunCommand($command, $migrationPath)) { $errorCode = $doctrineApplication->run($input, $this->output); if ($errorCode) { return $errorCode; } } } return 0; }
[ "public", "function", "execute", "(", "$", "command", ",", "$", "edition", "=", "null", ")", "{", "$", "migrationPaths", "=", "$", "this", "->", "getMigrationPaths", "(", "$", "edition", ")", ";", "foreach", "(", "$", "migrationPaths", "as", "$", "migrationEdition", "=>", "$", "migrationPath", ")", "{", "$", "doctrineApplication", "=", "$", "this", "->", "doctrineApplicationBuilder", "->", "build", "(", ")", ";", "$", "input", "=", "$", "this", "->", "formDoctrineInput", "(", "$", "command", ",", "$", "migrationPath", ",", "$", "this", "->", "dbFilePath", ")", ";", "if", "(", "$", "this", "->", "shouldRunCommand", "(", "$", "command", ",", "$", "migrationPath", ")", ")", "{", "$", "errorCode", "=", "$", "doctrineApplication", "->", "run", "(", "$", "input", ",", "$", "this", "->", "output", ")", ";", "if", "(", "$", "errorCode", ")", "{", "return", "$", "errorCode", ";", "}", "}", "}", "return", "0", ";", "}" ]
Execute Doctrine Migration command for all needed Shop edition and project. If Doctrine returns an error code breaks and return it. @param string $command Doctrine Migration command to run. @param string $edition Possibility to run migration only against one edition. @return int error code if one exist or 0 for success
[ "Execute", "Doctrine", "Migration", "command", "for", "all", "needed", "Shop", "edition", "and", "project", ".", "If", "Doctrine", "returns", "an", "error", "code", "breaks", "and", "return", "it", "." ]
abf24ece893cb2327e4836c5779d508beb034f3b
https://github.com/OXID-eSales/oxideshop-doctrine-migration-wrapper/blob/abf24ece893cb2327e4836c5779d508beb034f3b/src/Migrations.php#L85-L104
226,880
OXID-eSales/oxideshop-doctrine-migration-wrapper
src/Migrations.php
Migrations.formDoctrineInput
private function formDoctrineInput($command, $migrationPath, $dbFilePath) { $input = new ArrayInput([ '--configuration' => $migrationPath, '--db-configuration' => $dbFilePath, '-n' => true, 'command' => $command ]); return $input; }
php
private function formDoctrineInput($command, $migrationPath, $dbFilePath) { $input = new ArrayInput([ '--configuration' => $migrationPath, '--db-configuration' => $dbFilePath, '-n' => true, 'command' => $command ]); return $input; }
[ "private", "function", "formDoctrineInput", "(", "$", "command", ",", "$", "migrationPath", ",", "$", "dbFilePath", ")", "{", "$", "input", "=", "new", "ArrayInput", "(", "[", "'--configuration'", "=>", "$", "migrationPath", ",", "'--db-configuration'", "=>", "$", "dbFilePath", ",", "'-n'", "=>", "true", ",", "'command'", "=>", "$", "command", "]", ")", ";", "return", "$", "input", ";", "}" ]
Form input which is expected by Doctrine. @param string $command command to run. @param string $migrationPath path to migration configuration file. @param string $dbFilePath path to database configuration file. @return ArrayInput
[ "Form", "input", "which", "is", "expected", "by", "Doctrine", "." ]
abf24ece893cb2327e4836c5779d508beb034f3b
https://github.com/OXID-eSales/oxideshop-doctrine-migration-wrapper/blob/abf24ece893cb2327e4836c5779d508beb034f3b/src/Migrations.php#L115-L124
226,881
OXID-eSales/oxideshop-doctrine-migration-wrapper
src/Migrations.php
Migrations.getMigrationPaths
private function getMigrationPaths($edition = null) { $allMigrationPaths = $this->facts->getMigrationPaths(); if (is_null($edition)) { return $allMigrationPaths; } $migrationPaths = []; foreach ($allMigrationPaths as $migrationEdition => $migrationPath) { if (strtolower($migrationEdition) === strtolower($edition)) { $migrationPaths[$migrationEdition] = $migrationPath; break; } } return $migrationPaths; }
php
private function getMigrationPaths($edition = null) { $allMigrationPaths = $this->facts->getMigrationPaths(); if (is_null($edition)) { return $allMigrationPaths; } $migrationPaths = []; foreach ($allMigrationPaths as $migrationEdition => $migrationPath) { if (strtolower($migrationEdition) === strtolower($edition)) { $migrationPaths[$migrationEdition] = $migrationPath; break; } } return $migrationPaths; }
[ "private", "function", "getMigrationPaths", "(", "$", "edition", "=", "null", ")", "{", "$", "allMigrationPaths", "=", "$", "this", "->", "facts", "->", "getMigrationPaths", "(", ")", ";", "if", "(", "is_null", "(", "$", "edition", ")", ")", "{", "return", "$", "allMigrationPaths", ";", "}", "$", "migrationPaths", "=", "[", "]", ";", "foreach", "(", "$", "allMigrationPaths", "as", "$", "migrationEdition", "=>", "$", "migrationPath", ")", "{", "if", "(", "strtolower", "(", "$", "migrationEdition", ")", "===", "strtolower", "(", "$", "edition", ")", ")", "{", "$", "migrationPaths", "[", "$", "migrationEdition", "]", "=", "$", "migrationPath", ";", "break", ";", "}", "}", "return", "$", "migrationPaths", ";", "}" ]
Filters out only needed migrations. @param string $edition Shop edition. @return array
[ "Filters", "out", "only", "needed", "migrations", "." ]
abf24ece893cb2327e4836c5779d508beb034f3b
https://github.com/OXID-eSales/oxideshop-doctrine-migration-wrapper/blob/abf24ece893cb2327e4836c5779d508beb034f3b/src/Migrations.php#L149-L166
226,882
neilime/zf2-assets-bundle
src/AssetsBundle/AssetFile/AssetFilesConfiguration.php
AssetFilesConfiguration.getAssetFilesPathFromDirectory
protected function getAssetFilesPathFromDirectory($sDirPath, $sAssetType) { if (!is_string($sDirPath) || !($sDirPath = $this->getOptions()->getRealPath($sDirPath)) && !is_dir($sDirPath)) { throw new \InvalidArgumentException('Directory not found : ' . $sDirPath); } if (!\AssetsBundle\AssetFile\AssetFile::assetFileTypeExists($sAssetType)) { throw new \InvalidArgumentException('Asset\'s type is undefined : ' . $sAssetType); } $oDirIterator = new \DirectoryIterator($sDirPath); $aAssets = array(); $bRecursiveSearch = $this->getOptions()->allowsRecursiveSearch(); // Defined expected extensions forthe given type if ($sAssetType === \AssetsBundle\AssetFile\AssetFile::ASSET_MEDIA) { $aExpectedExtensions = $this->getOptions()->getMediaExt(); } else { $aExpectedExtensions = array(\AssetsBundle\AssetFile\AssetFile::getAssetFileDefaultExtension($sAssetType)); } foreach ($oDirIterator as $oFile) { if ($oFile->isFile()) { if (in_array(strtolower(pathinfo($oFile->getFilename(), PATHINFO_EXTENSION)), $aExpectedExtensions, true)) { $aAssets[] = $oFile->getPathname(); } } elseif ($oFile->isDir() && !$oFile->isDot() && $bRecursiveSearch) { $aAssets = array_merge( $aAssets, $this->getAssetFilesPathFromDirectory($oFile->getPathname(), $sAssetType) ); } } return $aAssets; }
php
protected function getAssetFilesPathFromDirectory($sDirPath, $sAssetType) { if (!is_string($sDirPath) || !($sDirPath = $this->getOptions()->getRealPath($sDirPath)) && !is_dir($sDirPath)) { throw new \InvalidArgumentException('Directory not found : ' . $sDirPath); } if (!\AssetsBundle\AssetFile\AssetFile::assetFileTypeExists($sAssetType)) { throw new \InvalidArgumentException('Asset\'s type is undefined : ' . $sAssetType); } $oDirIterator = new \DirectoryIterator($sDirPath); $aAssets = array(); $bRecursiveSearch = $this->getOptions()->allowsRecursiveSearch(); // Defined expected extensions forthe given type if ($sAssetType === \AssetsBundle\AssetFile\AssetFile::ASSET_MEDIA) { $aExpectedExtensions = $this->getOptions()->getMediaExt(); } else { $aExpectedExtensions = array(\AssetsBundle\AssetFile\AssetFile::getAssetFileDefaultExtension($sAssetType)); } foreach ($oDirIterator as $oFile) { if ($oFile->isFile()) { if (in_array(strtolower(pathinfo($oFile->getFilename(), PATHINFO_EXTENSION)), $aExpectedExtensions, true)) { $aAssets[] = $oFile->getPathname(); } } elseif ($oFile->isDir() && !$oFile->isDot() && $bRecursiveSearch) { $aAssets = array_merge( $aAssets, $this->getAssetFilesPathFromDirectory($oFile->getPathname(), $sAssetType) ); } } return $aAssets; }
[ "protected", "function", "getAssetFilesPathFromDirectory", "(", "$", "sDirPath", ",", "$", "sAssetType", ")", "{", "if", "(", "!", "is_string", "(", "$", "sDirPath", ")", "||", "!", "(", "$", "sDirPath", "=", "$", "this", "->", "getOptions", "(", ")", "->", "getRealPath", "(", "$", "sDirPath", ")", ")", "&&", "!", "is_dir", "(", "$", "sDirPath", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Directory not found : '", ".", "$", "sDirPath", ")", ";", "}", "if", "(", "!", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "assetFileTypeExists", "(", "$", "sAssetType", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Asset\\'s type is undefined : '", ".", "$", "sAssetType", ")", ";", "}", "$", "oDirIterator", "=", "new", "\\", "DirectoryIterator", "(", "$", "sDirPath", ")", ";", "$", "aAssets", "=", "array", "(", ")", ";", "$", "bRecursiveSearch", "=", "$", "this", "->", "getOptions", "(", ")", "->", "allowsRecursiveSearch", "(", ")", ";", "// Defined expected extensions forthe given type", "if", "(", "$", "sAssetType", "===", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_MEDIA", ")", "{", "$", "aExpectedExtensions", "=", "$", "this", "->", "getOptions", "(", ")", "->", "getMediaExt", "(", ")", ";", "}", "else", "{", "$", "aExpectedExtensions", "=", "array", "(", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "getAssetFileDefaultExtension", "(", "$", "sAssetType", ")", ")", ";", "}", "foreach", "(", "$", "oDirIterator", "as", "$", "oFile", ")", "{", "if", "(", "$", "oFile", "->", "isFile", "(", ")", ")", "{", "if", "(", "in_array", "(", "strtolower", "(", "pathinfo", "(", "$", "oFile", "->", "getFilename", "(", ")", ",", "PATHINFO_EXTENSION", ")", ")", ",", "$", "aExpectedExtensions", ",", "true", ")", ")", "{", "$", "aAssets", "[", "]", "=", "$", "oFile", "->", "getPathname", "(", ")", ";", "}", "}", "elseif", "(", "$", "oFile", "->", "isDir", "(", ")", "&&", "!", "$", "oFile", "->", "isDot", "(", ")", "&&", "$", "bRecursiveSearch", ")", "{", "$", "aAssets", "=", "array_merge", "(", "$", "aAssets", ",", "$", "this", "->", "getAssetFilesPathFromDirectory", "(", "$", "oFile", "->", "getPathname", "(", ")", ",", "$", "sAssetType", ")", ")", ";", "}", "}", "return", "$", "aAssets", ";", "}" ]
Retrieve assets from a directory @param string $sDirPath @param string $sAssetType @throws \InvalidArgumentException @return array
[ "Retrieve", "assets", "from", "a", "directory" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/AssetFile/AssetFilesConfiguration.php#L204-L236
226,883
neilime/zf2-assets-bundle
src/AssetsBundle/AssetFile/AssetFilesConfiguration.php
AssetFilesConfiguration.getAssetRelativePath
public function getAssetRelativePath($sAssetPath) { if (!($sAssetRealPath = $this->getOptions()->getRealPath($sAssetPath))) { throw new \InvalidArgumentException('File "' . $sAssetPath . '" does not exist'); } //If asset is already a cache file $sCachePath = $this->getOptions()->getCachePath(); return strpos($sAssetRealPath, $sCachePath) !== false ? str_ireplace( array($sCachePath, '.less'), array('', '.css'), $sAssetRealPath ) : ( $this->getOptions()->hasAssetsPath() ? str_ireplace( array($this->getOptions()->getAssetsPath(), getcwd(), DIRECTORY_SEPARATOR), array('', '', '_'), $sAssetRealPath ) : str_ireplace( array(getcwd(), DIRECTORY_SEPARATOR), array('', '_'), $sAssetRealPath ) ); }
php
public function getAssetRelativePath($sAssetPath) { if (!($sAssetRealPath = $this->getOptions()->getRealPath($sAssetPath))) { throw new \InvalidArgumentException('File "' . $sAssetPath . '" does not exist'); } //If asset is already a cache file $sCachePath = $this->getOptions()->getCachePath(); return strpos($sAssetRealPath, $sCachePath) !== false ? str_ireplace( array($sCachePath, '.less'), array('', '.css'), $sAssetRealPath ) : ( $this->getOptions()->hasAssetsPath() ? str_ireplace( array($this->getOptions()->getAssetsPath(), getcwd(), DIRECTORY_SEPARATOR), array('', '', '_'), $sAssetRealPath ) : str_ireplace( array(getcwd(), DIRECTORY_SEPARATOR), array('', '_'), $sAssetRealPath ) ); }
[ "public", "function", "getAssetRelativePath", "(", "$", "sAssetPath", ")", "{", "if", "(", "!", "(", "$", "sAssetRealPath", "=", "$", "this", "->", "getOptions", "(", ")", "->", "getRealPath", "(", "$", "sAssetPath", ")", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'File \"'", ".", "$", "sAssetPath", ".", "'\" does not exist'", ")", ";", "}", "//If asset is already a cache file", "$", "sCachePath", "=", "$", "this", "->", "getOptions", "(", ")", "->", "getCachePath", "(", ")", ";", "return", "strpos", "(", "$", "sAssetRealPath", ",", "$", "sCachePath", ")", "!==", "false", "?", "str_ireplace", "(", "array", "(", "$", "sCachePath", ",", "'.less'", ")", ",", "array", "(", "''", ",", "'.css'", ")", ",", "$", "sAssetRealPath", ")", ":", "(", "$", "this", "->", "getOptions", "(", ")", "->", "hasAssetsPath", "(", ")", "?", "str_ireplace", "(", "array", "(", "$", "this", "->", "getOptions", "(", ")", "->", "getAssetsPath", "(", ")", ",", "getcwd", "(", ")", ",", "DIRECTORY_SEPARATOR", ")", ",", "array", "(", "''", ",", "''", ",", "'_'", ")", ",", "$", "sAssetRealPath", ")", ":", "str_ireplace", "(", "array", "(", "getcwd", "(", ")", ",", "DIRECTORY_SEPARATOR", ")", ",", "array", "(", "''", ",", "'_'", ")", ",", "$", "sAssetRealPath", ")", ")", ";", "}" ]
Retrieve asset relative path @param string $sAssetPath @throws \InvalidArgumentException @return string
[ "Retrieve", "asset", "relative", "path" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/AssetFile/AssetFilesConfiguration.php#L245-L262
226,884
neilime/zf2-assets-bundle
src/AssetsBundle/AssetFile/AssetFilesConfiguration.php
AssetFilesConfiguration.assetsConfigurationHasChanged
public function assetsConfigurationHasChanged(array $aAssetsType = null) { $aAssetsType = $aAssetsType ? array_unique($aAssetsType) : array(\AssetsBundle\AssetFile\AssetFile::ASSET_CSS, \AssetsBundle\AssetFile\AssetFile::ASSET_LESS, \AssetsBundle\AssetFile\AssetFile::ASSET_JS, \AssetsBundle\AssetFile\AssetFile::ASSET_MEDIA); //Retrieve saved onfiguration file if (file_exists($sConfigFilePath = $this->getConfigurationFilePath())) { \Zend\Stdlib\ErrorHandler::start(); $aConfig = include $sConfigFilePath; \Zend\Stdlib\ErrorHandler::stop(true); if ($aConfig === false || !is_array($aConfig)) { throw new \RuntimeException('Unable to get file content from file "' . $sConfigFilePath . '"'); } //Get assets configuration $aAssets = $this->getOptions()->getAssets(); //Check if configuration has changed for each type of asset foreach ($aAssetsType as $sAssetType) { if (!\AssetsBundle\AssetFile\AssetFile::assetFileTypeExists($sAssetType)) { throw new \LogicException('Asset type "' . $sAssetType . '" does not exist'); } if (empty($aAssets[$sAssetType]) && !empty($aConfig[$sAssetType])) { return true; } elseif (!empty($aAssets[$sAssetType])) { if (empty($aConfig[$sAssetType])) { return true; } elseif (array_diff($aAssets[$sAssetType], $aConfig[$sAssetType]) || array_diff($aConfig[$sAssetType], $aAssets[$sAssetType]) ) { return true; } } } return false; } return true; }
php
public function assetsConfigurationHasChanged(array $aAssetsType = null) { $aAssetsType = $aAssetsType ? array_unique($aAssetsType) : array(\AssetsBundle\AssetFile\AssetFile::ASSET_CSS, \AssetsBundle\AssetFile\AssetFile::ASSET_LESS, \AssetsBundle\AssetFile\AssetFile::ASSET_JS, \AssetsBundle\AssetFile\AssetFile::ASSET_MEDIA); //Retrieve saved onfiguration file if (file_exists($sConfigFilePath = $this->getConfigurationFilePath())) { \Zend\Stdlib\ErrorHandler::start(); $aConfig = include $sConfigFilePath; \Zend\Stdlib\ErrorHandler::stop(true); if ($aConfig === false || !is_array($aConfig)) { throw new \RuntimeException('Unable to get file content from file "' . $sConfigFilePath . '"'); } //Get assets configuration $aAssets = $this->getOptions()->getAssets(); //Check if configuration has changed for each type of asset foreach ($aAssetsType as $sAssetType) { if (!\AssetsBundle\AssetFile\AssetFile::assetFileTypeExists($sAssetType)) { throw new \LogicException('Asset type "' . $sAssetType . '" does not exist'); } if (empty($aAssets[$sAssetType]) && !empty($aConfig[$sAssetType])) { return true; } elseif (!empty($aAssets[$sAssetType])) { if (empty($aConfig[$sAssetType])) { return true; } elseif (array_diff($aAssets[$sAssetType], $aConfig[$sAssetType]) || array_diff($aConfig[$sAssetType], $aAssets[$sAssetType]) ) { return true; } } } return false; } return true; }
[ "public", "function", "assetsConfigurationHasChanged", "(", "array", "$", "aAssetsType", "=", "null", ")", "{", "$", "aAssetsType", "=", "$", "aAssetsType", "?", "array_unique", "(", "$", "aAssetsType", ")", ":", "array", "(", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_CSS", ",", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_LESS", ",", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_JS", ",", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "ASSET_MEDIA", ")", ";", "//Retrieve saved onfiguration file", "if", "(", "file_exists", "(", "$", "sConfigFilePath", "=", "$", "this", "->", "getConfigurationFilePath", "(", ")", ")", ")", "{", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "start", "(", ")", ";", "$", "aConfig", "=", "include", "$", "sConfigFilePath", ";", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "stop", "(", "true", ")", ";", "if", "(", "$", "aConfig", "===", "false", "||", "!", "is_array", "(", "$", "aConfig", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Unable to get file content from file \"'", ".", "$", "sConfigFilePath", ".", "'\"'", ")", ";", "}", "//Get assets configuration", "$", "aAssets", "=", "$", "this", "->", "getOptions", "(", ")", "->", "getAssets", "(", ")", ";", "//Check if configuration has changed for each type of asset", "foreach", "(", "$", "aAssetsType", "as", "$", "sAssetType", ")", "{", "if", "(", "!", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFile", "::", "assetFileTypeExists", "(", "$", "sAssetType", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "'Asset type \"'", ".", "$", "sAssetType", ".", "'\" does not exist'", ")", ";", "}", "if", "(", "empty", "(", "$", "aAssets", "[", "$", "sAssetType", "]", ")", "&&", "!", "empty", "(", "$", "aConfig", "[", "$", "sAssetType", "]", ")", ")", "{", "return", "true", ";", "}", "elseif", "(", "!", "empty", "(", "$", "aAssets", "[", "$", "sAssetType", "]", ")", ")", "{", "if", "(", "empty", "(", "$", "aConfig", "[", "$", "sAssetType", "]", ")", ")", "{", "return", "true", ";", "}", "elseif", "(", "array_diff", "(", "$", "aAssets", "[", "$", "sAssetType", "]", ",", "$", "aConfig", "[", "$", "sAssetType", "]", ")", "||", "array_diff", "(", "$", "aConfig", "[", "$", "sAssetType", "]", ",", "$", "aAssets", "[", "$", "sAssetType", "]", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check if assets configuration is the same as last saved configuration @param array $aAssetsType @return boolean @throws \RuntimeException @throws \LogicException
[ "Check", "if", "assets", "configuration", "is", "the", "same", "as", "last", "saved", "configuration" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/AssetFile/AssetFilesConfiguration.php#L272-L308
226,885
neilime/zf2-assets-bundle
src/AssetsBundle/AssetFile/AssetFilesConfiguration.php
AssetFilesConfiguration.saveAssetFilesConfiguration
public function saveAssetFilesConfiguration() { // Retrieve configuration file path $sConfigurationFilePath = $this->getConfigurationFilePath(); $bFileExists = file_exists($sConfigurationFilePath); // Create dir if needed if (!($bFileExists = file_exists($sConfigurationFilePath)) && !is_dir($sConfigurationFileDirPath = dirname($sConfigurationFilePath))) { \Zend\Stdlib\ErrorHandler::start(); mkdir($sConfigurationFileDirPath, $this->getOptions()->getDirectoriesPermissions()); \Zend\Stdlib\ErrorHandler::stop(true); } \Zend\Stdlib\ErrorHandler::start(); file_put_contents($sConfigurationFilePath, '<?php' . PHP_EOL . 'return ' . var_export($this->getOptions()->getAssets(), 1) . ';'); \Zend\Stdlib\ErrorHandler::stop(true); if (!$bFileExists) { \Zend\Stdlib\ErrorHandler::start(); chmod($sConfigurationFilePath, $this->getOptions()->getFilesPermissions()); \Zend\Stdlib\ErrorHandler::stop(true); } return $this; }
php
public function saveAssetFilesConfiguration() { // Retrieve configuration file path $sConfigurationFilePath = $this->getConfigurationFilePath(); $bFileExists = file_exists($sConfigurationFilePath); // Create dir if needed if (!($bFileExists = file_exists($sConfigurationFilePath)) && !is_dir($sConfigurationFileDirPath = dirname($sConfigurationFilePath))) { \Zend\Stdlib\ErrorHandler::start(); mkdir($sConfigurationFileDirPath, $this->getOptions()->getDirectoriesPermissions()); \Zend\Stdlib\ErrorHandler::stop(true); } \Zend\Stdlib\ErrorHandler::start(); file_put_contents($sConfigurationFilePath, '<?php' . PHP_EOL . 'return ' . var_export($this->getOptions()->getAssets(), 1) . ';'); \Zend\Stdlib\ErrorHandler::stop(true); if (!$bFileExists) { \Zend\Stdlib\ErrorHandler::start(); chmod($sConfigurationFilePath, $this->getOptions()->getFilesPermissions()); \Zend\Stdlib\ErrorHandler::stop(true); } return $this; }
[ "public", "function", "saveAssetFilesConfiguration", "(", ")", "{", "// Retrieve configuration file path", "$", "sConfigurationFilePath", "=", "$", "this", "->", "getConfigurationFilePath", "(", ")", ";", "$", "bFileExists", "=", "file_exists", "(", "$", "sConfigurationFilePath", ")", ";", "// Create dir if needed", "if", "(", "!", "(", "$", "bFileExists", "=", "file_exists", "(", "$", "sConfigurationFilePath", ")", ")", "&&", "!", "is_dir", "(", "$", "sConfigurationFileDirPath", "=", "dirname", "(", "$", "sConfigurationFilePath", ")", ")", ")", "{", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "start", "(", ")", ";", "mkdir", "(", "$", "sConfigurationFileDirPath", ",", "$", "this", "->", "getOptions", "(", ")", "->", "getDirectoriesPermissions", "(", ")", ")", ";", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "stop", "(", "true", ")", ";", "}", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "start", "(", ")", ";", "file_put_contents", "(", "$", "sConfigurationFilePath", ",", "'<?php'", ".", "PHP_EOL", ".", "'return '", ".", "var_export", "(", "$", "this", "->", "getOptions", "(", ")", "->", "getAssets", "(", ")", ",", "1", ")", ".", "';'", ")", ";", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "stop", "(", "true", ")", ";", "if", "(", "!", "$", "bFileExists", ")", "{", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "start", "(", ")", ";", "chmod", "(", "$", "sConfigurationFilePath", ",", "$", "this", "->", "getOptions", "(", ")", "->", "getFilesPermissions", "(", ")", ")", ";", "\\", "Zend", "\\", "Stdlib", "\\", "ErrorHandler", "::", "stop", "(", "true", ")", ";", "}", "return", "$", "this", ";", "}" ]
Save current asset configuration into conf file @return \AssetsBundle\AssetFile\AssetFilesConfiguration
[ "Save", "current", "asset", "configuration", "into", "conf", "file" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/AssetFile/AssetFilesConfiguration.php#L325-L349
226,886
CoopBelvedere/laravel-basecamp-api
src/Sections/ClientReplies.php
ClientReplies.index
public function index($page = null) { $url = sprintf('buckets/%d/client/recordings/%d/replies.json', $this->bucket, $this->parent); $replies = $this->client->get($url, [ 'page' => $page, ]); return $this->indexResponse($replies, ClientReply::class); }
php
public function index($page = null) { $url = sprintf('buckets/%d/client/recordings/%d/replies.json', $this->bucket, $this->parent); $replies = $this->client->get($url, [ 'page' => $page, ]); return $this->indexResponse($replies, ClientReply::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/client/recordings/%d/replies.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "replies", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'page'", "=>", "$", "page", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "replies", ",", "ClientReply", "::", "class", ")", ";", "}" ]
Index all client replies. @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "client", "replies", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/ClientReplies.php#L15-L24
226,887
CoopBelvedere/laravel-basecamp-api
src/Sections/ClientReplies.php
ClientReplies.show
public function show($id) { $reply = $this->client->get( sprintf('buckets/%d/client/recordings/%d/replies/%d.json', $this->bucket, $this->parent, $id) ); return new ClientReply($this->response($reply)); }
php
public function show($id) { $reply = $this->client->get( sprintf('buckets/%d/client/recordings/%d/replies/%d.json', $this->bucket, $this->parent, $id) ); return new ClientReply($this->response($reply)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "reply", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/client/recordings/%d/replies/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ",", "$", "id", ")", ")", ";", "return", "new", "ClientReply", "(", "$", "this", "->", "response", "(", "$", "reply", ")", ")", ";", "}" ]
Get a client reply. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "client", "reply", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/ClientReplies.php#L32-L39
226,888
neilime/zf2-assets-bundle
src/AssetsBundle/AssetFile/AssetFileFiltersManager.php
AssetFileFiltersManager.validatePlugin
public function validatePlugin($oAssetFileFilter) { if ($oAssetFileFilter instanceof \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface) { return; } throw new \RuntimeException(sprintf( 'Assets Filter expects an instance of \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface, "%s" given', is_object($oAssetFileFilter) ? get_class($oAssetFileFilter) : (is_scalar($oAssetFileFilter) ? $oAssetFileFilter : gettype($oAssetFileFilter)) )); }
php
public function validatePlugin($oAssetFileFilter) { if ($oAssetFileFilter instanceof \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface) { return; } throw new \RuntimeException(sprintf( 'Assets Filter expects an instance of \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface, "%s" given', is_object($oAssetFileFilter) ? get_class($oAssetFileFilter) : (is_scalar($oAssetFileFilter) ? $oAssetFileFilter : gettype($oAssetFileFilter)) )); }
[ "public", "function", "validatePlugin", "(", "$", "oAssetFileFilter", ")", "{", "if", "(", "$", "oAssetFileFilter", "instanceof", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFileFilter", "\\", "AssetFileFilterInterface", ")", "{", "return", ";", "}", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Assets Filter expects an instance of \\AssetsBundle\\AssetFile\\AssetFileFilter\\AssetFileFilterInterface, \"%s\" given'", ",", "is_object", "(", "$", "oAssetFileFilter", ")", "?", "get_class", "(", "$", "oAssetFileFilter", ")", ":", "(", "is_scalar", "(", "$", "oAssetFileFilter", ")", "?", "$", "oAssetFileFilter", ":", "gettype", "(", "$", "oAssetFileFilter", ")", ")", ")", ")", ";", "}" ]
Validate the plugin. Checks that the filter loaded is an instance of \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface @param mixed $oAssetsFilter @throws \RuntimeException
[ "Validate", "the", "plugin", ".", "Checks", "that", "the", "filter", "loaded", "is", "an", "instance", "of", "\\", "AssetsBundle", "\\", "AssetFile", "\\", "AssetFileFilter", "\\", "AssetFileFilterInterface" ]
6399912d05d37c91be330e7accf3291a2dbdfe49
https://github.com/neilime/zf2-assets-bundle/blob/6399912d05d37c91be330e7accf3291a2dbdfe49/src/AssetsBundle/AssetFile/AssetFileFiltersManager.php#L17-L24
226,889
CoopBelvedere/laravel-basecamp-api
src/Sections/Uploads.php
Uploads.index
public function index($page = null) { $url = sprintf('buckets/%d/vaults/%d/uploads.json', $this->bucket, $this->parent); $uploads = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->response($uploads, Upload::class); }
php
public function index($page = null) { $url = sprintf('buckets/%d/vaults/%d/uploads.json', $this->bucket, $this->parent); $uploads = $this->client->get($url, [ 'query' => [ 'page' => $page, ], ]); return $this->response($uploads, Upload::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'buckets/%d/vaults/%d/uploads.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ";", "$", "uploads", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "response", "(", "$", "uploads", ",", "Upload", "::", "class", ")", ";", "}" ]
Index all the uploads. @param int $page @return \Illuminate\Support\Collection
[ "Index", "all", "the", "uploads", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Uploads.php#L18-L29
226,890
CoopBelvedere/laravel-basecamp-api
src/Sections/Uploads.php
Uploads.show
public function show($id) { $upload = $this->client->get( sprintf('buckets/%d/uploads/%d.json', $this->bucket, $id) ); return new Upload($this->response($upload)); }
php
public function show($id) { $upload = $this->client->get( sprintf('buckets/%d/uploads/%d.json', $this->bucket, $id) ); return new Upload($this->response($upload)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "upload", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'buckets/%d/uploads/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ")", ";", "return", "new", "Upload", "(", "$", "this", "->", "response", "(", "$", "upload", ")", ")", ";", "}" ]
Get an upload. @param int $id @return \Illuminate\Support\Collection
[ "Get", "an", "upload", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Uploads.php#L37-L44
226,891
CoopBelvedere/laravel-basecamp-api
src/Sections/Uploads.php
Uploads.store
public function store(array $data) { $upload = $this->client->post( sprintf('buckets/%d/vaults/%d/uploads.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new Upload($this->response($upload)); }
php
public function store(array $data) { $upload = $this->client->post( sprintf('buckets/%d/vaults/%d/uploads.json', $this->bucket, $this->parent), [ 'json' => $data, ] ); return new Upload($this->response($upload)); }
[ "public", "function", "store", "(", "array", "$", "data", ")", "{", "$", "upload", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'buckets/%d/vaults/%d/uploads.json'", ",", "$", "this", "->", "bucket", ",", "$", "this", "->", "parent", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Upload", "(", "$", "this", "->", "response", "(", "$", "upload", ")", ")", ";", "}" ]
Store an upload. @param array $data @return \Illuminate\Support\Collection
[ "Store", "an", "upload", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Uploads.php#L52-L62
226,892
CoopBelvedere/laravel-basecamp-api
src/Sections/Uploads.php
Uploads.update
public function update($id, array $data) { $upload = $this->client->put( sprintf('buckets/%d/uploads/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new Upload($this->response($upload)); }
php
public function update($id, array $data) { $upload = $this->client->put( sprintf('buckets/%d/uploads/%d.json', $this->bucket, $id), [ 'json' => $data, ] ); return new Upload($this->response($upload)); }
[ "public", "function", "update", "(", "$", "id", ",", "array", "$", "data", ")", "{", "$", "upload", "=", "$", "this", "->", "client", "->", "put", "(", "sprintf", "(", "'buckets/%d/uploads/%d.json'", ",", "$", "this", "->", "bucket", ",", "$", "id", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Upload", "(", "$", "this", "->", "response", "(", "$", "upload", ")", ")", ";", "}" ]
Update an upload. @param int $id @param array $data @return \Illuminate\Support\Collection
[ "Update", "an", "upload", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Uploads.php#L71-L81
226,893
CoopBelvedere/laravel-basecamp-api
src/Models/AbstractModel.php
AbstractModel.inContext
public function inContext($bucket, $parent = null) { $this->bucket = (object) ['id' => $bucket]; if ($parent) $this->parent = (object) ['id' => $parent]; }
php
public function inContext($bucket, $parent = null) { $this->bucket = (object) ['id' => $bucket]; if ($parent) $this->parent = (object) ['id' => $parent]; }
[ "public", "function", "inContext", "(", "$", "bucket", ",", "$", "parent", "=", "null", ")", "{", "$", "this", "->", "bucket", "=", "(", "object", ")", "[", "'id'", "=>", "$", "bucket", "]", ";", "if", "(", "$", "parent", ")", "$", "this", "->", "parent", "=", "(", "object", ")", "[", "'id'", "=>", "$", "parent", "]", ";", "}" ]
Method to add the context if not present. @param int $bucket @param int $parent @return void
[ "Method", "to", "add", "the", "context", "if", "not", "present", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Models/AbstractModel.php#L57-L61
226,894
CoopBelvedere/laravel-basecamp-api
src/Sections/Templates.php
Templates.index
public function index($page = null, $status = null) { $url = 'templates.json'; $templates = $this->client->get($url, [ 'query' => [ 'status' => $status, 'page' => $page, ], ]); return $this->indexResponse($templates, Template::class); }
php
public function index($page = null, $status = null) { $url = 'templates.json'; $templates = $this->client->get($url, [ 'query' => [ 'status' => $status, 'page' => $page, ], ]); return $this->indexResponse($templates, Template::class); }
[ "public", "function", "index", "(", "$", "page", "=", "null", ",", "$", "status", "=", "null", ")", "{", "$", "url", "=", "'templates.json'", ";", "$", "templates", "=", "$", "this", "->", "client", "->", "get", "(", "$", "url", ",", "[", "'query'", "=>", "[", "'status'", "=>", "$", "status", ",", "'page'", "=>", "$", "page", ",", "]", ",", "]", ")", ";", "return", "$", "this", "->", "indexResponse", "(", "$", "templates", ",", "Template", "::", "class", ")", ";", "}" ]
Index all templates. @param int $page @param string $status @return \Illuminate\Support\Collection
[ "Index", "all", "templates", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Templates.php#L16-L28
226,895
CoopBelvedere/laravel-basecamp-api
src/Sections/Templates.php
Templates.show
public function show($id) { $template = $this->client->get(sprintf('templates/%d.json', $id)); return new Template($this->response($template)); }
php
public function show($id) { $template = $this->client->get(sprintf('templates/%d.json', $id)); return new Template($this->response($template)); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "template", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'templates/%d.json'", ",", "$", "id", ")", ")", ";", "return", "new", "Template", "(", "$", "this", "->", "response", "(", "$", "template", ")", ")", ";", "}" ]
Get a template. @param int $id @return \Illuminate\Support\Collection
[ "Get", "a", "template", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Templates.php#L58-L63
226,896
CoopBelvedere/laravel-basecamp-api
src/Sections/Templates.php
Templates.store
public function store($data) { $template = $this->client->post('templates.json', [ 'json' => $data, ]); return new Template($this->response($template)); }
php
public function store($data) { $template = $this->client->post('templates.json', [ 'json' => $data, ]); return new Template($this->response($template)); }
[ "public", "function", "store", "(", "$", "data", ")", "{", "$", "template", "=", "$", "this", "->", "client", "->", "post", "(", "'templates.json'", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Template", "(", "$", "this", "->", "response", "(", "$", "template", ")", ")", ";", "}" ]
Store a template. @param array $data @return \Illuminate\Support\Collection
[ "Store", "a", "template", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Templates.php#L71-L78
226,897
CoopBelvedere/laravel-basecamp-api
src/Sections/Templates.php
Templates.update
public function update($id, $data) { $message = $this->client->put(sprintf('templates/%d.json', $id), [ 'json' => $data, ]); return new Template($this->response($message)); }
php
public function update($id, $data) { $message = $this->client->put(sprintf('templates/%d.json', $id), [ 'json' => $data, ]); return new Template($this->response($message)); }
[ "public", "function", "update", "(", "$", "id", ",", "$", "data", ")", "{", "$", "message", "=", "$", "this", "->", "client", "->", "put", "(", "sprintf", "(", "'templates/%d.json'", ",", "$", "id", ")", ",", "[", "'json'", "=>", "$", "data", ",", "]", ")", ";", "return", "new", "Template", "(", "$", "this", "->", "response", "(", "$", "message", ")", ")", ";", "}" ]
Update a message type. @param int $id @param array $data @return \Illuminate\Support\Collection
[ "Update", "a", "message", "type", "." ]
cc0d6f25dfcbbe5c611642694bb6e4cb84664a82
https://github.com/CoopBelvedere/laravel-basecamp-api/blob/cc0d6f25dfcbbe5c611642694bb6e4cb84664a82/src/Sections/Templates.php#L87-L94
226,898
ASlatius/yii2-nestable
nestable/Nestable.php
Nestable.renderItems
protected function renderItems($_items = NULL) { $_items = is_null($_items) ? $this->items : $_items; $items = ''; $dataid = 0; foreach ($_items as $item) { $options = ArrayHelper::getValue($item, 'options', ['class' => 'dd-item dd3-item']); $options = ArrayHelper::merge($this->itemOptions, $options); $dataId = ArrayHelper::getValue($item, 'id', $dataid++); $options = ArrayHelper::merge($options, ['data-id' => $dataId]); $contentOptions = ArrayHelper::getValue($item, 'contentOptions', ['class' => 'dd3-content']); $content = $this->handleLabel; $content .= Html::tag('div', ArrayHelper::getValue($item, 'content', ''), $contentOptions); $children = ArrayHelper::getValue($item, 'children', []); if (!empty($children)) { // recursive rendering children items $content .= Html::beginTag('ol', ['class' => 'dd-list']); $content .= $this->renderItems($children); $content .= Html::endTag('ol'); } $items .= Html::tag('li', $content, $options) . PHP_EOL; } return $items; }
php
protected function renderItems($_items = NULL) { $_items = is_null($_items) ? $this->items : $_items; $items = ''; $dataid = 0; foreach ($_items as $item) { $options = ArrayHelper::getValue($item, 'options', ['class' => 'dd-item dd3-item']); $options = ArrayHelper::merge($this->itemOptions, $options); $dataId = ArrayHelper::getValue($item, 'id', $dataid++); $options = ArrayHelper::merge($options, ['data-id' => $dataId]); $contentOptions = ArrayHelper::getValue($item, 'contentOptions', ['class' => 'dd3-content']); $content = $this->handleLabel; $content .= Html::tag('div', ArrayHelper::getValue($item, 'content', ''), $contentOptions); $children = ArrayHelper::getValue($item, 'children', []); if (!empty($children)) { // recursive rendering children items $content .= Html::beginTag('ol', ['class' => 'dd-list']); $content .= $this->renderItems($children); $content .= Html::endTag('ol'); } $items .= Html::tag('li', $content, $options) . PHP_EOL; } return $items; }
[ "protected", "function", "renderItems", "(", "$", "_items", "=", "NULL", ")", "{", "$", "_items", "=", "is_null", "(", "$", "_items", ")", "?", "$", "this", "->", "items", ":", "$", "_items", ";", "$", "items", "=", "''", ";", "$", "dataid", "=", "0", ";", "foreach", "(", "$", "_items", "as", "$", "item", ")", "{", "$", "options", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'options'", ",", "[", "'class'", "=>", "'dd-item dd3-item'", "]", ")", ";", "$", "options", "=", "ArrayHelper", "::", "merge", "(", "$", "this", "->", "itemOptions", ",", "$", "options", ")", ";", "$", "dataId", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'id'", ",", "$", "dataid", "++", ")", ";", "$", "options", "=", "ArrayHelper", "::", "merge", "(", "$", "options", ",", "[", "'data-id'", "=>", "$", "dataId", "]", ")", ";", "$", "contentOptions", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'contentOptions'", ",", "[", "'class'", "=>", "'dd3-content'", "]", ")", ";", "$", "content", "=", "$", "this", "->", "handleLabel", ";", "$", "content", ".=", "Html", "::", "tag", "(", "'div'", ",", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'content'", ",", "''", ")", ",", "$", "contentOptions", ")", ";", "$", "children", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'children'", ",", "[", "]", ")", ";", "if", "(", "!", "empty", "(", "$", "children", ")", ")", "{", "// recursive rendering children items", "$", "content", ".=", "Html", "::", "beginTag", "(", "'ol'", ",", "[", "'class'", "=>", "'dd-list'", "]", ")", ";", "$", "content", ".=", "$", "this", "->", "renderItems", "(", "$", "children", ")", ";", "$", "content", ".=", "Html", "::", "endTag", "(", "'ol'", ")", ";", "}", "$", "items", ".=", "Html", "::", "tag", "(", "'li'", ",", "$", "content", ",", "$", "options", ")", ".", "PHP_EOL", ";", "}", "return", "$", "items", ";", "}" ]
Render the list items for the sortable widget @return string
[ "Render", "the", "list", "items", "for", "the", "sortable", "widget" ]
7e40e678013b2fe6c96de99c29a1820fd92f0b8f
https://github.com/ASlatius/yii2-nestable/blob/7e40e678013b2fe6c96de99c29a1820fd92f0b8f/nestable/Nestable.php#L134-L159
226,899
ASlatius/yii2-nestable
nestable/Nestable.php
Nestable.prepareItems
protected function prepareItems($activeQuery) { $items = []; foreach ($activeQuery->all() as $model) { $name = ArrayHelper::getValue($this->modelOptions, 'name', 'name'); $items[] = [ 'id' => $model->getPrimaryKey(), 'content' => (is_callable($name) ? call_user_func($name, $model) : $model->{$name}), 'children' => $this->prepareItems($model->children(1)), ]; } return $items; }
php
protected function prepareItems($activeQuery) { $items = []; foreach ($activeQuery->all() as $model) { $name = ArrayHelper::getValue($this->modelOptions, 'name', 'name'); $items[] = [ 'id' => $model->getPrimaryKey(), 'content' => (is_callable($name) ? call_user_func($name, $model) : $model->{$name}), 'children' => $this->prepareItems($model->children(1)), ]; } return $items; }
[ "protected", "function", "prepareItems", "(", "$", "activeQuery", ")", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "activeQuery", "->", "all", "(", ")", "as", "$", "model", ")", "{", "$", "name", "=", "ArrayHelper", "::", "getValue", "(", "$", "this", "->", "modelOptions", ",", "'name'", ",", "'name'", ")", ";", "$", "items", "[", "]", "=", "[", "'id'", "=>", "$", "model", "->", "getPrimaryKey", "(", ")", ",", "'content'", "=>", "(", "is_callable", "(", "$", "name", ")", "?", "call_user_func", "(", "$", "name", ",", "$", "model", ")", ":", "$", "model", "->", "{", "$", "name", "}", ")", ",", "'children'", "=>", "$", "this", "->", "prepareItems", "(", "$", "model", "->", "children", "(", "1", ")", ")", ",", "]", ";", "}", "return", "$", "items", ";", "}" ]
put your comment there... @param $activeQuery \yii\db\ActiveQuery @return array
[ "put", "your", "comment", "there", "..." ]
7e40e678013b2fe6c96de99c29a1820fd92f0b8f
https://github.com/ASlatius/yii2-nestable/blob/7e40e678013b2fe6c96de99c29a1820fd92f0b8f/nestable/Nestable.php#L184-L196