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
29,500
Innmind/Immutable
src/Str.php
Str.matches
public function matches(string $regex): bool { if (\func_num_args() !== 1) { throw new LogicException('Offset is no longer supported'); } return RegExp::of($regex)->matches($this); }
php
public function matches(string $regex): bool { if (\func_num_args() !== 1) { throw new LogicException('Offset is no longer supported'); } return RegExp::of($regex)->matches($this); }
[ "public", "function", "matches", "(", "string", "$", "regex", ")", ":", "bool", "{", "if", "(", "\\", "func_num_args", "(", ")", "!==", "1", ")", "{", "throw", "new", "LogicException", "(", "'Offset is no longer supported'", ")", ";", "}", "return", "RegEx...
Check if the string match the given regular expression @param string $regex @throws Exception If the regex failed @return bool
[ "Check", "if", "the", "string", "match", "the", "given", "regular", "expression" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L397-L404
29,501
Innmind/Immutable
src/Str.php
Str.pregReplace
public function pregReplace( string $regex, string $replacement, int $limit = -1 ): self { $value = \preg_replace( $regex, $replacement, $this->value, $limit ); if ($value === null) { throw new RegexExceptio...
php
public function pregReplace( string $regex, string $replacement, int $limit = -1 ): self { $value = \preg_replace( $regex, $replacement, $this->value, $limit ); if ($value === null) { throw new RegexExceptio...
[ "public", "function", "pregReplace", "(", "string", "$", "regex", ",", "string", "$", "replacement", ",", "int", "$", "limit", "=", "-", "1", ")", ":", "self", "{", "$", "value", "=", "\\", "preg_replace", "(", "$", "regex", ",", "$", "replacement", ...
Replace part of the string by using a regular expression @param string $regex @param string $replacement @param int $limit @throws Exception If the regex failed @return self
[ "Replace", "part", "of", "the", "string", "by", "using", "a", "regular", "expression" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L456-L473
29,502
Innmind/Immutable
src/Str.php
Str.substring
public function substring(int $start, int $length = null): self { if ($this->length() === 0) { return $this; } $sub = \mb_substr($this->value, $start, $length, (string) $this->encoding()); return new self($sub, $this->encoding); }
php
public function substring(int $start, int $length = null): self { if ($this->length() === 0) { return $this; } $sub = \mb_substr($this->value, $start, $length, (string) $this->encoding()); return new self($sub, $this->encoding); }
[ "public", "function", "substring", "(", "int", "$", "start", ",", "int", "$", "length", "=", "null", ")", ":", "self", "{", "if", "(", "$", "this", "->", "length", "(", ")", "===", "0", ")", "{", "return", "$", "this", ";", "}", "$", "sub", "="...
Return part of the string @param int $start @param int $length @return self
[ "Return", "part", "of", "the", "string" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L483-L492
29,503
Innmind/Immutable
src/Str.php
Str.camelize
public function camelize(): self { return $this ->pregSplit('/_| /') ->map(function(self $part) { return $part->ucfirst(); }) ->join('') ->toEncoding((string) $this->encoding()); }
php
public function camelize(): self { return $this ->pregSplit('/_| /') ->map(function(self $part) { return $part->ucfirst(); }) ->join('') ->toEncoding((string) $this->encoding()); }
[ "public", "function", "camelize", "(", ")", ":", "self", "{", "return", "$", "this", "->", "pregSplit", "(", "'/_| /'", ")", "->", "map", "(", "function", "(", "self", "$", "part", ")", "{", "return", "$", "part", "->", "ucfirst", "(", ")", ";", "}...
Return a CamelCase representation of the string @return self
[ "Return", "a", "CamelCase", "representation", "of", "the", "string" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L555-L564
29,504
Innmind/Immutable
src/Str.php
Str.append
public function append(string $string): self { return new self((string) $this.$string, $this->encoding); }
php
public function append(string $string): self { return new self((string) $this.$string, $this->encoding); }
[ "public", "function", "append", "(", "string", "$", "string", ")", ":", "self", "{", "return", "new", "self", "(", "(", "string", ")", "$", "this", ".", "$", "string", ",", "$", "this", "->", "encoding", ")", ";", "}" ]
Append a string at the end of the current one @param string $string @return self
[ "Append", "a", "string", "at", "the", "end", "of", "the", "current", "one" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L573-L576
29,505
Innmind/Immutable
src/Str.php
Str.prepend
public function prepend(string $string): self { return new self($string.(string) $this, $this->encoding); }
php
public function prepend(string $string): self { return new self($string.(string) $this, $this->encoding); }
[ "public", "function", "prepend", "(", "string", "$", "string", ")", ":", "self", "{", "return", "new", "self", "(", "$", "string", ".", "(", "string", ")", "$", "this", ",", "$", "this", "->", "encoding", ")", ";", "}" ]
Prepend a string at the beginning of the current one @param string $string @return self
[ "Prepend", "a", "string", "at", "the", "beginning", "of", "the", "current", "one" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L585-L588
29,506
Innmind/Immutable
src/Str.php
Str.rightTrim
public function rightTrim(string $mask = null): self { return new self( $mask === null ? \rtrim((string) $this) : \rtrim((string) $this, $mask), $this->encoding ); }
php
public function rightTrim(string $mask = null): self { return new self( $mask === null ? \rtrim((string) $this) : \rtrim((string) $this, $mask), $this->encoding ); }
[ "public", "function", "rightTrim", "(", "string", "$", "mask", "=", "null", ")", ":", "self", "{", "return", "new", "self", "(", "$", "mask", "===", "null", "?", "\\", "rtrim", "(", "(", "string", ")", "$", "this", ")", ":", "\\", "rtrim", "(", "...
Trim the right side of the string @param string $mask @return self
[ "Trim", "the", "right", "side", "of", "the", "string" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L624-L630
29,507
Innmind/Immutable
src/Str.php
Str.leftTrim
public function leftTrim(string $mask = null): self { return new self( $mask === null ? \ltrim((string) $this) : \ltrim((string) $this, $mask), $this->encoding ); }
php
public function leftTrim(string $mask = null): self { return new self( $mask === null ? \ltrim((string) $this) : \ltrim((string) $this, $mask), $this->encoding ); }
[ "public", "function", "leftTrim", "(", "string", "$", "mask", "=", "null", ")", ":", "self", "{", "return", "new", "self", "(", "$", "mask", "===", "null", "?", "\\", "ltrim", "(", "(", "string", ")", "$", "this", ")", ":", "\\", "ltrim", "(", "(...
Trim the left side of the string @param string $mask @return self
[ "Trim", "the", "left", "side", "of", "the", "string" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L639-L645
29,508
Innmind/Immutable
src/Str.php
Str.contains
public function contains(string $value): bool { try { $this->position($value); return true; } catch (SubstringException $e) { return false; } }
php
public function contains(string $value): bool { try { $this->position($value); return true; } catch (SubstringException $e) { return false; } }
[ "public", "function", "contains", "(", "string", "$", "value", ")", ":", "bool", "{", "try", "{", "$", "this", "->", "position", "(", "$", "value", ")", ";", "return", "true", ";", "}", "catch", "(", "SubstringException", "$", "e", ")", "{", "return"...
Check if the given string is present in the current one @param string $value @return bool
[ "Check", "if", "the", "given", "string", "is", "present", "in", "the", "current", "one" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L654-L663
29,509
Innmind/Immutable
src/Str.php
Str.endsWith
public function endsWith(string $value): bool { if ($value === '') { return true; } return (string) $this->takeEnd(self::of($value, $this->encoding)->length()) === $value; }
php
public function endsWith(string $value): bool { if ($value === '') { return true; } return (string) $this->takeEnd(self::of($value, $this->encoding)->length()) === $value; }
[ "public", "function", "endsWith", "(", "string", "$", "value", ")", ":", "bool", "{", "if", "(", "$", "value", "===", "''", ")", "{", "return", "true", ";", "}", "return", "(", "string", ")", "$", "this", "->", "takeEnd", "(", "self", "::", "of", ...
Check if the current string ends with the given string @param string $value @return bool
[ "Check", "if", "the", "current", "string", "ends", "with", "the", "given", "string" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L692-L699
29,510
Innmind/Immutable
src/Str.php
Str.pregQuote
public function pregQuote(string $delimiter = ''): self { return new self(\preg_quote((string) $this, $delimiter), $this->encoding); }
php
public function pregQuote(string $delimiter = ''): self { return new self(\preg_quote((string) $this, $delimiter), $this->encoding); }
[ "public", "function", "pregQuote", "(", "string", "$", "delimiter", "=", "''", ")", ":", "self", "{", "return", "new", "self", "(", "\\", "preg_quote", "(", "(", "string", ")", "$", "this", ",", "$", "delimiter", ")", ",", "$", "this", "->", "encodin...
Quote regular expression characters @param string $delimiter @return self
[ "Quote", "regular", "expression", "characters" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L708-L711
29,511
Innmind/Immutable
src/Str.php
Str.pad
private function pad( int $length, string $character = ' ', int $direction = self::PAD_RIGHT ): self { return new self(\str_pad( $this->value, $length, $character, $direction ), $this->encoding); }
php
private function pad( int $length, string $character = ' ', int $direction = self::PAD_RIGHT ): self { return new self(\str_pad( $this->value, $length, $character, $direction ), $this->encoding); }
[ "private", "function", "pad", "(", "int", "$", "length", ",", "string", "$", "character", "=", "' '", ",", "int", "$", "direction", "=", "self", "::", "PAD_RIGHT", ")", ":", "self", "{", "return", "new", "self", "(", "\\", "str_pad", "(", "$", "this"...
Pad the string @param int $length @param string $character @param int $direction @return self
[ "Pad", "the", "string" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Str.php#L722-L733
29,512
symbiote/silverstripe-content-services
code/content/ContentWriter.php
ContentWriter.getReaderWrapper
protected function getReaderWrapper($content) { if (!$content) { $content = $this->source; } $reader = null; if (is_resource($content)) { $data = null; while (!feof($content)) { $data .= fread($content, 8192); } fclose($content); $reader = new RawContentReader($data); } else if ($con...
php
protected function getReaderWrapper($content) { if (!$content) { $content = $this->source; } $reader = null; if (is_resource($content)) { $data = null; while (!feof($content)) { $data .= fread($content, 8192); } fclose($content); $reader = new RawContentReader($data); } else if ($con...
[ "protected", "function", "getReaderWrapper", "(", "$", "content", ")", "{", "if", "(", "!", "$", "content", ")", "{", "$", "content", "=", "$", "this", "->", "source", ";", "}", "$", "reader", "=", "null", ";", "if", "(", "is_resource", "(", "$", "...
Get content reader wrapper around a given piece of content @param mixed $content
[ "Get", "content", "reader", "wrapper", "around", "a", "given", "piece", "of", "content" ]
d6dec8da12208d876051aa4329a9b76032172bfa
https://github.com/symbiote/silverstripe-content-services/blob/d6dec8da12208d876051aa4329a9b76032172bfa/code/content/ContentWriter.php#L59-L86
29,513
Innmind/Immutable
src/Type.php
Type.of
public static function of(string $type): SpecificationInterface { if (\function_exists('is_'.$type)) { return new PrimitiveType($type); } if ($type === 'variable') { return new VariableType; } if ($type === 'mixed') { return new MixedType...
php
public static function of(string $type): SpecificationInterface { if (\function_exists('is_'.$type)) { return new PrimitiveType($type); } if ($type === 'variable') { return new VariableType; } if ($type === 'mixed') { return new MixedType...
[ "public", "static", "function", "of", "(", "string", "$", "type", ")", ":", "SpecificationInterface", "{", "if", "(", "\\", "function_exists", "(", "'is_'", ".", "$", "type", ")", ")", "{", "return", "new", "PrimitiveType", "(", "$", "type", ")", ";", ...
Build the appropriate specification for the given type @param string $type @return SpecificationInterface
[ "Build", "the", "appropriate", "specification", "for", "the", "given", "type" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Type.php#L22-L37
29,514
Innmind/Immutable
src/Type.php
Type.determine
public static function determine($value): string { $type = \gettype($value); switch ($type) { case 'object': return \get_class($value); case 'integer': return 'int'; case 'boolean': return 'bool'; cas...
php
public static function determine($value): string { $type = \gettype($value); switch ($type) { case 'object': return \get_class($value); case 'integer': return 'int'; case 'boolean': return 'bool'; cas...
[ "public", "static", "function", "determine", "(", "$", "value", ")", ":", "string", "{", "$", "type", "=", "\\", "gettype", "(", "$", "value", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "'object'", ":", "return", "\\", "get_class", "(", ...
Return the type of the given value @param mixed $value @return string
[ "Return", "the", "type", "of", "the", "given", "value" ]
e41bc01b13c1b11226e5ac6937bccf3c60813ca9
https://github.com/Innmind/Immutable/blob/e41bc01b13c1b11226e5ac6937bccf3c60813ca9/src/Type.php#L46-L69
29,515
symbiote/silverstripe-content-services
code/content/FileContentReader.php
FileContentReader.read
public function read() { $id = $this->getId(); $path = $this->getPath($id); if (!is_readable($path)) { throw new Exception("Expected path $path is not readable"); } return file_get_contents($path); }
php
public function read() { $id = $this->getId(); $path = $this->getPath($id); if (!is_readable($path)) { throw new Exception("Expected path $path is not readable"); } return file_get_contents($path); }
[ "public", "function", "read", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getId", "(", ")", ";", "$", "path", "=", "$", "this", "->", "getPath", "(", "$", "id", ")", ";", "if", "(", "!", "is_readable", "(", "$", "path", ")", ")", "{", ...
Read content back to the user @return string
[ "Read", "content", "back", "to", "the", "user" ]
d6dec8da12208d876051aa4329a9b76032172bfa
https://github.com/symbiote/silverstripe-content-services/blob/d6dec8da12208d876051aa4329a9b76032172bfa/code/content/FileContentReader.php#L81-L90
29,516
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.room_exists
public function room_exists($room_id) { try { $this->get_room($room_id); } catch (HipChat_Exception $e) { if ($e->code === self::STATUS_NOT_FOUND) { return false; } throw $e; } return true; }
php
public function room_exists($room_id) { try { $this->get_room($room_id); } catch (HipChat_Exception $e) { if ($e->code === self::STATUS_NOT_FOUND) { return false; } throw $e; } return true; }
[ "public", "function", "room_exists", "(", "$", "room_id", ")", "{", "try", "{", "$", "this", "->", "get_room", "(", "$", "room_id", ")", ";", "}", "catch", "(", "HipChat_Exception", "$", "e", ")", "{", "if", "(", "$", "e", "->", "code", "===", "sel...
Determine if the given room name or room id already exists. @param mixed $room_id @return boolean
[ "Determine", "if", "the", "given", "room", "name", "or", "room", "id", "already", "exists", "." ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L94-L105
29,517
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.message_room
public function message_room($room_id, $from, $message, $notify = false, $color = self::COLOR_YELLOW, $message_format = self::FORMAT_HTML) { $args = array( 'room_id' => $room_id, 'from' => $from, 'message' => $message, 'notify' =>...
php
public function message_room($room_id, $from, $message, $notify = false, $color = self::COLOR_YELLOW, $message_format = self::FORMAT_HTML) { $args = array( 'room_id' => $room_id, 'from' => $from, 'message' => $message, 'notify' =>...
[ "public", "function", "message_room", "(", "$", "room_id", ",", "$", "from", ",", "$", "message", ",", "$", "notify", "=", "false", ",", "$", "color", "=", "self", "::", "COLOR_YELLOW", ",", "$", "message_format", "=", "self", "::", "FORMAT_HTML", ")", ...
Send a message to a room @see http://api.hipchat.com/docs/api/method/rooms/message
[ "Send", "a", "message", "to", "a", "room" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L122-L135
29,518
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.get_rooms_history
public function get_rooms_history($room_id, $date = 'recent') { $response = $this->make_request('rooms/history', array( 'room_id' => $room_id, 'date' => $date )); return $response->messages; }
php
public function get_rooms_history($room_id, $date = 'recent') { $response = $this->make_request('rooms/history', array( 'room_id' => $room_id, 'date' => $date )); return $response->messages; }
[ "public", "function", "get_rooms_history", "(", "$", "room_id", ",", "$", "date", "=", "'recent'", ")", "{", "$", "response", "=", "$", "this", "->", "make_request", "(", "'rooms/history'", ",", "array", "(", "'room_id'", "=>", "$", "room_id", ",", "'date'...
Get chat history for a room @see https://www.hipchat.com/docs/api/method/rooms/history
[ "Get", "chat", "history", "for", "a", "room" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L142-L148
29,519
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.set_room_topic
public function set_room_topic($room_id, $topic, $from = null) { $args = array( 'room_id' => $room_id, 'topic' => $topic, ); if ($from) { $args['from'] = $from; } $response = $this->make_request('rooms/topic', $args, 'POST'); return ($response->status == 'ok'); }
php
public function set_room_topic($room_id, $topic, $from = null) { $args = array( 'room_id' => $room_id, 'topic' => $topic, ); if ($from) { $args['from'] = $from; } $response = $this->make_request('rooms/topic', $args, 'POST'); return ($response->status == 'ok'); }
[ "public", "function", "set_room_topic", "(", "$", "room_id", ",", "$", "topic", ",", "$", "from", "=", "null", ")", "{", "$", "args", "=", "array", "(", "'room_id'", "=>", "$", "room_id", ",", "'topic'", "=>", "$", "topic", ",", ")", ";", "if", "("...
Set a room's topic @see http://api.hipchat.com/docs/api/method/rooms/topic
[ "Set", "a", "room", "s", "topic" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L155-L167
29,520
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.create_room
public function create_room($name, $owner_user_id = null, $privacy = null, $topic = null, $guest_access = null) { $args = array( 'name' => $name ); if ($owner_user_id) { $args['owner_user_id'] = $owner_user_id; } if ($privacy) { $args['privacy'] = $privacy; } i...
php
public function create_room($name, $owner_user_id = null, $privacy = null, $topic = null, $guest_access = null) { $args = array( 'name' => $name ); if ($owner_user_id) { $args['owner_user_id'] = $owner_user_id; } if ($privacy) { $args['privacy'] = $privacy; } i...
[ "public", "function", "create_room", "(", "$", "name", ",", "$", "owner_user_id", "=", "null", ",", "$", "privacy", "=", "null", ",", "$", "topic", "=", "null", ",", "$", "guest_access", "=", "null", ")", "{", "$", "args", "=", "array", "(", "'name'"...
Create a room @see http://api.hipchat.com/docs/api/method/rooms/create
[ "Create", "a", "room" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L174-L197
29,521
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.delete_room
public function delete_room($room_id){ $args = array( 'room_id' => $room_id ); $response = $this->make_request('rooms/delete', $args, 'POST'); return ($response->deleted == 'true'); }
php
public function delete_room($room_id){ $args = array( 'room_id' => $room_id ); $response = $this->make_request('rooms/delete', $args, 'POST'); return ($response->deleted == 'true'); }
[ "public", "function", "delete_room", "(", "$", "room_id", ")", "{", "$", "args", "=", "array", "(", "'room_id'", "=>", "$", "room_id", ")", ";", "$", "response", "=", "$", "this", "->", "make_request", "(", "'rooms/delete'", ",", "$", "args", ",", "'PO...
Delete a room @see http://api.hipchat.com/docs/api/method/rooms/delete
[ "Delete", "a", "room" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L204-L212
29,522
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.create_user
public function create_user($email, $name, $mention_name = null, $title = null, $is_group_admin = 0, $password = null, $timezone = null) { $args = array( 'email' => $email, 'name' => $name, ); if ($mention_name) { $args['mention...
php
public function create_user($email, $name, $mention_name = null, $title = null, $is_group_admin = 0, $password = null, $timezone = null) { $args = array( 'email' => $email, 'name' => $name, ); if ($mention_name) { $args['mention...
[ "public", "function", "create_user", "(", "$", "email", ",", "$", "name", ",", "$", "mention_name", "=", "null", ",", "$", "title", "=", "null", ",", "$", "is_group_admin", "=", "0", ",", "$", "password", "=", "null", ",", "$", "timezone", "=", "null...
Create a new user in your group. @see http://api.hipchat.com/docs/api/method/users/create
[ "Create", "a", "new", "user", "in", "your", "group", "." ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L245-L276
29,523
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.curl_request
public function curl_request($url, $post_data = null) { if (is_array($post_data)) { $post_data = array_map(array($this, 'sanitize_curl_parameter'), $post_data); } $ch = curl_init($url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt(...
php
public function curl_request($url, $post_data = null) { if (is_array($post_data)) { $post_data = array_map(array($this, 'sanitize_curl_parameter'), $post_data); } $ch = curl_init($url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt(...
[ "public", "function", "curl_request", "(", "$", "url", ",", "$", "post_data", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "post_data", ")", ")", "{", "$", "post_data", "=", "array_map", "(", "array", "(", "$", "this", ",", "'sanitize_curl_p...
Performs a curl request @param $url URL to hit. @param $post_data Data to send via POST. Leave null for GET request. @throws HipChat_Exception @return string
[ "Performs", "a", "curl", "request" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L359-L398
29,524
hipchat/hipchat-php
src/HipChat/HipChat.php
HipChat.make_request
public function make_request($api_method, $args = array(), $http_method = 'GET') { $args['format'] = 'json'; $args['auth_token'] = $this->auth_token; $url = "$this->api_target/$this->api_version/$api_method"; $post_data = null; // add args to url for GET if ($http...
php
public function make_request($api_method, $args = array(), $http_method = 'GET') { $args['format'] = 'json'; $args['auth_token'] = $this->auth_token; $url = "$this->api_target/$this->api_version/$api_method"; $post_data = null; // add args to url for GET if ($http...
[ "public", "function", "make_request", "(", "$", "api_method", ",", "$", "args", "=", "array", "(", ")", ",", "$", "http_method", "=", "'GET'", ")", "{", "$", "args", "[", "'format'", "]", "=", "'json'", ";", "$", "args", "[", "'auth_token'", "]", "="...
Make an API request using curl @param string $api_method Which API method to hit, like 'rooms/show'. @param array $args Data to send. @param string $http_method HTTP method (GET or POST). @throws HipChat_Exception @return mixed
[ "Make", "an", "API", "request", "using", "curl" ]
5936c0a48d2d514d94bfc1d774b04c42cd3bc39e
https://github.com/hipchat/hipchat-php/blob/5936c0a48d2d514d94bfc1d774b04c42cd3bc39e/src/HipChat/HipChat.php#L429-L453
29,525
symbiote/silverstripe-content-services
code/content/ReaderWriterBase.php
ReaderWriterBase.getContentId
public function getContentId() { if (!$this->id) { throw new Exception("Null content identifier; content must be written before retrieving id"); } return $this->getSourceIdentifier() . ContentService::SEPARATOR . $this->id; }
php
public function getContentId() { if (!$this->id) { throw new Exception("Null content identifier; content must be written before retrieving id"); } return $this->getSourceIdentifier() . ContentService::SEPARATOR . $this->id; }
[ "public", "function", "getContentId", "(", ")", "{", "if", "(", "!", "$", "this", "->", "id", ")", "{", "throw", "new", "Exception", "(", "\"Null content identifier; content must be written before retrieving id\"", ")", ";", "}", "return", "$", "this", "->", "ge...
Get content identifier that can be used to retrieve this content at a later point in timer
[ "Get", "content", "identifier", "that", "can", "be", "used", "to", "retrieve", "this", "content", "at", "a", "later", "point", "in", "timer" ]
d6dec8da12208d876051aa4329a9b76032172bfa
https://github.com/symbiote/silverstripe-content-services/blob/d6dec8da12208d876051aa4329a9b76032172bfa/code/content/ReaderWriterBase.php#L67-L72
29,526
inpsyde/Wonolog
src/Data/FailedLogin.php
FailedLogin.level
public function level() { $this->count_attempts( 300 ); switch ( TRUE ) { case ( $this->attempts > 2 && $this->attempts <= 100 ) : return Logger::NOTICE; case ( $this->attempts > 100 && $this->attempts <= 590 ) : return Logger::WARNING; case ( $this->attempts > 590 && $this->attempts <= 990 ) : ...
php
public function level() { $this->count_attempts( 300 ); switch ( TRUE ) { case ( $this->attempts > 2 && $this->attempts <= 100 ) : return Logger::NOTICE; case ( $this->attempts > 100 && $this->attempts <= 590 ) : return Logger::WARNING; case ( $this->attempts > 590 && $this->attempts <= 990 ) : ...
[ "public", "function", "level", "(", ")", "{", "$", "this", "->", "count_attempts", "(", "300", ")", ";", "switch", "(", "TRUE", ")", "{", "case", "(", "$", "this", "->", "attempts", ">", "2", "&&", "$", "this", "->", "attempts", "<=", "100", ")", ...
Determine severity of the error based on the number of login attempts in last 5 minutes. @return int
[ "Determine", "severity", "of", "the", "error", "based", "on", "the", "number", "of", "login", "attempts", "in", "last", "5", "minutes", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Data/FailedLogin.php#L60-L76
29,527
inpsyde/Wonolog
src/Data/FailedLogin.php
FailedLogin.sniff_ip
private function sniff_ip() { if ( $this->ip_data ) { return; } if ( PHP_SAPI === 'cli' ) { $this->ip_data = [ '127.0.0.1', 'CLI' ]; return; } $ip_server_keys = [ 'REMOTE_ADDR' => '', 'HTTP_CLIENT_IP' => '', 'HTTP_X_FORWARDED_FOR' => '', ]; $ips = array_intersect_key( $_SERVER, $ip_...
php
private function sniff_ip() { if ( $this->ip_data ) { return; } if ( PHP_SAPI === 'cli' ) { $this->ip_data = [ '127.0.0.1', 'CLI' ]; return; } $ip_server_keys = [ 'REMOTE_ADDR' => '', 'HTTP_CLIENT_IP' => '', 'HTTP_X_FORWARDED_FOR' => '', ]; $ips = array_intersect_key( $_SERVER, $ip_...
[ "private", "function", "sniff_ip", "(", ")", "{", "if", "(", "$", "this", "->", "ip_data", ")", "{", "return", ";", "}", "if", "(", "PHP_SAPI", "===", "'cli'", ")", "{", "$", "this", "->", "ip_data", "=", "[", "'127.0.0.1'", ",", "'CLI'", "]", ";",...
Try to sniff the current client IP.
[ "Try", "to", "sniff", "the", "current", "client", "IP", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Data/FailedLogin.php#L126-L141
29,528
inpsyde/Wonolog
src/Data/FailedLogin.php
FailedLogin.count_attempts
private function count_attempts( $ttl = 300 ) { if ( isset( $this->attempts ) ) { return; } $this->sniff_ip(); $ip = $this->ip_data[ 0 ]; $attempts = get_site_transient( self::TRANSIENT_NAME ); is_array( $attempts ) or $attempts = []; // Seems the first time a failed attempt for this IP if ( ! $a...
php
private function count_attempts( $ttl = 300 ) { if ( isset( $this->attempts ) ) { return; } $this->sniff_ip(); $ip = $this->ip_data[ 0 ]; $attempts = get_site_transient( self::TRANSIENT_NAME ); is_array( $attempts ) or $attempts = []; // Seems the first time a failed attempt for this IP if ( ! $a...
[ "private", "function", "count_attempts", "(", "$", "ttl", "=", "300", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "attempts", ")", ")", "{", "return", ";", "}", "$", "this", "->", "sniff_ip", "(", ")", ";", "$", "ip", "=", "$", "this", ...
Determine how many failed login attempts comes from the guessed IP. Use a site transient to count them. @param int $ttl transient time to live in seconds
[ "Determine", "how", "many", "failed", "login", "attempts", "comes", "from", "the", "guessed", "IP", ".", "Use", "a", "site", "transient", "to", "count", "them", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Data/FailedLogin.php#L149-L191
29,529
inpsyde/Wonolog
src/PhpErrorController.php
PhpErrorController.on_exception
public function on_exception( $e ) { // Log the PHP exception. do_action( \Inpsyde\Wonolog\LOG, new Log( $e->getMessage(), Logger::CRITICAL, Channels::PHP_ERROR, [ 'exception' => get_class( $e ), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e...
php
public function on_exception( $e ) { // Log the PHP exception. do_action( \Inpsyde\Wonolog\LOG, new Log( $e->getMessage(), Logger::CRITICAL, Channels::PHP_ERROR, [ 'exception' => get_class( $e ), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e...
[ "public", "function", "on_exception", "(", "$", "e", ")", "{", "// Log the PHP exception.", "do_action", "(", "\\", "Inpsyde", "\\", "Wonolog", "\\", "LOG", ",", "new", "Log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "Logger", "::", "CRITICAL", ...
Uncaught exception handler. @param \Throwable $e @throws \Throwable
[ "Uncaught", "exception", "handler", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/PhpErrorController.php#L96-L117
29,530
inpsyde/Wonolog
src/PhpErrorController.php
PhpErrorController.on_fatal
public function on_fatal() { $last_error = error_get_last(); if ( ! $last_error ) { return; } $error = array_merge( [ 'type' => -1, 'message' => '', 'file' => '', 'line' => 0 ], $last_error ); $fatals = [ E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNIN...
php
public function on_fatal() { $last_error = error_get_last(); if ( ! $last_error ) { return; } $error = array_merge( [ 'type' => -1, 'message' => '', 'file' => '', 'line' => 0 ], $last_error ); $fatals = [ E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNIN...
[ "public", "function", "on_fatal", "(", ")", "{", "$", "last_error", "=", "error_get_last", "(", ")", ";", "if", "(", "!", "$", "last_error", ")", "{", "return", ";", "}", "$", "error", "=", "array_merge", "(", "[", "'type'", "=>", "-", "1", ",", "'...
Checks for a fatal error, work-around for `set_error_handler` not working with fatal errors.
[ "Checks", "for", "a", "fatal", "error", "work", "-", "around", "for", "set_error_handler", "not", "working", "with", "fatal", "errors", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/PhpErrorController.php#L122-L143
29,531
inpsyde/Wonolog
src/HookListener/QueryErrorsListener.php
QueryErrorsListener.update
public function update( array $args ) { $wp = $args ? reset( $args ) : NULL; if ( ! $wp instanceof \WP ) { return new NullLog(); } $error = []; isset( $wp->query_vars[ 'error' ] ) and $error[] = $wp->query_vars[ 'error' ]; is_404() and $error[] = '404 Page not found'; if ( empty( $error ) ) { re...
php
public function update( array $args ) { $wp = $args ? reset( $args ) : NULL; if ( ! $wp instanceof \WP ) { return new NullLog(); } $error = []; isset( $wp->query_vars[ 'error' ] ) and $error[] = $wp->query_vars[ 'error' ]; is_404() and $error[] = '404 Page not found'; if ( empty( $error ) ) { re...
[ "public", "function", "update", "(", "array", "$", "args", ")", "{", "$", "wp", "=", "$", "args", "?", "reset", "(", "$", "args", ")", ":", "NULL", ";", "if", "(", "!", "$", "wp", "instanceof", "\\", "WP", ")", "{", "return", "new", "NullLog", ...
Checks frontend request for any errors and log them. @param $args @return LogDataInterface @wp-hook wp
[ "Checks", "frontend", "request", "for", "any", "errors", "and", "log", "them", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/HookListener/QueryErrorsListener.php#L43-L68
29,532
inpsyde/Wonolog
src/HookListener/HookListenersRegistry.php
HookListenersRegistry.initialize
public static function initialize() { $instance = new static(); /** * Fires right before hook listeners are registered. * * @param HookListenersRegistry $registry */ do_action( self::ACTION_REGISTER, $instance ); array_walk( $instance->listeners, function ( HookListenerInterface $listener )...
php
public static function initialize() { $instance = new static(); /** * Fires right before hook listeners are registered. * * @param HookListenersRegistry $registry */ do_action( self::ACTION_REGISTER, $instance ); array_walk( $instance->listeners, function ( HookListenerInterface $listener )...
[ "public", "static", "function", "initialize", "(", ")", "{", "$", "instance", "=", "new", "static", "(", ")", ";", "/**\n\t\t * Fires right before hook listeners are registered.\n\t\t *\n\t\t * @param HookListenersRegistry $registry\n\t\t */", "do_action", "(", "self", "::", ...
Initialize the class, fire an hook to allow listener registration and adds the hook that will make log happen
[ "Initialize", "the", "class", "fire", "an", "hook", "to", "allow", "listener", "registration", "and", "adds", "the", "hook", "that", "will", "make", "log", "happen" ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/HookListener/HookListenersRegistry.php#L35-L65
29,533
inpsyde/Wonolog
src/Data/HookLogFactory.php
HookLogFactory.extract_log_objects_in_args
private function extract_log_objects_in_args( array $args, $hook_level ) { $logs = []; foreach ( $args as $arg ) { if ( $arg instanceof LogDataInterface ) { $logs[] = $this->maybe_raise_level( $hook_level, $arg ); } } return $logs; }
php
private function extract_log_objects_in_args( array $args, $hook_level ) { $logs = []; foreach ( $args as $arg ) { if ( $arg instanceof LogDataInterface ) { $logs[] = $this->maybe_raise_level( $hook_level, $arg ); } } return $logs; }
[ "private", "function", "extract_log_objects_in_args", "(", "array", "$", "args", ",", "$", "hook_level", ")", "{", "$", "logs", "=", "[", "]", ";", "foreach", "(", "$", "args", "as", "$", "arg", ")", "{", "if", "(", "$", "arg", "instanceof", "LogDataIn...
If one or more LogData objects are passed as argument, extract all of them and return remaining objects. @param array $args @param int $hook_level @return LogDataInterface[]
[ "If", "one", "or", "more", "LogData", "objects", "are", "passed", "as", "argument", "extract", "all", "of", "them", "and", "return", "remaining", "objects", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Data/HookLogFactory.php#L83-L94
29,534
inpsyde/Wonolog
src/HookListener/CronDebugListener.php
CronDebugListener.cron_action_profile
private function cron_action_profile() { if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) { return; } $hook = current_filter(); if ( ! isset( $this->done[ $hook ] ) ) { $this->done[ $hook ][ 'start' ] = microtime( TRUE ); return; } if ( ! isset( $this->done[ $hook ][ 'duration' ] ) ) { $dur...
php
private function cron_action_profile() { if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) { return; } $hook = current_filter(); if ( ! isset( $this->done[ $hook ] ) ) { $this->done[ $hook ][ 'start' ] = microtime( TRUE ); return; } if ( ! isset( $this->done[ $hook ][ 'duration' ] ) ) { $dur...
[ "private", "function", "cron_action_profile", "(", ")", "{", "if", "(", "!", "defined", "(", "'DOING_CRON'", ")", "||", "!", "DOING_CRON", ")", "{", "return", ";", "}", "$", "hook", "=", "current_filter", "(", ")", ";", "if", "(", "!", "isset", "(", ...
Run before and after that any cron action ran, logging it and its performance.
[ "Run", "before", "and", "after", "that", "any", "cron", "action", "ran", "logging", "it", "and", "its", "performance", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/HookListener/CronDebugListener.php#L139-L164
29,535
inpsyde/Wonolog
src/Controller.php
Controller.setup
public function setup( $priority = 100 ) { if ( did_action( self::ACTION_SETUP ) ) { return $this; } // We use WONOLOG_DISABLE instead of WONOLOG_ENABLE so that not defined (default) means enabled. $disable_by_env = filter_var( getenv( 'WONOLOG_DISABLE' ), FILTER_VALIDATE_BOOLEAN ); /** * Filters whe...
php
public function setup( $priority = 100 ) { if ( did_action( self::ACTION_SETUP ) ) { return $this; } // We use WONOLOG_DISABLE instead of WONOLOG_ENABLE so that not defined (default) means enabled. $disable_by_env = filter_var( getenv( 'WONOLOG_DISABLE' ), FILTER_VALIDATE_BOOLEAN ); /** * Filters whe...
[ "public", "function", "setup", "(", "$", "priority", "=", "100", ")", "{", "if", "(", "did_action", "(", "self", "::", "ACTION_SETUP", ")", ")", "{", "return", "$", "this", ";", "}", "// We use WONOLOG_DISABLE instead of WONOLOG_ENABLE so that not defined (default) ...
Initialize Wonolog. @param int $priority @return Controller
[ "Initialize", "Wonolog", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L41-L84
29,536
inpsyde/Wonolog
src/Controller.php
Controller.log_php_errors
public function log_php_errors( $error_types = NULL ) { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; is_int( $error_types ) or $error_types = E_ALL | E_STRICT; $controller = new PhpErrorController(); register_shutdown_function( [ $controller, 'on_fatal', ] ); set_error_handle...
php
public function log_php_errors( $error_types = NULL ) { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; is_int( $error_types ) or $error_types = E_ALL | E_STRICT; $controller = new PhpErrorController(); register_shutdown_function( [ $controller, 'on_fatal', ] ); set_error_handle...
[ "public", "function", "log_php_errors", "(", "$", "error_types", "=", "NULL", ")", "{", "static", "$", "done", "=", "FALSE", ";", "if", "(", "$", "done", ")", "{", "return", "$", "this", ";", "}", "$", "done", "=", "TRUE", ";", "is_int", "(", "$", ...
Tell Wonolog to use the PHP errors handler. @param int|null $error_types bitmask of error types constants, default to E_ALL | E_STRICT @return Controller
[ "Tell", "Wonolog", "to", "use", "the", "PHP", "errors", "handler", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L93-L121
29,537
inpsyde/Wonolog
src/Controller.php
Controller.use_default_handler
public function use_default_handler( HandlerInterface $handler = NULL ) { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; add_action( HandlersRegistry::ACTION_REGISTER, function ( HandlersRegistry $registry ) use ( $handler ) { $handler = DefaultHandlerFactory::with_default...
php
public function use_default_handler( HandlerInterface $handler = NULL ) { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; add_action( HandlersRegistry::ACTION_REGISTER, function ( HandlersRegistry $registry ) use ( $handler ) { $handler = DefaultHandlerFactory::with_default...
[ "public", "function", "use_default_handler", "(", "HandlerInterface", "$", "handler", "=", "NULL", ")", "{", "static", "$", "done", "=", "FALSE", ";", "if", "(", "$", "done", ")", "{", "return", "$", "this", ";", "}", "$", "done", "=", "TRUE", ";", "...
Tell Wonolog to use a default handler that can be passed as argument or build using settings customizable via hooks. @param HandlerInterface $handler @return Controller
[ "Tell", "Wonolog", "to", "use", "a", "default", "handler", "that", "can", "be", "passed", "as", "argument", "or", "build", "using", "settings", "customizable", "via", "hooks", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L131-L153
29,538
inpsyde/Wonolog
src/Controller.php
Controller.use_handler
public function use_handler( HandlerInterface $handler, array $channels = [], $handler_id = NULL ) { add_action( HandlersRegistry::ACTION_REGISTER, function ( HandlersRegistry $registry ) use ( $handler_id, $handler ) { $registry->add_handler( $handler, $handler_id ); }, 1 ); ( $handler_id === ...
php
public function use_handler( HandlerInterface $handler, array $channels = [], $handler_id = NULL ) { add_action( HandlersRegistry::ACTION_REGISTER, function ( HandlersRegistry $registry ) use ( $handler_id, $handler ) { $registry->add_handler( $handler, $handler_id ); }, 1 ); ( $handler_id === ...
[ "public", "function", "use_handler", "(", "HandlerInterface", "$", "handler", ",", "array", "$", "channels", "=", "[", "]", ",", "$", "handler_id", "=", "NULL", ")", "{", "add_action", "(", "HandlersRegistry", "::", "ACTION_REGISTER", ",", "function", "(", "...
Tell Wonolog to make given handler available to loggers with given id. If one or more channels are passed, the handler will be attached to related Monolog loggers. @param HandlerInterface $handler @param string[] $channels @param string|NULL $handler_id @return Controller
[ "Tell", "Wonolog", "to", "make", "given", "handler", "available", "to", "loggers", "with", "given", "id", ".", "If", "one", "or", "more", "channels", "are", "passed", "the", "handler", "will", "be", "attached", "to", "related", "Monolog", "loggers", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L165-L191
29,539
inpsyde/Wonolog
src/Controller.php
Controller.use_default_processor
public function use_default_processor( callable $processor = null ) { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; add_action( ProcessorsRegistry::ACTION_REGISTER, function ( ProcessorsRegistry $registry ) use ($processor) { $processor or $processor = new WpContextProcess...
php
public function use_default_processor( callable $processor = null ) { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; add_action( ProcessorsRegistry::ACTION_REGISTER, function ( ProcessorsRegistry $registry ) use ($processor) { $processor or $processor = new WpContextProcess...
[ "public", "function", "use_default_processor", "(", "callable", "$", "processor", "=", "null", ")", "{", "static", "$", "done", "=", "FALSE", ";", "if", "(", "$", "done", ")", "{", "return", "$", "this", ";", "}", "$", "done", "=", "TRUE", ";", "add_...
Tell Wonolog to use default log processor. @param callable $processor @return Controller
[ "Tell", "Wonolog", "to", "use", "default", "log", "processor", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L200-L219
29,540
inpsyde/Wonolog
src/Controller.php
Controller.use_default_hook_listeners
public function use_default_hook_listeners() { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; add_action( HookListenersRegistry::ACTION_REGISTER, function ( HookListenersRegistry $registry ) { $registry ->register_listener( new HookListener\DbErrorListener() ) ->...
php
public function use_default_hook_listeners() { static $done = FALSE; if ( $done ) { return $this; } $done = TRUE; add_action( HookListenersRegistry::ACTION_REGISTER, function ( HookListenersRegistry $registry ) { $registry ->register_listener( new HookListener\DbErrorListener() ) ->...
[ "public", "function", "use_default_hook_listeners", "(", ")", "{", "static", "$", "done", "=", "FALSE", ";", "if", "(", "$", "done", ")", "{", "return", "$", "this", ";", "}", "$", "done", "=", "TRUE", ";", "add_action", "(", "HookListenersRegistry", "::...
Tell Wonolog to use all default hook listeners. @return Controller
[ "Tell", "Wonolog", "to", "use", "all", "default", "hook", "listeners", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L310-L335
29,541
inpsyde/Wonolog
src/Controller.php
Controller.use_hook_listener
public function use_hook_listener( HookListenerInterface $listener ) { add_action( HookListenersRegistry::ACTION_REGISTER, function ( HookListenersRegistry $registry ) use ( $listener ) { $registry->register_listener( $listener ); } ); return $this; }
php
public function use_hook_listener( HookListenerInterface $listener ) { add_action( HookListenersRegistry::ACTION_REGISTER, function ( HookListenersRegistry $registry ) use ( $listener ) { $registry->register_listener( $listener ); } ); return $this; }
[ "public", "function", "use_hook_listener", "(", "HookListenerInterface", "$", "listener", ")", "{", "add_action", "(", "HookListenersRegistry", "::", "ACTION_REGISTER", ",", "function", "(", "HookListenersRegistry", "$", "registry", ")", "use", "(", "$", "listener", ...
Tell Wonolog to use given hook listener. @param HookListenerInterface $listener @return Controller
[ "Tell", "Wonolog", "to", "use", "given", "hook", "listener", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Controller.php#L344-L355
29,542
inpsyde/Wonolog
src/Handler/DefaultHandlerFactory.php
DefaultHandlerFactory.maybe_create_htaccess
private function maybe_create_htaccess( $folder ) { if ( ! $folder || ! is_dir( $folder ) || ! is_writable( $folder ) || file_exists( "{$folder}/.htaccess" ) || ! defined( 'WP_CONTENT_DIR' ) ) { return $folder; } $target_dir = realpath( $folder ); $content_dir = realpath( WP_CONTENT_DIR )...
php
private function maybe_create_htaccess( $folder ) { if ( ! $folder || ! is_dir( $folder ) || ! is_writable( $folder ) || file_exists( "{$folder}/.htaccess" ) || ! defined( 'WP_CONTENT_DIR' ) ) { return $folder; } $target_dir = realpath( $folder ); $content_dir = realpath( WP_CONTENT_DIR )...
[ "private", "function", "maybe_create_htaccess", "(", "$", "folder", ")", "{", "if", "(", "!", "$", "folder", "||", "!", "is_dir", "(", "$", "folder", ")", "||", "!", "is_writable", "(", "$", "folder", ")", "||", "file_exists", "(", "\"{$folder}/.htaccess\"...
When the log root folder is inside WordPress content folder, the logs are going to be publicly accessible, and that is in best case a privacy leakage issue, in worst case a security threat. We try to write an .htaccess file to prevent access to them. This guarantees nothing, because .htaccess can be ignored depending w...
[ "When", "the", "log", "root", "folder", "is", "inside", "WordPress", "content", "folder", "the", "logs", "are", "going", "to", "be", "publicly", "accessible", "and", "that", "is", "in", "best", "case", "a", "privacy", "leakage", "issue", "in", "worst", "ca...
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/Handler/DefaultHandlerFactory.php#L173-L225
29,543
inpsyde/Wonolog
src/HookListener/HttpApiListener.php
HttpApiListener.log_http_error
private function log_http_error( $data, $context, $class, array $args = [], $url = '' ) { $msg = 'WP HTTP API Error'; $response = is_array( $data ) && isset( $data[ 'response' ] ) && is_array( $data[ 'response' ] ) ? shortcode_atts( [ 'message' => '', 'code' => '', 'body' => '' ], $data[ 'response' ] ) ...
php
private function log_http_error( $data, $context, $class, array $args = [], $url = '' ) { $msg = 'WP HTTP API Error'; $response = is_array( $data ) && isset( $data[ 'response' ] ) && is_array( $data[ 'response' ] ) ? shortcode_atts( [ 'message' => '', 'code' => '', 'body' => '' ], $data[ 'response' ] ) ...
[ "private", "function", "log_http_error", "(", "$", "data", ",", "$", "context", ",", "$", "class", ",", "array", "$", "args", "=", "[", "]", ",", "$", "url", "=", "''", ")", "{", "$", "msg", "=", "'WP HTTP API Error'", ";", "$", "response", "=", "i...
Log any error for HTTP API. @param \WP_Error|array $data @param string $context @param string $class @param array $args @param string $url @return Error
[ "Log", "any", "error", "for", "HTTP", "API", "." ]
87ed9a60c6f5cc3a057db857273dc504efc5ad9f
https://github.com/inpsyde/Wonolog/blob/87ed9a60c6f5cc3a057db857273dc504efc5ad9f/src/HookListener/HttpApiListener.php#L169-L201
29,544
phpsci/phpsci
src/PHPSci/Utils/ValidationUtils.php
ValidationUtils.check_X_y
public static function check_X_y(\CArray $X, \CArray $y, bool $accept_sparse=false, bool $copy=False, bool $force_all_finite=True, bool $ensure_2d=True, bool $allow_nd=False, bool $multi_output=False, int $ensure_min_samples=1, int $ensure_min_fe...
php
public static function check_X_y(\CArray $X, \CArray $y, bool $accept_sparse=false, bool $copy=False, bool $force_all_finite=True, bool $ensure_2d=True, bool $allow_nd=False, bool $multi_output=False, int $ensure_min_samples=1, int $ensure_min_fe...
[ "public", "static", "function", "check_X_y", "(", "\\", "CArray", "$", "X", ",", "\\", "CArray", "$", "y", ",", "bool", "$", "accept_sparse", "=", "false", ",", "bool", "$", "copy", "=", "False", ",", "bool", "$", "force_all_finite", "=", "True", ",", ...
Input validation for standard estimators. @param \CArray $X @param \CArray $y @param bool $accept_sparse @param bool $copy @param bool $force_all_finite @param bool $ensure_2d @param bool $allow_nd @param bool $multi_output @param int $ensure_min_samples @param int $ensure_min_features @param bool $y_numeric @param boo...
[ "Input", "validation", "for", "standard", "estimators", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Utils/ValidationUtils.php#L32-L38
29,545
phpsci/phpsci
src/PHPSci/Utils/DatasetUtils.php
DatasetUtils.make_dataset
public static function make_dataset(\CArray $X, \CArray $y, $sample_weight, $random_state=null) : array { $seed = rand(0, 10); $dataset = new ArrayDataset($X, $y, $sample_weight, $seed); $intercept_decay = 1.0; return [$dataset, $intercept_decay]; }
php
public static function make_dataset(\CArray $X, \CArray $y, $sample_weight, $random_state=null) : array { $seed = rand(0, 10); $dataset = new ArrayDataset($X, $y, $sample_weight, $seed); $intercept_decay = 1.0; return [$dataset, $intercept_decay]; }
[ "public", "static", "function", "make_dataset", "(", "\\", "CArray", "$", "X", ",", "\\", "CArray", "$", "y", ",", "$", "sample_weight", ",", "$", "random_state", "=", "null", ")", ":", "array", "{", "$", "seed", "=", "rand", "(", "0", ",", "10", "...
Create ``Dataset`` abstraction for sparse and dense inputs. This also returns the ``intercept_decay`` which is different for sparse datasets. @param \CArray $X @param \CArray $y @param $sample_weight @param null $random_state @return array
[ "Create", "Dataset", "abstraction", "for", "sparse", "and", "dense", "inputs", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Utils/DatasetUtils.php#L23-L29
29,546
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.add
public static function add(\CArray $a, \CArray $b): \CArray { return parent::add($a, $b); }
php
public static function add(\CArray $a, \CArray $b): \CArray { return parent::add($a, $b); }
[ "public", "static", "function", "add", "(", "\\", "CArray", "$", "a", ",", "\\", "CArray", "$", "b", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "add", "(", "$", "a", ",", "$", "b", ")", ";", "}" ]
Add arguments element-wise. @param \CArray $a Target CArray a @param \CArray $b Target CArray b @return \CArray The sum of $a and $b, element-wise.
[ "Add", "arguments", "element", "-", "wise", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L36-L39
29,547
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.subtract
public static function subtract(\CArray $a, \CArray $b): \CArray { return parent::subtract($a, $b); }
php
public static function subtract(\CArray $a, \CArray $b): \CArray { return parent::subtract($a, $b); }
[ "public", "static", "function", "subtract", "(", "\\", "CArray", "$", "a", ",", "\\", "CArray", "$", "b", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "subtract", "(", "$", "a", ",", "$", "b", ")", ";", "}" ]
Subtract two CArrays, element-wise. @param \CArray $a Target CArray $a @param \CArray $b Target CArray $b @return \CArray The difference of $a and $b, element-wise.
[ "Subtract", "two", "CArrays", "element", "-", "wise", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L49-L52
29,548
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.sum
public static function sum(\CArray $a, int $axis = null): \CArray { if (!isset($axis)) { return parent::sum($a); } return parent::sum($a, $axis); }
php
public static function sum(\CArray $a, int $axis = null): \CArray { if (!isset($axis)) { return parent::sum($a); } return parent::sum($a, $axis); }
[ "public", "static", "function", "sum", "(", "\\", "CArray", "$", "a", ",", "int", "$", "axis", "=", "null", ")", ":", "\\", "CArray", "{", "if", "(", "!", "isset", "(", "$", "axis", ")", ")", "{", "return", "parent", "::", "sum", "(", "$", "a",...
Sum of target CArray elements over a given axis. @param \CArray $a Target CArray @param int $axis (Optional) Axis or axes along which a sum is performed. Defaults to null. @return \CArray An CArray with the same shape as $a, with the specified axis removed.
[ "Sum", "of", "target", "CArray", "elements", "over", "a", "given", "axis", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L63-L70
29,549
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.eye
public static function eye(int $x, int $y, int $k = 0): \CArray { return parent::eye($x, $y, $k); }
php
public static function eye(int $x, int $y, int $k = 0): \CArray { return parent::eye($x, $y, $k); }
[ "public", "static", "function", "eye", "(", "int", "$", "x", ",", "int", "$", "y", ",", "int", "$", "k", "=", "0", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "eye", "(", "$", "x", ",", "$", "y", ",", "$", "k", ")", ";", "}" ]
Return CArray filled with zeros and ones in the diagonal provided diagonal index. @param int $x Number of rows (2-D) or width (1-D) @param int $y Number of cols (2-D) or 0 (1-D) @param int $k (Optional) Diagonal Index. Defaults to 0. @return \CArray
[ "Return", "CArray", "filled", "with", "zeros", "and", "ones", "in", "the", "diagonal", "provided", "diagonal", "index", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L286-L289
29,550
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.ones
public static function ones(int $x, int $y): \CArray { return parent::ones($x, $y); }
php
public static function ones(int $x, int $y): \CArray { return parent::ones($x, $y); }
[ "public", "static", "function", "ones", "(", "int", "$", "x", ",", "int", "$", "y", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "ones", "(", "$", "x", ",", "$", "y", ")", ";", "}" ]
Return new CArray with same shape as target CArray filled with zeros. @param int $x Number of rows (2-D) or width (1-D) @param int $y Number of cols (2-D) or 0 (1-D) @return \CArray CArray with shape ($x, $y) filled with ones.
[ "Return", "new", "CArray", "with", "same", "shape", "as", "target", "CArray", "filled", "with", "zeros", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L313-L316
29,551
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.full
public static function full($num, int $x, int $y): \CArray { return parent::full($num, $x, $y); }
php
public static function full($num, int $x, int $y): \CArray { return parent::full($num, $x, $y); }
[ "public", "static", "function", "full", "(", "$", "num", ",", "int", "$", "x", ",", "int", "$", "y", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "full", "(", "$", "num", ",", "$", "x", ",", "$", "y", ")", ";", "}" ]
Return new CArray filled with user provided number. @param double $num Number to fill the new CArray @param int $x Number of rows (2-D) or width (1-D) @param int $y Number of cols (2-D) or 0 (1-D) @return \CArray New CArray with shape ($x, $y) filled with $num
[ "Return", "new", "CArray", "filled", "with", "user", "provided", "number", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L365-L368
29,552
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.arange
public static function arange($stop, $start, $step): \CArray { return parent::arange($stop, $start, $step); }
php
public static function arange($stop, $start, $step): \CArray { return parent::arange($stop, $start, $step); }
[ "public", "static", "function", "arange", "(", "$", "stop", ",", "$", "start", ",", "$", "step", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "arange", "(", "$", "stop", ",", "$", "start", ",", "$", "step", ")", ";", "}" ]
CArray with evenly spaced values within a given interval. @param $stop End of interval @param $start (Optional) Start of interval. Default is 0. @param $step (Optional) Spacing between values. Default is 1. @return \CArray CArray with evenly spaced values.
[ "CArray", "with", "evenly", "spaced", "values", "within", "a", "given", "interval", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L419-L422
29,553
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.linspace
public static function linspace($start, $stop, int $num): \CArray { return parent::linspace($start, $stop, $num); }
php
public static function linspace($start, $stop, int $num): \CArray { return parent::linspace($start, $stop, $num); }
[ "public", "static", "function", "linspace", "(", "$", "start", ",", "$", "stop", ",", "int", "$", "num", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "linspace", "(", "$", "start", ",", "$", "stop", ",", "$", "num", ")", ";", "}" ]
CArray with evenly spaced numbers over a specified interval. @param $start The starting value of the sequence. @param $stop The end value of the sequence @param int $num Number of samples to generate. Default is 50. @return \CArray
[ "CArray", "with", "evenly", "spaced", "numbers", "over", "a", "specified", "interval", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L433-L436
29,554
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.logspace
public static function logspace($start, $stop, int $num, $base): \CArray { return parent::logspace($start, $stop, $num, $base); }
php
public static function logspace($start, $stop, int $num, $base): \CArray { return parent::logspace($start, $stop, $num, $base); }
[ "public", "static", "function", "logspace", "(", "$", "start", ",", "$", "stop", ",", "int", "$", "num", ",", "$", "base", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "logspace", "(", "$", "start", ",", "$", "stop", ",", "$", "num", ...
CArray with numbers spaced evenly on a log scale. @param $start The starting value of the sequence. @param $stop The final value of the sequence @param int $num (optional) Number of samples to generate. Default is 50. @param $base (optional) The base of the log space. @return \CArray $num samples, equall...
[ "CArray", "with", "numbers", "spaced", "evenly", "on", "a", "log", "scale", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L448-L451
29,555
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.matmul
public static function matmul(\CArray $a, \CArray $b): \CArray { return parent::matmul($a, $b); }
php
public static function matmul(\CArray $a, \CArray $b): \CArray { return parent::matmul($a, $b); }
[ "public", "static", "function", "matmul", "(", "\\", "CArray", "$", "a", ",", "\\", "CArray", "$", "b", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "matmul", "(", "$", "a", ",", "$", "b", ")", ";", "}" ]
Matrix product of two CArrays. - If both arguments are 2-D they are multiplied like conventional matrices. - If the first argument is 1-D, it is promoted to a matrix by prepending a 1 to its dimensions. After matrix multiplication the prepended 1 is removed. - If the second argument is 1-D, it is promoted to a matrix ...
[ "Matrix", "product", "of", "two", "CArrays", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L483-L486
29,556
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.inner
public static function inner(\CArray $a, \CArray $b): \CArray { return parent::inner($a, $b); }
php
public static function inner(\CArray $a, \CArray $b): \CArray { return parent::inner($a, $b); }
[ "public", "static", "function", "inner", "(", "\\", "CArray", "$", "a", ",", "\\", "CArray", "$", "b", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "inner", "(", "$", "a", ",", "$", "b", ")", ";", "}" ]
Inner product of two CArrays. If 1D - Ordinary inner product of vectors If 2D - Sum product over the last axes. @param \CArray $a Target $a CArray - Last Dimension must match $b @param \CArray $b Target $b CArray - Last Dimension must match $a @return \CArray Inner product of $a and $b
[ "Inner", "product", "of", "two", "CArrays", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L499-L502
29,557
phpsci/phpsci
src/PHPSci/Kernel/CArray/Wrapper.php
Wrapper.solve
public static function solve(\CArray $a, \CArray $b): \CArray { return parent::solve($a, $b); }
php
public static function solve(\CArray $a, \CArray $b): \CArray { return parent::solve($a, $b); }
[ "public", "static", "function", "solve", "(", "\\", "CArray", "$", "a", ",", "\\", "CArray", "$", "b", ")", ":", "\\", "CArray", "{", "return", "parent", "::", "solve", "(", "$", "a", ",", "$", "b", ")", ";", "}" ]
Solve a linear matrix equation @param \CArray $a Coefficient CArray @param \CArray $b Ordinate CArray @return \CArray Solution of the system $a x = $b. Returned shape is same as $b.
[ "Solve", "a", "linear", "matrix", "equation" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Kernel/CArray/Wrapper.php#L561-L564
29,558
phpsci/phpsci
src/PHPSci/NaiveBayes/GaussianNB.php
GaussianNB.fit
public function fit(\CArray $X, \CArray $y, \CArray $sample_weight = null) { list($X, $y) = ValidationUtils::check_X_y($X, $y); return $this->_partial_fit($X, $y, CArray::unique($y), true, $sample_weight); }
php
public function fit(\CArray $X, \CArray $y, \CArray $sample_weight = null) { list($X, $y) = ValidationUtils::check_X_y($X, $y); return $this->_partial_fit($X, $y, CArray::unique($y), true, $sample_weight); }
[ "public", "function", "fit", "(", "\\", "CArray", "$", "X", ",", "\\", "CArray", "$", "y", ",", "\\", "CArray", "$", "sample_weight", "=", "null", ")", "{", "list", "(", "$", "X", ",", "$", "y", ")", "=", "ValidationUtils", "::", "check_X_y", "(", ...
Fit Gaussian Naive Bayes according to X, y @param \CArray $X @param \CArray $y @param \CArray|null $sample_weight @return void @throws \PHPSci\Exceptions\ValueErrorException
[ "Fit", "Gaussian", "Naive", "Bayes", "according", "to", "X", "y" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/NaiveBayes/GaussianNB.php#L195-L199
29,559
phpsci/phpsci
src/PHPSci/Utils/MulticlassUtils.php
MulticlassUtils._check_partial_fit_first_call
public static function _check_partial_fit_first_call(Classifier $clf, \CArray $classes = null) { if($clf->classes_() == null && !isset($classes) ) { throw new ValueErrorException("classes must be passed on the first call to partial_fit."); } if(isset($classes)) { if(...
php
public static function _check_partial_fit_first_call(Classifier $clf, \CArray $classes = null) { if($clf->classes_() == null && !isset($classes) ) { throw new ValueErrorException("classes must be passed on the first call to partial_fit."); } if(isset($classes)) { if(...
[ "public", "static", "function", "_check_partial_fit_first_call", "(", "Classifier", "$", "clf", ",", "\\", "CArray", "$", "classes", "=", "null", ")", "{", "if", "(", "$", "clf", "->", "classes_", "(", ")", "==", "null", "&&", "!", "isset", "(", "$", "...
Private helper function for factorizing common classes param logic Estimators that implement the ``partial_fit`` API need to be provided with the list of possible classes at the first call to partial_fit. Subsequent calls to partial_fit should check that ``classes`` is still consistent with a previous value of ``clf....
[ "Private", "helper", "function", "for", "factorizing", "common", "classes", "param", "logic" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Utils/MulticlassUtils.php#L34-L51
29,560
phpsci/phpsci
src/PHPSci/Utils/Datasets/SequentialDataset.php
SequentialDataset.next
public function next(\CArray $x_data_ptr = null, int $x_ind_ptr = null, int $nnz = null, float $y, float $sample_weight = null) { $current_index = $this->_get_next_index(); return $this->_sample($x_data_ptr, $x_ind_ptr, $nnz, $y, $sample_weight, $current_index); }
php
public function next(\CArray $x_data_ptr = null, int $x_ind_ptr = null, int $nnz = null, float $y, float $sample_weight = null) { $current_index = $this->_get_next_index(); return $this->_sample($x_data_ptr, $x_ind_ptr, $nnz, $y, $sample_weight, $current_index); }
[ "public", "function", "next", "(", "\\", "CArray", "$", "x_data_ptr", "=", "null", ",", "int", "$", "x_ind_ptr", "=", "null", ",", "int", "$", "nnz", "=", "null", ",", "float", "$", "y", ",", "float", "$", "sample_weight", "=", "null", ")", "{", "$...
Get the next example ``x`` from the dataset. This method gets the next sample looping sequentially over all samples. The order can be shuffled with the method ``shuffle``. Shuffling once before iterating over all samples corresponds to a random draw without replacement. It is used for instance in SGD solver. @param \...
[ "Get", "the", "next", "example", "x", "from", "the", "dataset", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Utils/Datasets/SequentialDataset.php#L106-L110
29,561
phpsci/phpsci
src/PHPSci/NaiveBayes/BaseNaiveBayes.php
BaseNaiveBayes.predict
public function predict(\CArray $X) { $predicted_classes = []; $jll = $this->_joint_log_likelihood($X); $predictions = CArray::toArray(CArray::argmax($jll, 1)); foreach($predictions as $pred) { $predicted_classes[] = $this->classes_[[(int)$pred]]; } return...
php
public function predict(\CArray $X) { $predicted_classes = []; $jll = $this->_joint_log_likelihood($X); $predictions = CArray::toArray(CArray::argmax($jll, 1)); foreach($predictions as $pred) { $predicted_classes[] = $this->classes_[[(int)$pred]]; } return...
[ "public", "function", "predict", "(", "\\", "CArray", "$", "X", ")", "{", "$", "predicted_classes", "=", "[", "]", ";", "$", "jll", "=", "$", "this", "->", "_joint_log_likelihood", "(", "$", "X", ")", ";", "$", "predictions", "=", "CArray", "::", "to...
Perform classification on an array of test vectors X. @param \CArray $X @return void
[ "Perform", "classification", "on", "an", "array", "of", "test", "vectors", "X", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/NaiveBayes/BaseNaiveBayes.php#L28-L37
29,562
phpsci/phpsci
src/PHPSci/Utils/WeightUtils.php
WeightUtils.compute_class_weight
public static function compute_class_weight(\CArray $class_weight = null, \CArray $classes, \CArray $y) : \CArray { if(CArray::unique($y)->x - CArray::unique($classes)->x) { throw new ValueErrorException("classes should include all valid labels that can be in y"); } if(!isset($c...
php
public static function compute_class_weight(\CArray $class_weight = null, \CArray $classes, \CArray $y) : \CArray { if(CArray::unique($y)->x - CArray::unique($classes)->x) { throw new ValueErrorException("classes should include all valid labels that can be in y"); } if(!isset($c...
[ "public", "static", "function", "compute_class_weight", "(", "\\", "CArray", "$", "class_weight", "=", "null", ",", "\\", "CArray", "$", "classes", ",", "\\", "CArray", "$", "y", ")", ":", "\\", "CArray", "{", "if", "(", "CArray", "::", "unique", "(", ...
Estimate class weights for unbalanced datasets. @see https://github.com/scikit-learn/scikit-learn/blob/a7e17117bb15eb3f51ebccc1bd53e42fcb4e6cd8/sklearn/utils/class_weight.py#L9 @param \CArray $class_weight @param \CArray $classes @param \CArray $y @return \CArray|void @throws ValueErrorException
[ "Estimate", "class", "weights", "for", "unbalanced", "datasets", "." ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Utils/WeightUtils.php#L24-L35
29,563
phpsci/phpsci
src/PHPSci/Plot/Plotter.php
Plotter.drawLabels
private function drawLabels() { $min_value = CArray::amin($this->data[0]); $max_value = CArray::amax($this->data[0]); $left = CArray::toArray( CArray::linspace($min_value, 0, 5, false) ); $right = CArray::toArray( CArray::linspace(0, $max_value, 5) ...
php
private function drawLabels() { $min_value = CArray::amin($this->data[0]); $max_value = CArray::amax($this->data[0]); $left = CArray::toArray( CArray::linspace($min_value, 0, 5, false) ); $right = CArray::toArray( CArray::linspace(0, $max_value, 5) ...
[ "private", "function", "drawLabels", "(", ")", "{", "$", "min_value", "=", "CArray", "::", "amin", "(", "$", "this", "->", "data", "[", "0", "]", ")", ";", "$", "max_value", "=", "CArray", "::", "amax", "(", "$", "this", "->", "data", "[", "0", "...
Draw Y Bottom Labels
[ "Draw", "Y", "Bottom", "Labels" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Plot/Plotter.php#L167-L233
29,564
phpsci/phpsci
src/PHPSci/Plot/Plotter.php
Plotter.addDot
public function addDot($x, $y, $w, $h, $rgb = [0, 0, 255]) { // choose a color for the ellipse $ellipseColor = imagecolorallocate($this->image(), $rgb[0], $rgb[1], $rgb[2]); // draw the blue ellipse imagefilledellipse($this->image(), $x, $y, $w, $h, $ellipseColor); }
php
public function addDot($x, $y, $w, $h, $rgb = [0, 0, 255]) { // choose a color for the ellipse $ellipseColor = imagecolorallocate($this->image(), $rgb[0], $rgb[1], $rgb[2]); // draw the blue ellipse imagefilledellipse($this->image(), $x, $y, $w, $h, $ellipseColor); }
[ "public", "function", "addDot", "(", "$", "x", ",", "$", "y", ",", "$", "w", ",", "$", "h", ",", "$", "rgb", "=", "[", "0", ",", "0", ",", "255", "]", ")", "{", "// choose a color for the ellipse", "$", "ellipseColor", "=", "imagecolorallocate", "(",...
Add dot to image @param $x @param $y @param $w @param $h @param array $rgb
[ "Add", "dot", "to", "image" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Plot/Plotter.php#L278-L284
29,565
phpsci/phpsci
src/PHPSci/Plot/Plotter.php
Plotter.addRectangle
public function addRectangle($x1, $y1, $x2, $y2, $colors = [0, 0, 0]) { $color = imagecolorallocate($this->image(), $colors[0], $colors[1], $colors[2]); imagerectangle ( $this->image() , $x1 , $y1 , $x2 , $y2 , $color ); }
php
public function addRectangle($x1, $y1, $x2, $y2, $colors = [0, 0, 0]) { $color = imagecolorallocate($this->image(), $colors[0], $colors[1], $colors[2]); imagerectangle ( $this->image() , $x1 , $y1 , $x2 , $y2 , $color ); }
[ "public", "function", "addRectangle", "(", "$", "x1", ",", "$", "y1", ",", "$", "x2", ",", "$", "y2", ",", "$", "colors", "=", "[", "0", ",", "0", ",", "0", "]", ")", "{", "$", "color", "=", "imagecolorallocate", "(", "$", "this", "->", "image"...
Add Rectangle to Graph @param $x1 @param $y1 @param $x2 @param $y2 @param array $colors
[ "Add", "Rectangle", "to", "Graph" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Plot/Plotter.php#L294-L298
29,566
phpsci/phpsci
src/PHPSci/Plot/Plotter.php
Plotter.generateGrid
private function generateGrid() { $this->addRectangle( $this->grid_padding, ($this->height-$this->grid_padding), ($this->width-$this->grid_padding), $this->grid_padding ); }
php
private function generateGrid() { $this->addRectangle( $this->grid_padding, ($this->height-$this->grid_padding), ($this->width-$this->grid_padding), $this->grid_padding ); }
[ "private", "function", "generateGrid", "(", ")", "{", "$", "this", "->", "addRectangle", "(", "$", "this", "->", "grid_padding", ",", "(", "$", "this", "->", "height", "-", "$", "this", "->", "grid_padding", ")", ",", "(", "$", "this", "->", "width", ...
Generate Graph Grid
[ "Generate", "Graph", "Grid" ]
d25b705ad63e4af8ed1dbc8a1c4f776a97312286
https://github.com/phpsci/phpsci/blob/d25b705ad63e4af8ed1dbc8a1c4f776a97312286/src/PHPSci/Plot/Plotter.php#L303-L311
29,567
polyfony-inc/polyfony
Private/Polyfony/Query/Convert.php
Convert.valueFromDatabase
public static function valueFromDatabase($column_name, $raw_value, $get_it_raw=false) { // if we want the raw result ok, but exclude arrays that can never be gotten raw if($get_it_raw === true && substr($column_name,-6,6) != '_array') { // return as is $value = $raw_value; } // if the column_name contain...
php
public static function valueFromDatabase($column_name, $raw_value, $get_it_raw=false) { // if we want the raw result ok, but exclude arrays that can never be gotten raw if($get_it_raw === true && substr($column_name,-6,6) != '_array') { // return as is $value = $raw_value; } // if the column_name contain...
[ "public", "static", "function", "valueFromDatabase", "(", "$", "column_name", ",", "$", "raw_value", ",", "$", "get_it_raw", "=", "false", ")", "{", "// if we want the raw result ok, but exclude arrays that can never be gotten raw", "if", "(", "$", "get_it_raw", "===", ...
convert a value comming from the database, to its original type
[ "convert", "a", "value", "comming", "from", "the", "database", "to", "its", "original", "type" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Query/Convert.php#L9-L48
29,568
polyfony-inc/polyfony
Private/Polyfony/Query/Convert.php
Convert.columnToPlaceholder
public static function columnToPlaceholder( string $quote_symbol, string $column, $allow_wildcard = false ) :array { // apply the secure regex for the column name $column = preg_replace(($allow_wildcard ? '/[^a-zA-Z0-9_\.\*]/' : '/[^a-zA-Z0-9_\.]/'), '', $column); // cleanup the pla...
php
public static function columnToPlaceholder( string $quote_symbol, string $column, $allow_wildcard = false ) :array { // apply the secure regex for the column name $column = preg_replace(($allow_wildcard ? '/[^a-zA-Z0-9_\.\*]/' : '/[^a-zA-Z0-9_\.]/'), '', $column); // cleanup the pla...
[ "public", "static", "function", "columnToPlaceholder", "(", "string", "$", "quote_symbol", ",", "string", "$", "column", ",", "$", "allow_wildcard", "=", "false", ")", ":", "array", "{", "// apply the secure regex for the column name", "$", "column", "=", "preg_repl...
get a column placeholder to build queries with
[ "get", "a", "column", "placeholder", "to", "build", "queries", "with" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Query/Convert.php#L98-L109
29,569
ventoviro/windwalker-core
src/Core/Cache/CacheManager.php
CacheManager.getCache
public function getCache( string $name = 'windwalker', string $storage = 'array', string $serializer = 'php', array $options = [] ): CacheInterface { $config = $this->config; $debug = $config->get('system.debug', false); $enabled = $config->get('cache.enabl...
php
public function getCache( string $name = 'windwalker', string $storage = 'array', string $serializer = 'php', array $options = [] ): CacheInterface { $config = $this->config; $debug = $config->get('system.debug', false); $enabled = $config->get('cache.enabl...
[ "public", "function", "getCache", "(", "string", "$", "name", "=", "'windwalker'", ",", "string", "$", "storage", "=", "'array'", ",", "string", "$", "serializer", "=", "'php'", ",", "array", "$", "options", "=", "[", "]", ")", ":", "CacheInterface", "{"...
Create cache object. @param string $name @param string $storage @param string $serializer @param array $options @return CacheInterface @throws \ReflectionException @throws \Windwalker\DI\Exception\DependencyResolutionException @deprecated Use getCacheInstance() instead.
[ "Create", "cache", "object", "." ]
0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074
https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Cache/CacheManager.php#L132-L151
29,570
ventoviro/windwalker-core
src/Core/Cache/CacheManager.php
CacheManager.ignoreGlobal
public function ignoreGlobal(?bool $bool = null): bool { if ($bool === null) { return $this->ignoreGlobal; } $this->ignoreGlobal = (bool) $bool; return $bool; }
php
public function ignoreGlobal(?bool $bool = null): bool { if ($bool === null) { return $this->ignoreGlobal; } $this->ignoreGlobal = (bool) $bool; return $bool; }
[ "public", "function", "ignoreGlobal", "(", "?", "bool", "$", "bool", "=", "null", ")", ":", "bool", "{", "if", "(", "$", "bool", "===", "null", ")", "{", "return", "$", "this", "->", "ignoreGlobal", ";", "}", "$", "this", "->", "ignoreGlobal", "=", ...
Method to get property IgnoreGlobal @param boolean $bool @return boolean
[ "Method", "to", "get", "property", "IgnoreGlobal" ]
0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074
https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Cache/CacheManager.php#L333-L342
29,571
polyfony-inc/polyfony
Private/Polyfony/Query/Conditions.php
Conditions.where
public function where(array $conditions) { // for each provided strict condition foreach($conditions as $column => $value) { // secure the column name list( $column, $placeholder ) = Convert::columnToPlaceholder($this->Quote ,$column); // save the condition $this->Conditions[] = "{$this->Ope...
php
public function where(array $conditions) { // for each provided strict condition foreach($conditions as $column => $value) { // secure the column name list( $column, $placeholder ) = Convert::columnToPlaceholder($this->Quote ,$column); // save the condition $this->Conditions[] = "{$this->Ope...
[ "public", "function", "where", "(", "array", "$", "conditions", ")", "{", "// for each provided strict condition", "foreach", "(", "$", "conditions", "as", "$", "column", "=>", "$", "value", ")", "{", "// secure the column name", "list", "(", "$", "column", ",",...
add a condition
[ "add", "a", "condition" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Query/Conditions.php#L9-L24
29,572
polyfony-inc/polyfony
Private/Polyfony/Query/Conditions.php
Conditions.whereEmpty
public function whereEmpty($conditions) { // if provided conditions are an array if(is_array($conditions)) { // for each condition foreach($conditions as $column) { // add the condition $this->whereEmpty($column); } } else { // secure the column name list( $column, $placeholder ...
php
public function whereEmpty($conditions) { // if provided conditions are an array if(is_array($conditions)) { // for each condition foreach($conditions as $column) { // add the condition $this->whereEmpty($column); } } else { // secure the column name list( $column, $placeholder ...
[ "public", "function", "whereEmpty", "(", "$", "conditions", ")", "{", "// if provided conditions are an array", "if", "(", "is_array", "(", "$", "conditions", ")", ")", "{", "// for each condition", "foreach", "(", "$", "conditions", "as", "$", "column", ")", "{...
we are still supporting NON-array parameter, this will be removed at some point in time
[ "we", "are", "still", "supporting", "NON", "-", "array", "parameter", "this", "will", "be", "removed", "at", "some", "point", "in", "time" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Query/Conditions.php#L185-L207
29,573
polyfony-inc/polyfony
Private/Polyfony/Security.php
Security.disconnect
public static function disconnect() :void { // first authenticate self::enforce(); // then close the session self::$_account->closeSession(); // and redirect to the exit route or fallback to the login route Response::setRedirect(Config::get('router', 'exit_route') ?: Config::get('router', 'login_route'))...
php
public static function disconnect() :void { // first authenticate self::enforce(); // then close the session self::$_account->closeSession(); // and redirect to the exit route or fallback to the login route Response::setRedirect(Config::get('router', 'exit_route') ?: Config::get('router', 'login_route'))...
[ "public", "static", "function", "disconnect", "(", ")", ":", "void", "{", "// first authenticate", "self", "::", "enforce", "(", ")", ";", "// then close the session", "self", "::", "$", "_account", "->", "closeSession", "(", ")", ";", "// and redirect to the exit...
authenticate then close the session
[ "authenticate", "then", "close", "the", "session" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Security.php#L49-L63
29,574
polyfony-inc/polyfony
Private/Polyfony/Security.php
Security.authenticate
protected static function authenticate() :void { // if we did not authenticate before if(!self::$_account) { // search for an enabled account with that session key and a non expired session $account = \Models\Accounts::getFirstEnabledWithNonExpiredSession( // the session key Cook::get(Config::get('sec...
php
protected static function authenticate() :void { // if we did not authenticate before if(!self::$_account) { // search for an enabled account with that session key and a non expired session $account = \Models\Accounts::getFirstEnabledWithNonExpiredSession( // the session key Cook::get(Config::get('sec...
[ "protected", "static", "function", "authenticate", "(", ")", ":", "void", "{", "// if we did not authenticate before", "if", "(", "!", "self", "::", "$", "_account", ")", "{", "// search for an enabled account with that session key and a non expired session", "$", "account"...
internal authentication method that will grant access based on an existing session
[ "internal", "authentication", "method", "that", "will", "grant", "access", "based", "on", "an", "existing", "session" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Security.php#L66-L94
29,575
polyfony-inc/polyfony
Private/Polyfony/Security.php
Security.login
protected static function login() :void { // look for users with this login $account = \Models\Accounts::getFirstEnabledWithLogin( Request::post( Config::get('security', 'login') ) ); // if the account does not exist/is not found if(!$account) { // we deny access self::refuse('Account does not exi...
php
protected static function login() :void { // look for users with this login $account = \Models\Accounts::getFirstEnabledWithLogin( Request::post( Config::get('security', 'login') ) ); // if the account does not exist/is not found if(!$account) { // we deny access self::refuse('Account does not exi...
[ "protected", "static", "function", "login", "(", ")", ":", "void", "{", "// look for users with this login", "$", "account", "=", "\\", "Models", "\\", "Accounts", "::", "getFirstEnabledWithLogin", "(", "Request", "::", "post", "(", "Config", "::", "get", "(", ...
internal login method that will open a session
[ "internal", "login", "method", "that", "will", "open", "a", "session" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Security.php#L97-L146
29,576
polyfony-inc/polyfony
Private/Polyfony/Security.php
Security.getSignature
public static function getSignature($mixed) :string { // compute a hash with (the provided string + salt + user agent + remote ip) return(hash(Config::get('security','algo'), self::getSafeUserAgent() . self::getSafeRemoteAddress() . Config::get('security','salt') . is_string($mixed) ? $mixed : json_encode($...
php
public static function getSignature($mixed) :string { // compute a hash with (the provided string + salt + user agent + remote ip) return(hash(Config::get('security','algo'), self::getSafeUserAgent() . self::getSafeRemoteAddress() . Config::get('security','salt') . is_string($mixed) ? $mixed : json_encode($...
[ "public", "static", "function", "getSignature", "(", "$", "mixed", ")", ":", "string", "{", "// compute a hash with (the provided string + salt + user agent + remote ip)", "return", "(", "hash", "(", "Config", "::", "get", "(", "'security'", ",", "'algo'", ")", ",", ...
internal method for generating unique signatures
[ "internal", "method", "for", "generating", "unique", "signatures" ]
76dac2f4141c8f480370236295c07dfa52e5c589
https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Security.php#L172-L178
29,577
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Layout/LayoutTrait.php
LayoutTrait.setStructure
public function setStructure(array $layouts) { $computedLayouts = []; foreach ($layouts as $l) { $loop = isset($l['loop']) ? (int)$l['loop'] : 1; unset($l['loop']); for ($i=0; $i<$loop; $i++) { $computedLayouts[] = $l; } } ...
php
public function setStructure(array $layouts) { $computedLayouts = []; foreach ($layouts as $l) { $loop = isset($l['loop']) ? (int)$l['loop'] : 1; unset($l['loop']); for ($i=0; $i<$loop; $i++) { $computedLayouts[] = $l; } } ...
[ "public", "function", "setStructure", "(", "array", "$", "layouts", ")", "{", "$", "computedLayouts", "=", "[", "]", ";", "foreach", "(", "$", "layouts", "as", "$", "l", ")", "{", "$", "loop", "=", "isset", "(", "$", "l", "[", "'loop'", "]", ")", ...
Prepare the layouts configuration in a simpler, ready, data structure. This function goes through the layout options to expand loops into extra layout data... @param array $layouts The original layout data, typically from configuration. @return array Computed layouts, ready for looping
[ "Prepare", "the", "layouts", "configuration", "in", "a", "simpler", "ready", "data", "structure", "." ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Layout/LayoutTrait.php#L54-L68
29,578
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Layout/LayoutTrait.php
LayoutTrait.rowIndex
public function rowIndex($position = null) { if ($position === null) { $position = $this->position(); } $i = 0; $p = 0; foreach ($this->structure as $row_ident => $row) { $numCells = count($row['columns']); $p += $numCells; if ...
php
public function rowIndex($position = null) { if ($position === null) { $position = $this->position(); } $i = 0; $p = 0; foreach ($this->structure as $row_ident => $row) { $numCells = count($row['columns']); $p += $numCells; if ...
[ "public", "function", "rowIndex", "(", "$", "position", "=", "null", ")", "{", "if", "(", "$", "position", "===", "null", ")", "{", "$", "position", "=", "$", "this", "->", "position", "(", ")", ";", "}", "$", "i", "=", "0", ";", "$", "p", "=",...
Get the row index at a certain position @param integer $position Optional. Forced position. @return integer|null
[ "Get", "the", "row", "index", "at", "a", "certain", "position" ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Layout/LayoutTrait.php#L95-L112
29,579
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Layout/LayoutTrait.php
LayoutTrait.rowData
public function rowData($position = null) { if ($position === null) { $position = $this->position(); } $rowIndex = $this->rowIndex($position); if (isset($this->structure[$rowIndex])) { return $this->structure[$rowIndex]; } else { return nu...
php
public function rowData($position = null) { if ($position === null) { $position = $this->position(); } $rowIndex = $this->rowIndex($position); if (isset($this->structure[$rowIndex])) { return $this->structure[$rowIndex]; } else { return nu...
[ "public", "function", "rowData", "(", "$", "position", "=", "null", ")", "{", "if", "(", "$", "position", "===", "null", ")", "{", "$", "position", "=", "$", "this", "->", "position", "(", ")", ";", "}", "$", "rowIndex", "=", "$", "this", "->", "...
Get the row information If no `$position` is specified, then the current position will be used. @param integer $position Optional. Forced position. @return array|null
[ "Get", "the", "row", "information" ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Layout/LayoutTrait.php#L122-L134
29,580
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Layout/LayoutTrait.php
LayoutTrait.rowNumCells
public function rowNumCells($position = null) { if ($position === null) { $position = $this->position(); } // Get the data ta position $row = $this->rowData($position); $numCells = isset($row['columns']) ? count($row['columns']) : null; return $numCells; ...
php
public function rowNumCells($position = null) { if ($position === null) { $position = $this->position(); } // Get the data ta position $row = $this->rowData($position); $numCells = isset($row['columns']) ? count($row['columns']) : null; return $numCells; ...
[ "public", "function", "rowNumCells", "(", "$", "position", "=", "null", ")", "{", "if", "(", "$", "position", "===", "null", ")", "{", "$", "position", "=", "$", "this", "->", "position", "(", ")", ";", "}", "// Get the data ta position", "$", "row", "...
Get the number of cells at current position This can be different than the number of columns, in case @param integer $position Optional. Forced position. @return integer
[ "Get", "the", "number", "of", "cells", "at", "current", "position" ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Layout/LayoutTrait.php#L164-L174
29,581
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Layout/LayoutTrait.php
LayoutTrait.cellRowIndex
public function cellRowIndex($position = null) { if ($position === null) { $position = $this->position(); } $first = $this->rowFirstCellIndex($position); return ($position - $first); }
php
public function cellRowIndex($position = null) { if ($position === null) { $position = $this->position(); } $first = $this->rowFirstCellIndex($position); return ($position - $first); }
[ "public", "function", "cellRowIndex", "(", "$", "position", "=", "null", ")", "{", "if", "(", "$", "position", "===", "null", ")", "{", "$", "position", "=", "$", "this", "->", "position", "(", ")", ";", "}", "$", "first", "=", "$", "this", "->", ...
Get the cell index in the current row @param integer $position Optional. Forced position. @return integer
[ "Get", "the", "cell", "index", "in", "the", "current", "row" ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Layout/LayoutTrait.php#L217-L225
29,582
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Layout/LayoutTrait.php
LayoutTrait.numCellsTotal
public function numCellsTotal() { $numCells = 0; foreach ($this->structure as $row) { $rowCols = isset($row['columns']) ? count($row['columns']) : 0; $numCells += $rowCols; } return $numCells; }
php
public function numCellsTotal() { $numCells = 0; foreach ($this->structure as $row) { $rowCols = isset($row['columns']) ? count($row['columns']) : 0; $numCells += $rowCols; } return $numCells; }
[ "public", "function", "numCellsTotal", "(", ")", "{", "$", "numCells", "=", "0", ";", "foreach", "(", "$", "this", "->", "structure", "as", "$", "row", ")", "{", "$", "rowCols", "=", "isset", "(", "$", "row", "[", "'columns'", "]", ")", "?", "count...
Get the total number of cells, in all rows @return integer
[ "Get", "the", "total", "number", "of", "cells", "in", "all", "rows" ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Layout/LayoutTrait.php#L232-L240
29,583
acdh-oeaw/repo-php-util
src/acdhOeaw/fedora/dissemination/parameter/UriPart.php
UriPart.transform
public function transform(string $value, string ...$parts): string { $value = parse_url($value); $toUnset = ['scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment']; $toUnset = array_intersect(array_diff($toUnset, $parts), array_keys($value)); foreach ($toUnset as $i) { ...
php
public function transform(string $value, string ...$parts): string { $value = parse_url($value); $toUnset = ['scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment']; $toUnset = array_intersect(array_diff($toUnset, $parts), array_keys($value)); foreach ($toUnset as $i) { ...
[ "public", "function", "transform", "(", "string", "$", "value", ",", "string", "...", "$", "parts", ")", ":", "string", "{", "$", "value", "=", "parse_url", "(", "$", "value", ")", ";", "$", "toUnset", "=", "[", "'scheme'", ",", "'host'", ",", "'port...
Extracts given URL parts. @param string $value URL to be transformed @param ... $parts parts to be extracted. One of: scheme (e.g. "https", "ftp", etc.), host, port, user, pass, path, query, fragment (part of the URL following #) @return string
[ "Extracts", "given", "URL", "parts", "." ]
e22c7cd2613f3c8daf0deee879896d9cd7f61b41
https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/dissemination/parameter/UriPart.php#L55-L75
29,584
Blobfolio/blob-common
lib/blobfolio/common/file.php
file.data_uri
public static function data_uri(string $path) { ref\cast::string($path, true); ref\file::path($path, true); if ((false !== $path) && @\is_file($path)) { $content = \base64_encode(@\file_get_contents($path)); $finfo = mime::finfo($path); return "data:{$finfo['mime']};base64,{$content}"; } return fa...
php
public static function data_uri(string $path) { ref\cast::string($path, true); ref\file::path($path, true); if ((false !== $path) && @\is_file($path)) { $content = \base64_encode(@\file_get_contents($path)); $finfo = mime::finfo($path); return "data:{$finfo['mime']};base64,{$content}"; } return fa...
[ "public", "static", "function", "data_uri", "(", "string", "$", "path", ")", "{", "ref", "\\", "cast", "::", "string", "(", "$", "path", ",", "true", ")", ";", "ref", "\\", "file", "::", "path", "(", "$", "path", ",", "true", ")", ";", "if", "(",...
Get Data-URI From File @param string $path Path. @return string|bool Data-URI or false.
[ "Get", "Data", "-", "URI", "From", "File" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/file.php#L170-L182
29,585
Blobfolio/blob-common
lib/blobfolio/common/file.php
file.empty_dir
public static function empty_dir(string $path) { if (! @\is_readable($path) || ! @\is_dir($path)) { return false; } // Scan all files in dir. if ($handle = @\opendir($path)) { while (false !== ($file = @\readdir($handle))) { // Anything but a dot === not empty. if (('.' !== $file) && ('..' !== $f...
php
public static function empty_dir(string $path) { if (! @\is_readable($path) || ! @\is_dir($path)) { return false; } // Scan all files in dir. if ($handle = @\opendir($path)) { while (false !== ($file = @\readdir($handle))) { // Anything but a dot === not empty. if (('.' !== $file) && ('..' !== $f...
[ "public", "static", "function", "empty_dir", "(", "string", "$", "path", ")", "{", "if", "(", "!", "@", "\\", "is_readable", "(", "$", "path", ")", "||", "!", "@", "\\", "is_dir", "(", "$", "path", ")", ")", "{", "return", "false", ";", "}", "// ...
Is Directory Empty? @param string $path Path. @return bool True/false.
[ "Is", "Directory", "Empty?" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/file.php#L205-L223
29,586
Blobfolio/blob-common
lib/blobfolio/common/file.php
file.mkdir
public static function mkdir(string $path, $chmod=null) { // Figure out a good default CHMOD. if (! $chmod || ! \is_numeric($chmod)) { $chmod = (\fileperms(__DIR__) & 0777 | 0755); } // Sanitize the path. ref\file::path($path, false); if (! $path || (false !== \strpos($path, '://'))) { return false; ...
php
public static function mkdir(string $path, $chmod=null) { // Figure out a good default CHMOD. if (! $chmod || ! \is_numeric($chmod)) { $chmod = (\fileperms(__DIR__) & 0777 | 0755); } // Sanitize the path. ref\file::path($path, false); if (! $path || (false !== \strpos($path, '://'))) { return false; ...
[ "public", "static", "function", "mkdir", "(", "string", "$", "path", ",", "$", "chmod", "=", "null", ")", "{", "// Figure out a good default CHMOD.", "if", "(", "!", "$", "chmod", "||", "!", "\\", "is_numeric", "(", "$", "chmod", ")", ")", "{", "$", "c...
Resursively Make Directory PHP's mkdir function can be recursive, but the permissions are only set correctly on the innermost folder created. @param string $path Path. @param int $chmod CHMOD. @return bool True/false.
[ "Resursively", "Make", "Directory" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/file.php#L352-L413
29,587
Blobfolio/blob-common
lib/blobfolio/common/file.php
file.readfile_chunked
public static function readfile_chunked(string $file, bool $retbytes=true) { if (! $file || ! @\is_file($file)) { return false; } $buffer = ''; $cnt = 0; $chunk_size = 1024 * 1024; if (false === ($handle = @\fopen($file, 'rb'))) { return false; } while (! @\feof($handle)) { $buffer = @\fread...
php
public static function readfile_chunked(string $file, bool $retbytes=true) { if (! $file || ! @\is_file($file)) { return false; } $buffer = ''; $cnt = 0; $chunk_size = 1024 * 1024; if (false === ($handle = @\fopen($file, 'rb'))) { return false; } while (! @\feof($handle)) { $buffer = @\fread...
[ "public", "static", "function", "readfile_chunked", "(", "string", "$", "file", ",", "bool", "$", "retbytes", "=", "true", ")", "{", "if", "(", "!", "$", "file", "||", "!", "@", "\\", "is_file", "(", "$", "file", ")", ")", "{", "return", "false", "...
Read File in Chunks This greatly reduces overhead if serving files through a PHP gateway script. @param string $file Path. @param bool $retbytes Return bytes served like `readfile()`. @return mixed Bytes served or status.
[ "Read", "File", "in", "Chunks" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/file.php#L437-L468
29,588
Blobfolio/blob-common
lib/blobfolio/common/file.php
file.rmdir
public static function rmdir(string $path) { ref\file::path($path, true); if (! $path || ! @\is_readable($path) || ! @\is_dir($path)) { return false; } // Scan all files in dir. if ($handle = @\opendir($path)) { while (false !== ($entry = @\readdir($handle))) { // Anything but a dot === not empty. ...
php
public static function rmdir(string $path) { ref\file::path($path, true); if (! $path || ! @\is_readable($path) || ! @\is_dir($path)) { return false; } // Scan all files in dir. if ($handle = @\opendir($path)) { while (false !== ($entry = @\readdir($handle))) { // Anything but a dot === not empty. ...
[ "public", "static", "function", "rmdir", "(", "string", "$", "path", ")", "{", "ref", "\\", "file", "::", "path", "(", "$", "path", ",", "true", ")", ";", "if", "(", "!", "$", "path", "||", "!", "@", "\\", "is_readable", "(", "$", "path", ")", ...
Recursively Remove A Directory @param string $path Path. @return bool True/false.
[ "Recursively", "Remove", "A", "Directory" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/file.php#L501-L534
29,589
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Form/FormTrait.php
FormTrait.setGroups
public function setGroups(array $groups) { $this->groups = []; foreach ($groups as $groupIdent => $group) { $this->addGroup($groupIdent, $group); } return $this; }
php
public function setGroups(array $groups) { $this->groups = []; foreach ($groups as $groupIdent => $group) { $this->addGroup($groupIdent, $group); } return $this; }
[ "public", "function", "setGroups", "(", "array", "$", "groups", ")", "{", "$", "this", "->", "groups", "=", "[", "]", ";", "foreach", "(", "$", "groups", "as", "$", "groupIdent", "=>", "$", "group", ")", "{", "$", "this", "->", "addGroup", "(", "$"...
Set the object's form groups. @param array $groups A collection of group structures. @return FormInterface Chainable
[ "Set", "the", "object", "s", "form", "groups", "." ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Form/FormTrait.php#L227-L236
29,590
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Form/FormTrait.php
FormTrait.addGroup
public function addGroup($groupIdent, $group) { if ($group === false || $group === null) { return $this; } $group = $this->parseFormGroup($groupIdent, $group); if (isset($group['ident'])) { $groupIdent = $group['ident']; } $this->groups[$gro...
php
public function addGroup($groupIdent, $group) { if ($group === false || $group === null) { return $this; } $group = $this->parseFormGroup($groupIdent, $group); if (isset($group['ident'])) { $groupIdent = $group['ident']; } $this->groups[$gro...
[ "public", "function", "addGroup", "(", "$", "groupIdent", ",", "$", "group", ")", "{", "if", "(", "$", "group", "===", "false", "||", "$", "group", "===", "null", ")", "{", "return", "$", "this", ";", "}", "$", "group", "=", "$", "this", "->", "p...
Add a form group. @param string $groupIdent The group identifier. @param array|FormGroupInterface $group The group object or structure. @throws InvalidArgumentException If the identifier is not a string or the group is invalid. @return FormInterface Chainable
[ "Add", "a", "form", "group", "." ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Form/FormTrait.php#L284-L299
29,591
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Form/FormTrait.php
FormTrait.groups
public function groups(callable $groupCallback = null) { $groups = $this->groups; uasort($groups, [ $this, 'sortItemsByPriority' ]); $groupCallback = (isset($groupCallback) ? $groupCallback : $this->groupCallback); $groups = $this->finalizeFormGroups($groups); $i = 1; ...
php
public function groups(callable $groupCallback = null) { $groups = $this->groups; uasort($groups, [ $this, 'sortItemsByPriority' ]); $groupCallback = (isset($groupCallback) ? $groupCallback : $this->groupCallback); $groups = $this->finalizeFormGroups($groups); $i = 1; ...
[ "public", "function", "groups", "(", "callable", "$", "groupCallback", "=", "null", ")", "{", "$", "groups", "=", "$", "this", "->", "groups", ";", "uasort", "(", "$", "groups", ",", "[", "$", "this", ",", "'sortItemsByPriority'", "]", ")", ";", "$", ...
Retrieve the form groups. @param callable $groupCallback Optional callback applied to each form group. @return FormGroupInterface[]|Generator
[ "Retrieve", "the", "form", "groups", "." ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Form/FormTrait.php#L404-L433
29,592
locomotivemtl/charcoal-ui
src/Charcoal/Ui/Form/FormTrait.php
FormTrait.setGroupDisplayMode
public function setGroupDisplayMode($mode) { if (!is_string($mode)) { throw new InvalidArgumentException( 'Display mode must be a string' ); } if ($mode === 'tabs') { $mode = 'tab'; } $this->groupDisplayMode = $mode; ...
php
public function setGroupDisplayMode($mode) { if (!is_string($mode)) { throw new InvalidArgumentException( 'Display mode must be a string' ); } if ($mode === 'tabs') { $mode = 'tab'; } $this->groupDisplayMode = $mode; ...
[ "public", "function", "setGroupDisplayMode", "(", "$", "mode", ")", "{", "if", "(", "!", "is_string", "(", "$", "mode", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Display mode must be a string'", ")", ";", "}", "if", "(", "$", "mode", ...
Set the widget's content group display mode. Currently only supports "tab". @param string $mode Group display mode. @throws InvalidArgumentException If the display mode is not a string. @return ObjectFormWidget Chainable.
[ "Set", "the", "widget", "s", "content", "group", "display", "mode", "." ]
0070f35d89ea24ae93720734d261c02a10e218b6
https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Form/FormTrait.php#L558-L573
29,593
diff-sniffer/core
src/Runner.php
Runner.run
public function run(Changeset $changeset) { $diff = new Diff($changeset->getDiff()); if (!count($diff)) { return 0; } $reporter = new Reporter($diff, $this->config); $runner = new BaseRunner(); $runner->config = $this->config; $runner->reporter ...
php
public function run(Changeset $changeset) { $diff = new Diff($changeset->getDiff()); if (!count($diff)) { return 0; } $reporter = new Reporter($diff, $this->config); $runner = new BaseRunner(); $runner->config = $this->config; $runner->reporter ...
[ "public", "function", "run", "(", "Changeset", "$", "changeset", ")", "{", "$", "diff", "=", "new", "Diff", "(", "$", "changeset", "->", "getDiff", "(", ")", ")", ";", "if", "(", "!", "count", "(", "$", "diff", ")", ")", "{", "return", "0", ";", ...
Runs CodeSniffer against specified changeset @param Changeset $changeset Changeset instance @return int @throws DeepExitException @throws Exception
[ "Runs", "CodeSniffer", "against", "specified", "changeset" ]
583369a5f5c91496862f6bdf60b69565da4bc05d
https://github.com/diff-sniffer/core/blob/583369a5f5c91496862f6bdf60b69565da4bc05d/src/Runner.php#L34-L59
29,594
Blobfolio/blob-common
wp/lib/blobcommon.php
blobcommon.get_release_info
protected static function get_release_info(string $key, $template) { // PHP 5.6.0 compatibility has been dropped, so nobody can // update until they update PHP. if (\version_compare(\PHP_VERSION, '7.2.0') < 0) { return false; } // Already pulled it? if (isset(static::$_release[$key])) { return static...
php
protected static function get_release_info(string $key, $template) { // PHP 5.6.0 compatibility has been dropped, so nobody can // update until they update PHP. if (\version_compare(\PHP_VERSION, '7.2.0') < 0) { return false; } // Already pulled it? if (isset(static::$_release[$key])) { return static...
[ "protected", "static", "function", "get_release_info", "(", "string", "$", "key", ",", "$", "template", ")", "{", "// PHP 5.6.0 compatibility has been dropped, so nobody can", "// update until they update PHP.", "if", "(", "\\", "version_compare", "(", "\\", "PHP_VERSION", ...
Parse Release File Both the plugin and library have JSON files containing release information. These files tell WordPress whether or not an update is available, and where to find it. @param string $key Header key containing JSON URI. @param array $template Data template. @return array Info.
[ "Parse", "Release", "File" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/wp/lib/blobcommon.php#L188-L242
29,595
Blobfolio/blob-common
wp/lib/blobcommon.php
blobcommon.check_plugin
protected static function check_plugin($key=null) { if (\is_null(static::$_plugin)) { // Pull the remote info and store it for later. if (false === ($remote = static::get_release_info('Info URI', static::PLUGIN_TEMPLATE))) { static::$_plugin = false; return static::$_plugin; } // Use the main plu...
php
protected static function check_plugin($key=null) { if (\is_null(static::$_plugin)) { // Pull the remote info and store it for later. if (false === ($remote = static::get_release_info('Info URI', static::PLUGIN_TEMPLATE))) { static::$_plugin = false; return static::$_plugin; } // Use the main plu...
[ "protected", "static", "function", "check_plugin", "(", "$", "key", "=", "null", ")", "{", "if", "(", "\\", "is_null", "(", "static", "::", "$", "_plugin", ")", ")", "{", "// Pull the remote info and store it for later.", "if", "(", "false", "===", "(", "$",...
Check Plugin Info Unlike with the Phar library, this function only gathers the release information. Downloads are handled some other way. @param string $key Key. @return mixed Details, detail, false.
[ "Check", "Plugin", "Info" ]
7b43d5526cc9d09853771d950b2956e98e680db1
https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/wp/lib/blobcommon.php#L339-L363
29,596
ventoviro/windwalker-core
src/Core/Composer/StarterInstaller.php
StarterInstaller.rootInstall
public static function rootInstall(Event $event) { include getcwd() . '/vendor/autoload.php'; $io = $event->getIO(); static::genSecretCode($io); static::genSecretConfig($io); // Complete $io->write('Install complete.'); }
php
public static function rootInstall(Event $event) { include getcwd() . '/vendor/autoload.php'; $io = $event->getIO(); static::genSecretCode($io); static::genSecretConfig($io); // Complete $io->write('Install complete.'); }
[ "public", "static", "function", "rootInstall", "(", "Event", "$", "event", ")", "{", "include", "getcwd", "(", ")", ".", "'/vendor/autoload.php'", ";", "$", "io", "=", "$", "event", "->", "getIO", "(", ")", ";", "static", "::", "genSecretCode", "(", "$",...
Do install. @param Event $event The command event. @return void
[ "Do", "install", "." ]
0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074
https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Composer/StarterInstaller.php#L31-L43
29,597
ventoviro/windwalker-core
src/Core/Composer/StarterInstaller.php
StarterInstaller.genSecretCode
protected static function genSecretCode(IOInterface $io) { $file = getcwd() . '/etc/conf/system.php'; $config = file_get_contents($file); $hash = 'Windwalker-' . hrtime(true); $salt = $io->ask("\nSalt to generate secret [{$hash}]: ", $hash); $config = str_replace('This-to...
php
protected static function genSecretCode(IOInterface $io) { $file = getcwd() . '/etc/conf/system.php'; $config = file_get_contents($file); $hash = 'Windwalker-' . hrtime(true); $salt = $io->ask("\nSalt to generate secret [{$hash}]: ", $hash); $config = str_replace('This-to...
[ "protected", "static", "function", "genSecretCode", "(", "IOInterface", "$", "io", ")", "{", "$", "file", "=", "getcwd", "(", ")", ".", "'/etc/conf/system.php'", ";", "$", "config", "=", "file_get_contents", "(", "$", "file", ")", ";", "$", "hash", "=", ...
Generate secret code. @param IOInterface $io @return void
[ "Generate", "secret", "code", "." ]
0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074
https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Composer/StarterInstaller.php#L52-L67
29,598
ventoviro/windwalker-core
src/Debugger/View/Database/DatabaseHtmlView.php
DatabaseHtmlView.highlightQuery
public function highlightQuery($query) { $newlineKeywords = '#\b(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND|CASE)\b#i'; $query = htmlspecialchars($query, ENT_QUOTES); $query = preg_replace($newlineKeywords, '<br />&#160;&#160;\\0', $query); $regex = [ ...
php
public function highlightQuery($query) { $newlineKeywords = '#\b(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND|CASE)\b#i'; $query = htmlspecialchars($query, ENT_QUOTES); $query = preg_replace($newlineKeywords, '<br />&#160;&#160;\\0', $query); $regex = [ ...
[ "public", "function", "highlightQuery", "(", "$", "query", ")", "{", "$", "newlineKeywords", "=", "'#\\b(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND|CASE)\\b#i'", ";", "$", "query", "=", "htmlspecialchars", "(", "$", "query", ",", "ENT_QUOTES", ...
Simple highlight for SQL queries. @param string $query The query to highlight. @return string Highlighted query string.
[ "Simple", "highlight", "for", "SQL", "queries", "." ]
0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074
https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Debugger/View/Database/DatabaseHtmlView.php#L50-L72
29,599
secucard/secucard-connect-php-sdk
src/SecucardConnect/Product/Services/IdentResultsService.php
IdentResultsService.getListByRequestIds
public function getListByRequestIds($ids) { $parts = []; foreach ($ids as $id) { $parts[] = 'request.id:' . $id; } $qp = new QueryParams(); $qp->query = join(' OR ', $parts); return $this->getList($qp); }
php
public function getListByRequestIds($ids) { $parts = []; foreach ($ids as $id) { $parts[] = 'request.id:' . $id; } $qp = new QueryParams(); $qp->query = join(' OR ', $parts); return $this->getList($qp); }
[ "public", "function", "getListByRequestIds", "(", "$", "ids", ")", "{", "$", "parts", "=", "[", "]", ";", "foreach", "(", "$", "ids", "as", "$", "id", ")", "{", "$", "parts", "[", "]", "=", "'request.id:'", ".", "$", "id", ";", "}", "$", "qp", ...
Returns an array of IdentResult instances for a given array of IdentRequest ids. @param array $ids The request ids. @return BaseCollection The obtained results. @throws ClientError @throws GuzzleException @throws ApiError @throws AuthError
[ "Returns", "an", "array", "of", "IdentResult", "instances", "for", "a", "given", "array", "of", "IdentRequest", "ids", "." ]
d990686095e4e02d0924fc12b9bf60140fe8efab
https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Product/Services/IdentResultsService.php#L30-L39