repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
phpnt/youtube | components/YouTubeData.php | YouTubeData.getStatistics | public function getStatistics($video_link = null, $video_id = null) {
$result = $this->checkVideo($video_link, $video_id, $part = 'statistics');
return $result;
} | php | public function getStatistics($video_link = null, $video_id = null) {
$result = $this->checkVideo($video_link, $video_id, $part = 'statistics');
return $result;
} | [
"public",
"function",
"getStatistics",
"(",
"$",
"video_link",
"=",
"null",
",",
"$",
"video_id",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"checkVideo",
"(",
"$",
"video_link",
",",
"$",
"video_id",
",",
"$",
"part",
"=",
"'statist... | /* Статистика видео. | [
"/",
"*",
"Статистика",
"видео",
"."
] | train | https://github.com/phpnt/youtube/blob/ee8d33f7dacf5ca1b511ddb24efe2a527b40b201/components/YouTubeData.php#L45-L48 |
phpnt/youtube | components/YouTubeData.php | YouTubeData.checkVideo | private function checkVideo($video_link = null, $video_id = null, $part) {
if (!$video_link && !$video_id) {
throw new UserException(Yii::t('app', 'Не отправлено свойство video_link или video_id.'));
}
if ($video_link && !$video_id) {
$array = explode('/', $video_link);
... | php | private function checkVideo($video_link = null, $video_id = null, $part) {
if (!$video_link && !$video_id) {
throw new UserException(Yii::t('app', 'Не отправлено свойство video_link или video_id.'));
}
if ($video_link && !$video_id) {
$array = explode('/', $video_link);
... | [
"private",
"function",
"checkVideo",
"(",
"$",
"video_link",
"=",
"null",
",",
"$",
"video_id",
"=",
"null",
",",
"$",
"part",
")",
"{",
"if",
"(",
"!",
"$",
"video_link",
"&&",
"!",
"$",
"video_id",
")",
"{",
"throw",
"new",
"UserException",
"(",
"Y... | Проверка существования видео
@param string $video_link
@param string $video_id
@param string $part
@throws UserException | [
"Проверка",
"существования",
"видео"
] | train | https://github.com/phpnt/youtube/blob/ee8d33f7dacf5ca1b511ddb24efe2a527b40b201/components/YouTubeData.php#L58-L78 |
gorkalaucirica/HipchatAPIv2Client | Client.php | Client.get | public function get($resource, $query = array())
{
$url = $this->baseUrl . $resource;
if (count($query) > 0) {
$url .= "?";
}
foreach ($query as $key => $value) {
$url .= "$key=$value&";
}
$headers = array("Authorization" => $this->auth->getC... | php | public function get($resource, $query = array())
{
$url = $this->baseUrl . $resource;
if (count($query) > 0) {
$url .= "?";
}
foreach ($query as $key => $value) {
$url .= "$key=$value&";
}
$headers = array("Authorization" => $this->auth->getC... | [
"public",
"function",
"get",
"(",
"$",
"resource",
",",
"$",
"query",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"baseUrl",
".",
"$",
"resource",
";",
"if",
"(",
"count",
"(",
"$",
"query",
")",
">",
"0",
")",
"{",
... | Common get request for all API calls
@param string $resource The path to the resource wanted. For example v2/room
@param array $query Parameters to filter the response for example array('max-results' => 50)
@return array Decoded array containing response
@throws Exception\RequestException | [
"Common",
"get",
"request",
"for",
"all",
"API",
"calls"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Client.php#L64-L88 |
gorkalaucirica/HipchatAPIv2Client | Client.php | Client.post | public function post($resource, $content)
{
$url = $this->baseUrl . $resource;
$headers = array(
'Content-Type' => 'application/json',
'Authorization' => $this->auth->getCredential()
);
try {
$response = $this->browser->post($url, $headers, json_... | php | public function post($resource, $content)
{
$url = $this->baseUrl . $resource;
$headers = array(
'Content-Type' => 'application/json',
'Authorization' => $this->auth->getCredential()
);
try {
$response = $this->browser->post($url, $headers, json_... | [
"public",
"function",
"post",
"(",
"$",
"resource",
",",
"$",
"content",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"baseUrl",
".",
"$",
"resource",
";",
"$",
"headers",
"=",
"array",
"(",
"'Content-Type'",
"=>",
"'application/json'",
",",
"'Authoriza... | Common post request for all API calls
@param string $resource The path to the resource wanted. For example v2/room
@param array $content Parameters be posted for example:
array(
'name' => 'Example name',
'privacy' => 'private',
'is_archived' => 'false',
'is_guest_accessible' => 'fals... | [
"Common",
"post",
"request",
"for",
"all",
"API",
"calls"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Client.php#L106-L126 |
crysalead/net | src/Transport/Protocol/Smtp.php | Smtp.connect | protected function connect()
{
$schema = ($this->_secure === 'ssl' || $this->_secure === 'tls' ? $this->_secure . '://' : '');
$url = $schema . $this->_host . ':' . $this->_port;
$this->_connection = stream_socket_client($url, $errno, $error, $this->_timeout, STREAM_CLIENT_CONNECT, $this->_... | php | protected function connect()
{
$schema = ($this->_secure === 'ssl' || $this->_secure === 'tls' ? $this->_secure . '://' : '');
$url = $schema . $this->_host . ':' . $this->_port;
$this->_connection = stream_socket_client($url, $errno, $error, $this->_timeout, STREAM_CLIENT_CONNECT, $this->_... | [
"protected",
"function",
"connect",
"(",
")",
"{",
"$",
"schema",
"=",
"(",
"$",
"this",
"->",
"_secure",
"===",
"'ssl'",
"||",
"$",
"this",
"->",
"_secure",
"===",
"'tls'",
"?",
"$",
"this",
"->",
"_secure",
".",
"'://'",
":",
"''",
")",
";",
"$",... | Connects and authenticates to SMTP server. | [
"Connects",
"and",
"authenticates",
"to",
"SMTP",
"server",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Smtp.php#L122-L159 |
crysalead/net | src/Transport/Protocol/Smtp.php | Smtp.read | protected function read()
{
$buffer = '';
while (($line = fgets($this->_connection, 1000)) != null) { // intentionally ==
$buffer .= $line;
if (substr($line, 3, 1) === ' ') {
break;
}
}
return $buffer;
} | php | protected function read()
{
$buffer = '';
while (($line = fgets($this->_connection, 1000)) != null) { // intentionally ==
$buffer .= $line;
if (substr($line, 3, 1) === ' ') {
break;
}
}
return $buffer;
} | [
"protected",
"function",
"read",
"(",
")",
"{",
"$",
"buffer",
"=",
"''",
";",
"while",
"(",
"(",
"$",
"line",
"=",
"fgets",
"(",
"$",
"this",
"->",
"_connection",
",",
"1000",
")",
")",
"!=",
"null",
")",
"{",
"// intentionally ==",
"$",
"buffer",
... | Reads response from server. | [
"Reads",
"response",
"from",
"server",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Smtp.php#L164-L174 |
crysalead/net | src/Transport/Protocol/Smtp.php | Smtp.write | protected function write($line, $expectedCode = null, $message = null)
{
fwrite($this->_connection, $line . "\r\n");
if (!$expectedCode) {
return;
}
$response = $this->read();
if (!in_array((int) $response, (array) $expectedCode, true)) {
throw new Net... | php | protected function write($line, $expectedCode = null, $message = null)
{
fwrite($this->_connection, $line . "\r\n");
if (!$expectedCode) {
return;
}
$response = $this->read();
if (!in_array((int) $response, (array) $expectedCode, true)) {
throw new Net... | [
"protected",
"function",
"write",
"(",
"$",
"line",
",",
"$",
"expectedCode",
"=",
"null",
",",
"$",
"message",
"=",
"null",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"_connection",
",",
"$",
"line",
".",
"\"\\r\\n\"",
")",
";",
"if",
"(",
"!",
"... | Writes data to server and checks response against expected code if some provided.
@param int|int[] $expectedCode | [
"Writes",
"data",
"to",
"server",
"and",
"checks",
"response",
"against",
"expected",
"code",
"if",
"some",
"provided",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Smtp.php#L180-L190 |
crysalead/net | src/Transport/Protocol/Smtp.php | Smtp.send | public function send($mail)
{
$mail = clone $mail;
try {
if (!$this->_connection) {
$this->connect();
}
if (($from = $mail->returnPath()) || ($from = $mail->from())) {
$this->write("MAIL FROM:<" . $from->email() . ">", 250);
... | php | public function send($mail)
{
$mail = clone $mail;
try {
if (!$this->_connection) {
$this->connect();
}
if (($from = $mail->returnPath()) || ($from = $mail->from())) {
$this->write("MAIL FROM:<" . $from->email() . ">", 250);
... | [
"public",
"function",
"send",
"(",
"$",
"mail",
")",
"{",
"$",
"mail",
"=",
"clone",
"$",
"mail",
";",
"try",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_connection",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"}",
"if",
"(",
"(",
"... | Sends email.
@param object $mail A mail message.
@throws NetException | [
"Sends",
"email",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Smtp.php#L199-L230 |
chippyash/Strong-Type | src/Chippyash/Type/String/DigitType.php | DigitType.filter | protected function filter($value)
{
if (!is_scalar($value)) {
return $value;
}
$value = (string) $value;
if (!$this->hasPcreUnicodeSupport()) {
// POSIX named classes are not supported, use alternative 0-9 match
return preg_replace('/[^0-9]/', '',... | php | protected function filter($value)
{
if (!is_scalar($value)) {
return $value;
}
$value = (string) $value;
if (!$this->hasPcreUnicodeSupport()) {
// POSIX named classes are not supported, use alternative 0-9 match
return preg_replace('/[^0-9]/', '',... | [
"protected",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"if",
"(",
"!",
"$",
"thi... | Lifted entirely from the Zend framework so that we don't have to include
the Zend\Filter package and all its dependencies.
@param string $value
@return string|mixed
zendframework/zend-filter/Zend/Filter/Digits.php
Zend Framework (http://framework.zend.com/)
@link http://github.com/zendframework/zf2 for the can... | [
"Lifted",
"entirely",
"from",
"the",
"Zend",
"framework",
"so",
"that",
"we",
"don",
"t",
"have",
"to",
"include",
"the",
"Zend",
"\\",
"Filter",
"package",
"and",
"all",
"its",
"dependencies",
"."
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/String/DigitType.php#L62-L81 |
chippyash/Strong-Type | src/Chippyash/Type/String/DigitType.php | DigitType.hasPcreUnicodeSupport | protected function hasPcreUnicodeSupport()
{
if (static::$hasPcreUnicodeSupport === null) {
ErrorHandler::start();
static::$hasPcreUnicodeSupport =
defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') == 1;
ErrorHandler::stop();
}
... | php | protected function hasPcreUnicodeSupport()
{
if (static::$hasPcreUnicodeSupport === null) {
ErrorHandler::start();
static::$hasPcreUnicodeSupport =
defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') == 1;
ErrorHandler::stop();
}
... | [
"protected",
"function",
"hasPcreUnicodeSupport",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"hasPcreUnicodeSupport",
"===",
"null",
")",
"{",
"ErrorHandler",
"::",
"start",
"(",
")",
";",
"static",
"::",
"$",
"hasPcreUnicodeSupport",
"=",
"defined",
"(",
... | Lifted entirely from Zend Framework (http://framework.zend.com/) so we don't have
to include Zend/Stdlib
@link http://github.com/zendframework/zf2 for the canonical source repository
@copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
@license http://framework.zend.com/license/ne... | [
"Lifted",
"entirely",
"from",
"Zend",
"Framework",
"(",
"http",
":",
"//",
"framework",
".",
"zend",
".",
"com",
"/",
")",
"so",
"we",
"don",
"t",
"have",
"to",
"include",
"Zend",
"/",
"Stdlib"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/String/DigitType.php#L94-L103 |
DevGroup-ru/yii2-data-structure-tools | src/propertyHandler/RelatedEntity.php | RelatedEntity.existenceValidation | private function existenceValidation(Property $property)
{
$key = $property->key;
return [
$key,
'exist',
'targetClass' => $this->getRelatedClass($property),
'targetAttribute' => 'id',
'allowArray' => $property->allow_multiple_values,
... | php | private function existenceValidation(Property $property)
{
$key = $property->key;
return [
$key,
'exist',
'targetClass' => $this->getRelatedClass($property),
'targetAttribute' => 'id',
'allowArray' => $property->allow_multiple_values,
... | [
"private",
"function",
"existenceValidation",
"(",
"Property",
"$",
"property",
")",
"{",
"$",
"key",
"=",
"$",
"property",
"->",
"key",
";",
"return",
"[",
"$",
"key",
",",
"'exist'",
",",
"'targetClass'",
"=>",
"$",
"this",
"->",
"getRelatedClass",
"(",
... | @param Property $property
@return array Validation rule for checking existence of static_value row with specified ID
@warning If we are updating multiple models properties at once - we get lots of queries to db(1 for each model
in array) | [
"@param",
"Property",
"$property"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyHandler/RelatedEntity.php#L72-L85 |
DevGroup-ru/yii2-data-structure-tools | src/propertyHandler/RelatedEntity.php | RelatedEntity.beforePropertyModelSave | public function beforePropertyModelSave(Property &$property, $insert)
{
if ($property->canTranslate()) {
$property->data_type = Property::DATA_TYPE_INVARIANT_STRING;
}
$data = Yii::$app->request->post(Property::PACKED_HANDLER_PARAMS);
if (empty($data) === true) {
... | php | public function beforePropertyModelSave(Property &$property, $insert)
{
if ($property->canTranslate()) {
$property->data_type = Property::DATA_TYPE_INVARIANT_STRING;
}
$data = Yii::$app->request->post(Property::PACKED_HANDLER_PARAMS);
if (empty($data) === true) {
... | [
"public",
"function",
"beforePropertyModelSave",
"(",
"Property",
"&",
"$",
"property",
",",
"$",
"insert",
")",
"{",
"if",
"(",
"$",
"property",
"->",
"canTranslate",
"(",
")",
")",
"{",
"$",
"property",
"->",
"data_type",
"=",
"Property",
"::",
"DATA_TYP... | @param Property $property
@param bool $insert
@return bool | [
"@param",
"Property",
"$property",
"@param",
"bool",
"$insert"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyHandler/RelatedEntity.php#L99-L119 |
f3ath/appnexusclient | src/AppNexusClient.php | AppNexusClient.getNewToken | public function getNewToken()
{
$post = array(
'auth' => array(
'username' => $this->username,
'password' => $this->password,
),
);
return $this->http->call(HttpMethod::POST, $this->host.'/auth', $post)->token;
} | php | public function getNewToken()
{
$post = array(
'auth' => array(
'username' => $this->username,
'password' => $this->password,
),
);
return $this->http->call(HttpMethod::POST, $this->host.'/auth', $post)->token;
} | [
"public",
"function",
"getNewToken",
"(",
")",
"{",
"$",
"post",
"=",
"array",
"(",
"'auth'",
"=>",
"array",
"(",
"'username'",
"=>",
"$",
"this",
"->",
"username",
",",
"'password'",
"=>",
"$",
"this",
"->",
"password",
",",
")",
",",
")",
";",
"ret... | Get a new auth token from server
@return string | [
"Get",
"a",
"new",
"auth",
"token",
"from",
"server"
] | train | https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/AppNexusClient.php#L35-L44 |
f3ath/appnexusclient | src/AppNexusClient.php | AppNexusClient.call | public function call($method, $path, array $post = array())
{
$useCachedToken = true;
$token = $this->tokenStorage->get($this->username);
do {
if ( ! $token) { // expired or no token
$token = $this->getNewToken();
$this->tokenStorage->set($this->us... | php | public function call($method, $path, array $post = array())
{
$useCachedToken = true;
$token = $this->tokenStorage->get($this->username);
do {
if ( ! $token) { // expired or no token
$token = $this->getNewToken();
$this->tokenStorage->set($this->us... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"$",
"path",
",",
"array",
"$",
"post",
"=",
"array",
"(",
")",
")",
"{",
"$",
"useCachedToken",
"=",
"true",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"tokenStorage",
"->",
"get",
"(",
"$",
... | Call the server, (re)authenticating if necessary
@param string $method (GET|POST|PUT|DELETE)
@param string $path
@param array $post POST data
@return object Response object | [
"Call",
"the",
"server",
"(",
"re",
")",
"authenticating",
"if",
"necessary"
] | train | https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/AppNexusClient.php#L54-L71 |
ahmad-sa3d/saad-image | src/Image.php | Image.createThumbnail | public function createThumbnail($thumb_width = null, $thumb_height = null, $preserve_aspect = false) {
if ((is_numeric($thumb_width) && $thumb_width <= 0) || (is_numeric($thumb_height) && $thumb_height <= 0)) {
throw new ImageException(__METHOD__ . ' require width or height to be non negative numbers or zero.');
... | php | public function createThumbnail($thumb_width = null, $thumb_height = null, $preserve_aspect = false) {
if ((is_numeric($thumb_width) && $thumb_width <= 0) || (is_numeric($thumb_height) && $thumb_height <= 0)) {
throw new ImageException(__METHOD__ . ' require width or height to be non negative numbers or zero.');
... | [
"public",
"function",
"createThumbnail",
"(",
"$",
"thumb_width",
"=",
"null",
",",
"$",
"thumb_height",
"=",
"null",
",",
"$",
"preserve_aspect",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"is_numeric",
"(",
"$",
"thumb_width",
")",
"&&",
"$",
"thumb_width",... | Create Thumbnail Or Resize Image
@param number $thumb_width new width
@param number $thumb_height new height
@param boolean $preserve_aspect get neglected dimension according to originel aspect or set it as the other given dimension
@return object current instance to allow chaining | [
"Create",
"Thumbnail",
"Or",
"Resize",
"Image"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L124-L281 |
ahmad-sa3d/saad-image | src/Image.php | Image.setSaveOptions | public function setSaveOptions($file_name = null, $directory = null, $suffix = null) {
# Set Directory, or use Old if setted before from instance, or use img src directory
if ($directory) {
$this->_save_dir = rtrim($directory, DIRECTORY_SEPARATOR);
} else if (!$this->_save_dir) {
$this->_save_dir = $this->_... | php | public function setSaveOptions($file_name = null, $directory = null, $suffix = null) {
# Set Directory, or use Old if setted before from instance, or use img src directory
if ($directory) {
$this->_save_dir = rtrim($directory, DIRECTORY_SEPARATOR);
} else if (!$this->_save_dir) {
$this->_save_dir = $this->_... | [
"public",
"function",
"setSaveOptions",
"(",
"$",
"file_name",
"=",
"null",
",",
"$",
"directory",
"=",
"null",
",",
"$",
"suffix",
"=",
"null",
")",
"{",
"# Set Directory, or use Old if setted before from instance, or use img src directory",
"if",
"(",
"$",
"director... | Set Saving Options
@param String $file_name saving file name
@param String $directory directory to save into | [
"Set",
"Saving",
"Options"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L288-L315 |
ahmad-sa3d/saad-image | src/Image.php | Image.setOutputFormat | public function setOutputFormat($format = null, $quality = null, $filters = null) {
if ($format) {
$format = strtolower($format);
if (in_array($format, static::$_allowed_formates)) {
$this->_output_format = $format;
# fix file extension if this method was called after calling setSaveOptions Method
... | php | public function setOutputFormat($format = null, $quality = null, $filters = null) {
if ($format) {
$format = strtolower($format);
if (in_array($format, static::$_allowed_formates)) {
$this->_output_format = $format;
# fix file extension if this method was called after calling setSaveOptions Method
... | [
"public",
"function",
"setOutputFormat",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"quality",
"=",
"null",
",",
"$",
"filters",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"format",
")",
"{",
"$",
"format",
"=",
"strtolower",
"(",
"$",
"format",
")",
"... | Setting Output Format
@param String $format png, jpeg, jpg OR gif | [
"Setting",
"Output",
"Format"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L322-L377 |
ahmad-sa3d/saad-image | src/Image.php | Image.exportImage | public function exportImage($keep_resource = false) {
# export current resource image
array_unshift($this->_output_options, $this->_image_resource, $this->_save_path);
switch($this->_output_format) {
case 'jpeg' :
case 'jpg' :
if (!$this->_save_path) {
header('content-type: image/jpeg');
}
... | php | public function exportImage($keep_resource = false) {
# export current resource image
array_unshift($this->_output_options, $this->_image_resource, $this->_save_path);
switch($this->_output_format) {
case 'jpeg' :
case 'jpg' :
if (!$this->_save_path) {
header('content-type: image/jpeg');
}
... | [
"public",
"function",
"exportImage",
"(",
"$",
"keep_resource",
"=",
"false",
")",
"{",
"# export current resource image",
"array_unshift",
"(",
"$",
"this",
"->",
"_output_options",
",",
"$",
"this",
"->",
"_image_resource",
",",
"$",
"this",
"->",
"_save_path",
... | Save Or Output Current Image Resource
@return Boolean indicates to success or fail
@param $keep_resource Boolean If To Not Destroy Resource After Exporting, Useful If Weneed to continue on image resource | [
"Save",
"Or",
"Output",
"Current",
"Image",
"Resource"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L392-L440 |
ahmad-sa3d/saad-image | src/Image.php | Image.embed | public function embed($keep_resource = false) {
ob_start();
switch ($this->_output_format) {
case 'jpeg' :
case 'jpg' :
imagejpeg($this->_image_resource);
break;
case 'png':
imagepng($this->_image_resource);
break;
case 'gif':
imagegif($this->_image_resource);
break;
}
$st... | php | public function embed($keep_resource = false) {
ob_start();
switch ($this->_output_format) {
case 'jpeg' :
case 'jpg' :
imagejpeg($this->_image_resource);
break;
case 'png':
imagepng($this->_image_resource);
break;
case 'gif':
imagegif($this->_image_resource);
break;
}
$st... | [
"public",
"function",
"embed",
"(",
"$",
"keep_resource",
"=",
"false",
")",
"{",
"ob_start",
"(",
")",
";",
"switch",
"(",
"$",
"this",
"->",
"_output_format",
")",
"{",
"case",
"'jpeg'",
":",
"case",
"'jpg'",
":",
"imagejpeg",
"(",
"$",
"this",
"->",... | Get Image as embeded code
@param bool $keep_resource
@return string | [
"Get",
"Image",
"as",
"embeded",
"code"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L448-L473 |
ahmad-sa3d/saad-image | src/Image.php | Image.reset | public function reset() {
if (!$this->_image_resource_backup) {
throw new ImageException('Cannot restore, no backup has been taken for image resource');
}
$cloned = $this->cloneResource($this->_image_resource_backup);
$this->_image_resource = $cloned['resource'];
$this->updateImageInfo($cloned['width'], ... | php | public function reset() {
if (!$this->_image_resource_backup) {
throw new ImageException('Cannot restore, no backup has been taken for image resource');
}
$cloned = $this->cloneResource($this->_image_resource_backup);
$this->_image_resource = $cloned['resource'];
$this->updateImageInfo($cloned['width'], ... | [
"public",
"function",
"reset",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_image_resource_backup",
")",
"{",
"throw",
"new",
"ImageException",
"(",
"'Cannot restore, no backup has been taken for image resource'",
")",
";",
"}",
"$",
"cloned",
"=",
"$",
"... | Restore Image resource from backup | [
"Restore",
"Image",
"resource",
"from",
"backup"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L524-L534 |
ahmad-sa3d/saad-image | src/Image.php | Image.updateImageInfo | private function updateImageInfo($width, $height) {
$this->_image_info[0] = $width;
$this->_image_info[1] = $height;
$this->_image_info[3] = 'width="' . $width . '" height="' . $height . '"';
$this->_image_info['aspect'] = $width / $height;
} | php | private function updateImageInfo($width, $height) {
$this->_image_info[0] = $width;
$this->_image_info[1] = $height;
$this->_image_info[3] = 'width="' . $width . '" height="' . $height . '"';
$this->_image_info['aspect'] = $width / $height;
} | [
"private",
"function",
"updateImageInfo",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"this",
"->",
"_image_info",
"[",
"0",
"]",
"=",
"$",
"width",
";",
"$",
"this",
"->",
"_image_info",
"[",
"1",
"]",
"=",
"$",
"height",
";",
"$",
"this... | Update Image Resource Info
@param $width
@param $height | [
"Update",
"Image",
"Resource",
"Info"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L558-L563 |
ahmad-sa3d/saad-image | src/Image.php | Image.getRGBFromRange | protected function getRGBFromRange($r, $g, $b, $range) {
# get randomized rgb values on a specific range from a agiven value
if (!$range) {
return array($r, $g, $b);
}
$range = round($range / 2);
$color = array();
# red
$min = $r - $range;
$max = $r + $range;
if ($min < 0) {
$min = 0;
}
... | php | protected function getRGBFromRange($r, $g, $b, $range) {
# get randomized rgb values on a specific range from a agiven value
if (!$range) {
return array($r, $g, $b);
}
$range = round($range / 2);
$color = array();
# red
$min = $r - $range;
$max = $r + $range;
if ($min < 0) {
$min = 0;
}
... | [
"protected",
"function",
"getRGBFromRange",
"(",
"$",
"r",
",",
"$",
"g",
",",
"$",
"b",
",",
"$",
"range",
")",
"{",
"#\tget randomized rgb values on a specific range from a agiven value",
"if",
"(",
"!",
"$",
"range",
")",
"{",
"return",
"array",
"(",
"$",
... | Get Random RGB Values on a specific range
@param integer $r Red
@param integer $g Green
@param integer $b Blue
@param integer $range Range to randomize given values
@return array array of randomized rgb | [
"Get",
"Random",
"RGB",
"Values",
"on",
"a",
"specific",
"range"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L574-L627 |
ahmad-sa3d/saad-image | src/Image.php | Image.getFontFilePath | protected function getFontFilePath($font = null, $custom_key = null) {
// Get Calling Class Name
$cls = $custom_key ? $custom_key : strtolower(str_replace(__NAMESPACE__.'\\', '', get_called_class()));
$font_path = Config::get(self::PACKAGE_NAME . '.font_dir') . DIRECTORY_SEPARATOR;
// Check if has Sub Direct... | php | protected function getFontFilePath($font = null, $custom_key = null) {
// Get Calling Class Name
$cls = $custom_key ? $custom_key : strtolower(str_replace(__NAMESPACE__.'\\', '', get_called_class()));
$font_path = Config::get(self::PACKAGE_NAME . '.font_dir') . DIRECTORY_SEPARATOR;
// Check if has Sub Direct... | [
"protected",
"function",
"getFontFilePath",
"(",
"$",
"font",
"=",
"null",
",",
"$",
"custom_key",
"=",
"null",
")",
"{",
"// Get Calling Class Name",
"$",
"cls",
"=",
"$",
"custom_key",
"?",
"$",
"custom_key",
":",
"strtolower",
"(",
"str_replace",
"(",
"__... | -----------------------------------------
getFontFilePath
-----------------------------------------
Get Font File Full Path
@param string $font font file
@return String Font Full Path | [
"-----------------------------------------",
"getFontFilePath",
"-----------------------------------------"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L640-L654 |
ahmad-sa3d/saad-image | src/Image.php | Image.getTextBoxDimensions | protected function getTextBoxDimensions($font_size, $text_angle, $font, $text) {
# comment
$dimensions = imagettfbbox(
$font_size,
$text_angle,
$font,
$text
);
$arr = array(
'width' => max(abs($dimensions[4] - $dimensions[0]), abs($dimensions[6] - $dimensions[2])),
'height'=> max(abs($dime... | php | protected function getTextBoxDimensions($font_size, $text_angle, $font, $text) {
# comment
$dimensions = imagettfbbox(
$font_size,
$text_angle,
$font,
$text
);
$arr = array(
'width' => max(abs($dimensions[4] - $dimensions[0]), abs($dimensions[6] - $dimensions[2])),
'height'=> max(abs($dime... | [
"protected",
"function",
"getTextBoxDimensions",
"(",
"$",
"font_size",
",",
"$",
"text_angle",
",",
"$",
"font",
",",
"$",
"text",
")",
"{",
"#\tcomment",
"$",
"dimensions",
"=",
"imagettfbbox",
"(",
"$",
"font_size",
",",
"$",
"text_angle",
",",
"$",
"fo... | -----------------------------------------
getTextBoxDimensions
-----------------------------------------
Get Box Informaton that created by drawing a ttf text with the specified arguments
@param integer $font_size text font size
@param integer $text_angle drawing angle
@param string $font font file
@par... | [
"-----------------------------------------",
"getTextBoxDimensions",
"-----------------------------------------"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L670-L773 |
ahmad-sa3d/saad-image | src/Image.php | Image.cloneResource | private function cloneResource($resource) {
// Get width from image.
$w = imagesx($resource);
// Get height from image.
$h = imagesy($resource);
// Get the transparent color from a 256 palette image.
$trans = imagecolortransparent($resource);
if (imageistruecolor($resource)) {
// this is a true color ... | php | private function cloneResource($resource) {
// Get width from image.
$w = imagesx($resource);
// Get height from image.
$h = imagesy($resource);
// Get the transparent color from a 256 palette image.
$trans = imagecolortransparent($resource);
if (imageistruecolor($resource)) {
// this is a true color ... | [
"private",
"function",
"cloneResource",
"(",
"$",
"resource",
")",
"{",
"// Get width from image.",
"$",
"w",
"=",
"imagesx",
"(",
"$",
"resource",
")",
";",
"// Get height from image.",
"$",
"h",
"=",
"imagesy",
"(",
"$",
"resource",
")",
";",
"// Get the tra... | Clone Image Resource
@param $resource
@return array | [
"Clone",
"Image",
"Resource"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Image.php#L781-L815 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer.php | HTMLPurifier_Lexer.normalize | public function normalize($html, $config, $context) {
// normalize newlines to \n
$html = str_replace("\r\n", "\n", $html);
$html = str_replace("\r", "\n", $html);
if ($config->get('HTML.Trusted')) {
// escape convoluted CDATA
$html = $this->escapeCommentedCDATA... | php | public function normalize($html, $config, $context) {
// normalize newlines to \n
$html = str_replace("\r\n", "\n", $html);
$html = str_replace("\r", "\n", $html);
if ($config->get('HTML.Trusted')) {
// escape convoluted CDATA
$html = $this->escapeCommentedCDATA... | [
"public",
"function",
"normalize",
"(",
"$",
"html",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"// normalize newlines to \\n",
"$",
"html",
"=",
"str_replace",
"(",
"\"\\r\\n\"",
",",
"\"\\n\"",
",",
"$",
"html",
")",
";",
"$",
"html",
"=",
"str... | Takes a piece of HTML and normalizes it by converting entities, fixing
encoding, extracting bits, and other good stuff.
@todo Consider making protected | [
"Takes",
"a",
"piece",
"of",
"HTML",
"and",
"normalizes",
"it",
"by",
"converting",
"entities",
"fixing",
"encoding",
"extracting",
"bits",
"and",
"other",
"good",
"stuff",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer.php#L252-L280 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer.php | HTMLPurifier_Lexer.extractBody | public function extractBody($html) {
$matches = array();
$result = preg_match('!<body[^>]*>(.*)</body>!is', $html, $matches);
if ($result) {
return $matches[1];
} else {
return $html;
}
} | php | public function extractBody($html) {
$matches = array();
$result = preg_match('!<body[^>]*>(.*)</body>!is', $html, $matches);
if ($result) {
return $matches[1];
} else {
return $html;
}
} | [
"public",
"function",
"extractBody",
"(",
"$",
"html",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"$",
"result",
"=",
"preg_match",
"(",
"'!<body[^>]*>(.*)</body>!is'",
",",
"$",
"html",
",",
"$",
"matches",
")",
";",
"if",
"(",
"$",
"resul... | Takes a string of HTML (fragment or document) and returns the content
@todo Consider making protected | [
"Takes",
"a",
"string",
"of",
"HTML",
"(",
"fragment",
"or",
"document",
")",
"and",
"returns",
"the",
"content"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer.php#L286-L294 |
wpup/digster | src/class-factory.php | Factory.composer | public function composer( $views, $callback ) {
foreach ( (array) $views as $view ) {
if ( $callback instanceof Closure === false ) {
$callback = function () use ( $callback ) {
return $callback;
};
}
if ( $view === '*' ) {
$this->composers['*'][] = $callback;
continue;
}
$view =... | php | public function composer( $views, $callback ) {
foreach ( (array) $views as $view ) {
if ( $callback instanceof Closure === false ) {
$callback = function () use ( $callback ) {
return $callback;
};
}
if ( $view === '*' ) {
$this->composers['*'][] = $callback;
continue;
}
$view =... | [
"public",
"function",
"composer",
"(",
"$",
"views",
",",
"$",
"callback",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"views",
"as",
"$",
"view",
")",
"{",
"if",
"(",
"$",
"callback",
"instanceof",
"Closure",
"===",
"false",
")",
"{",
"$",
"... | Register preprocess with views.
@param array|string $views
@param \Closure $callback
@return $this | [
"Register",
"preprocess",
"with",
"views",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L81-L104 |
wpup/digster | src/class-factory.php | Factory.extension | protected function extension( $view ) {
$extensions = $this->extensions();
// Return if a valid extension exists in the template string.
$ext_reg = '/(' . implode( '|', $extensions ) . ')+$/';
if ( preg_match( $ext_reg, $view ) ) {
return $template;
}
// Add extension to template string if it don't exi... | php | protected function extension( $view ) {
$extensions = $this->extensions();
// Return if a valid extension exists in the template string.
$ext_reg = '/(' . implode( '|', $extensions ) . ')+$/';
if ( preg_match( $ext_reg, $view ) ) {
return $template;
}
// Add extension to template string if it don't exi... | [
"protected",
"function",
"extension",
"(",
"$",
"view",
")",
"{",
"$",
"extensions",
"=",
"$",
"this",
"->",
"extensions",
"(",
")",
";",
"// Return if a valid extension exists in the template string.",
"$",
"ext_reg",
"=",
"'/('",
".",
"implode",
"(",
"'|'",
",... | Add extension to the view string if it don't exists.
@param string $view
@return string | [
"Add",
"extension",
"to",
"the",
"view",
"string",
"if",
"it",
"don",
"t",
"exists",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L133-L145 |
wpup/digster | src/class-factory.php | Factory.create_data | public function create_data( $data = [] ) {
if ( is_object( $data ) && method_exists( $data, 'to_array' ) ) {
return $data->to_array();
}
return is_array( $data ) ? $data : [];
} | php | public function create_data( $data = [] ) {
if ( is_object( $data ) && method_exists( $data, 'to_array' ) ) {
return $data->to_array();
}
return is_array( $data ) ? $data : [];
} | [
"public",
"function",
"create_data",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
"&&",
"method_exists",
"(",
"$",
"data",
",",
"'to_array'",
")",
")",
"{",
"return",
"$",
"data",
"->",
"to_array",
"(",
... | Create view data.
@param mixed $data
@return array | [
"Create",
"view",
"data",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L163-L169 |
wpup/digster | src/class-factory.php | Factory.gather_data | public function gather_data( View $view ) {
$data = [];
if ( $this->engine->bound( 'data' ) ) {
$data = $this->engine->make( 'data' );
}
$data = array_merge( $view->get_data(), $data );
$data = array_merge( $this->get_composer( $view ), $data );
$data = array_merge( $this->get_wildcard_composer(), $dat... | php | public function gather_data( View $view ) {
$data = [];
if ( $this->engine->bound( 'data' ) ) {
$data = $this->engine->make( 'data' );
}
$data = array_merge( $view->get_data(), $data );
$data = array_merge( $this->get_composer( $view ), $data );
$data = array_merge( $this->get_wildcard_composer(), $dat... | [
"public",
"function",
"gather_data",
"(",
"View",
"$",
"view",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"engine",
"->",
"bound",
"(",
"'data'",
")",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"engine",
"->",
... | Gather the data that should be used when render.
@param \Frozzare\Digster\View $view
@return array | [
"Gather",
"the",
"data",
"that",
"should",
"be",
"used",
"when",
"render",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L178-L200 |
wpup/digster | src/class-factory.php | Factory.get_composer | public function get_composer( View $view ) {
$view_name = $view->get_name();
if ( isset( $this->composers[$view_name] ) ) {
return $this->composers[$view_name];
}
return [];
} | php | public function get_composer( View $view ) {
$view_name = $view->get_name();
if ( isset( $this->composers[$view_name] ) ) {
return $this->composers[$view_name];
}
return [];
} | [
"public",
"function",
"get_composer",
"(",
"View",
"$",
"view",
")",
"{",
"$",
"view_name",
"=",
"$",
"view",
"->",
"get_name",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"composers",
"[",
"$",
"view_name",
"]",
")",
")",
"{",
"retu... | Call composer.
@param \Frozzare\Digster\View $view
@return string | [
"Call",
"composer",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L209-L217 |
wpup/digster | src/class-factory.php | Factory.make | public function make( $view, $data = [] ) {
return new View( $this, $this->engine, $this->view( $view ), $this->create_data( $data ) );
} | php | public function make( $view, $data = [] ) {
return new View( $this, $this->engine, $this->view( $view ), $this->create_data( $data ) );
} | [
"public",
"function",
"make",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"View",
"(",
"$",
"this",
",",
"$",
"this",
"->",
"engine",
",",
"$",
"this",
"->",
"view",
"(",
"$",
"view",
")",
",",
"$",
"this",
"... | Get the evaluated view contents for the given view.
@param string $view
@param array|object $data
@return \Frozzare\Digster\View | [
"Get",
"the",
"evaluated",
"view",
"contents",
"for",
"the",
"given",
"view",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L245-L247 |
wpup/digster | src/class-factory.php | Factory.view | protected function view( $view ) {
if ( preg_match( '/\.\w+$/', $view, $matches ) && in_array( $matches[0], $this->extensions() ) ) {
return str_replace( '.', '/', preg_replace( '/' . $matches[0] . '$/', '', $view ) ) . $matches[0];
}
return $this->extension( str_replace( '.', '/', $view ) );
} | php | protected function view( $view ) {
if ( preg_match( '/\.\w+$/', $view, $matches ) && in_array( $matches[0], $this->extensions() ) ) {
return str_replace( '.', '/', preg_replace( '/' . $matches[0] . '$/', '', $view ) ) . $matches[0];
}
return $this->extension( str_replace( '.', '/', $view ) );
} | [
"protected",
"function",
"view",
"(",
"$",
"view",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/\\.\\w+$/'",
",",
"$",
"view",
",",
"$",
"matches",
")",
"&&",
"in_array",
"(",
"$",
"matches",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"extensions",
"(",
... | Get the right view string from dot view or view that missing extension.
@param string $view
@return string | [
"Get",
"the",
"right",
"view",
"string",
"from",
"dot",
"view",
"or",
"view",
"that",
"missing",
"extension",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L256-L262 |
wpup/digster | src/class-factory.php | Factory.reset_composer | protected function reset_composer( View $view ) {
$view_name = $view->get_name();
if ( isset( $this->composers[$view_name] ) ) {
unset( $this->composers[$view_name] );
}
} | php | protected function reset_composer( View $view ) {
$view_name = $view->get_name();
if ( isset( $this->composers[$view_name] ) ) {
unset( $this->composers[$view_name] );
}
} | [
"protected",
"function",
"reset_composer",
"(",
"View",
"$",
"view",
")",
"{",
"$",
"view_name",
"=",
"$",
"view",
"->",
"get_name",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"composers",
"[",
"$",
"view_name",
"]",
")",
")",
"{",
... | Reset view composer.
@param \Frozzare\Digster\View $view | [
"Reset",
"view",
"composer",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-factory.php#L269-L275 |
mimmi20/Wurfl | src/VirtualCapability/VirtualCapabilityProvider.php | VirtualCapabilityProvider.getRequiredCapabilities | public static function getRequiredCapabilities()
{
$caps = array();
foreach (self::$virtualCapabilities as $capabilityName => $vcName) {
if (strpos($vcName, '.') !== false) {
// Group of capabilities
$parts = explode('.', $vcName);
$group ... | php | public static function getRequiredCapabilities()
{
$caps = array();
foreach (self::$virtualCapabilities as $capabilityName => $vcName) {
if (strpos($vcName, '.') !== false) {
// Group of capabilities
$parts = explode('.', $vcName);
$group ... | [
"public",
"static",
"function",
"getRequiredCapabilities",
"(",
")",
"{",
"$",
"caps",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"virtualCapabilities",
"as",
"$",
"capabilityName",
"=>",
"$",
"vcName",
")",
"{",
"if",
"(",
"strpos",
... | Returns an array of all the required capabilities for all virtual capabilities
@return array | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"required",
"capabilities",
"for",
"all",
"virtual",
"capabilities"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/VirtualCapabilityProvider.php#L123-L151 |
mimmi20/Wurfl | src/VirtualCapability/VirtualCapabilityProvider.php | VirtualCapabilityProvider.getControlCapabilities | public static function getControlCapabilities()
{
$caps = array();
foreach (array_keys(self::$virtualCapabilities) as $capabilityName) {
$caps[] = self::PREFIX_CONTROL . $capabilityName;
}
return $caps;
} | php | public static function getControlCapabilities()
{
$caps = array();
foreach (array_keys(self::$virtualCapabilities) as $capabilityName) {
$caps[] = self::PREFIX_CONTROL . $capabilityName;
}
return $caps;
} | [
"public",
"static",
"function",
"getControlCapabilities",
"(",
")",
"{",
"$",
"caps",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"self",
"::",
"$",
"virtualCapabilities",
")",
"as",
"$",
"capabilityName",
")",
"{",
"$",
"caps",
"[",
... | Returns an array of all the control capabilities
@return array | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"control",
"capabilities"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/VirtualCapabilityProvider.php#L157-L165 |
mimmi20/Wurfl | src/VirtualCapability/VirtualCapabilityProvider.php | VirtualCapabilityProvider.getAll | public function getAll()
{
$all = array();
foreach ($this->getNames() as $name) {
$all[$name] = $this->get($name);
}
return $all;
} | php | public function getAll()
{
$all = array();
foreach ($this->getNames() as $name) {
$all[$name] = $this->get($name);
}
return $all;
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"all",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getNames",
"(",
")",
"as",
"$",
"name",
")",
"{",
"$",
"all",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"->",
"get",
"(... | Gets an array of all the virtual capabilities
@return array Virtual capabilities in format 'name => value' | [
"Gets",
"an",
"array",
"of",
"all",
"the",
"virtual",
"capabilities"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/VirtualCapabilityProvider.php#L172-L181 |
mimmi20/Wurfl | src/VirtualCapability/VirtualCapabilityProvider.php | VirtualCapabilityProvider.get | public function get($name)
{
$controlValue = $this->getControlValue($name);
$value = $controlValue;
switch ($controlValue) {
case null:
// break intentionally omitted
case self::WURFL_CONTROL_DEFAULT:
// The value is null if it is not... | php | public function get($name)
{
$controlValue = $this->getControlValue($name);
$value = $controlValue;
switch ($controlValue) {
case null:
// break intentionally omitted
case self::WURFL_CONTROL_DEFAULT:
// The value is null if it is not... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"controlValue",
"=",
"$",
"this",
"->",
"getControlValue",
"(",
"$",
"name",
")",
";",
"$",
"value",
"=",
"$",
"controlValue",
";",
"switch",
"(",
"$",
"controlValue",
")",
"{",
"case",
"n... | Returns the value of the virtual capability
@param string $name
@return string|bool|int|float | [
"Returns",
"the",
"value",
"of",
"the",
"virtual",
"capability"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/VirtualCapabilityProvider.php#L190-L217 |
mimmi20/Wurfl | src/VirtualCapability/VirtualCapabilityProvider.php | VirtualCapabilityProvider.getObject | public function getObject($name)
{
if (!array_key_exists($name, $this->cache)) {
if (strpos(self::$virtualCapabilities[$name], '.') !== false) {
// Group of capabilities
list($group, $property) = explode('.', self::$virtualCapabilities[$name]);
if... | php | public function getObject($name)
{
if (!array_key_exists($name, $this->cache)) {
if (strpos(self::$virtualCapabilities[$name], '.') !== false) {
// Group of capabilities
list($group, $property) = explode('.', self::$virtualCapabilities[$name]);
if... | [
"public",
"function",
"getObject",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"cache",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"self",
"::",
"$",
"virtualCapabilities",
"[",
"$",
"name",... | Returns the \Wurfl\VirtualCapability\VirtualCapability object for the given $name.
@param string $name
@return \Wurfl\VirtualCapability\VirtualCapability | [
"Returns",
"the",
"\\",
"Wurfl",
"\\",
"VirtualCapability",
"\\",
"VirtualCapability",
"object",
"for",
"the",
"given",
"$name",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/VirtualCapabilityProvider.php#L226-L258 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/ComplexType.php | ComplexType.modulus | public function modulus()
{
if ($this->isReal()) {
//sqrt(r^2 + 0^2) = sqrt(r^2) = abs(r)
/** @noinspection PhpUndefinedMethodInspection */
return $this->value['real']->abs();
}
//r^2 & i^2
$sqrR = array(
'n'=>pow($this->value['real']->... | php | public function modulus()
{
if ($this->isReal()) {
//sqrt(r^2 + 0^2) = sqrt(r^2) = abs(r)
/** @noinspection PhpUndefinedMethodInspection */
return $this->value['real']->abs();
}
//r^2 & i^2
$sqrR = array(
'n'=>pow($this->value['real']->... | [
"public",
"function",
"modulus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReal",
"(",
")",
")",
"{",
"//sqrt(r^2 + 0^2) = sqrt(r^2) = abs(r)",
"/** @noinspection PhpUndefinedMethodInspection */",
"return",
"$",
"this",
"->",
"value",
"[",
"'real'",
"]",
"->... | Return the modulus, also known as absolute value or magnitude of this number
= sqrt(r^2 + i^2);
@return \Chippyash\Type\Number\Rational\RationalType | [
"Return",
"the",
"modulus",
"also",
"known",
"as",
"absolute",
"value",
"or",
"magnitude",
"of",
"this",
"number",
"=",
"sqrt",
"(",
"r^2",
"+",
"i^2",
")",
";"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/ComplexType.php#L99-L133 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/ComplexType.php | ComplexType.theta | public function theta()
{
return RationalTypeFactory::fromFloat(
atan2(
$this->value['imaginary']->asFloatType()->get(),
$this->value['real']->asFloatType()->get()
)
);
} | php | public function theta()
{
return RationalTypeFactory::fromFloat(
atan2(
$this->value['imaginary']->asFloatType()->get(),
$this->value['real']->asFloatType()->get()
)
);
} | [
"public",
"function",
"theta",
"(",
")",
"{",
"return",
"RationalTypeFactory",
"::",
"fromFloat",
"(",
"atan2",
"(",
"$",
"this",
"->",
"value",
"[",
"'imaginary'",
"]",
"->",
"asFloatType",
"(",
")",
"->",
"get",
"(",
")",
",",
"$",
"this",
"->",
"val... | Return the angle (sometimes known as the argument) of the number
when expressed in polar notation
The return value is a rational expressing theta as radians
@return \Chippyash\Type\Number\Rational\RationalType | [
"Return",
"the",
"angle",
"(",
"sometimes",
"known",
"as",
"the",
"argument",
")",
"of",
"the",
"number",
"when",
"expressed",
"in",
"polar",
"notation"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/ComplexType.php#L143-L151 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/ComplexType.php | ComplexType.lcm | private function lcm($a, $b)
{
return \abs(($a * $b) / $this->gcd($a, $b));
} | php | private function lcm($a, $b)
{
return \abs(($a * $b) / $this->gcd($a, $b));
} | [
"private",
"function",
"lcm",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"return",
"\\",
"abs",
"(",
"(",
"$",
"a",
"*",
"$",
"b",
")",
"/",
"$",
"this",
"->",
"gcd",
"(",
"$",
"a",
",",
"$",
"b",
")",
")",
";",
"}"
] | Return Least Common Multiple of two numbers
@param int $a
@param int $b
@return int | [
"Return",
"Least",
"Common",
"Multiple",
"of",
"two",
"numbers"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/ComplexType.php#L172-L175 |
attm2x/m2x-php | src/Key.php | Key.regenerate | public function regenerate() {
$response = $this->client->post(self::$path . '/' . $this->key . '/regenerate');
$this->setData($response->json());
return $this;
} | php | public function regenerate() {
$response = $this->client->post(self::$path . '/' . $this->key . '/regenerate');
$this->setData($response->json());
return $this;
} | [
"public",
"function",
"regenerate",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"self",
"::",
"$",
"path",
".",
"'/'",
".",
"$",
"this",
"->",
"key",
".",
"'/regenerate'",
")",
";",
"$",
"this",
"->",
"setDa... | Method for {@link https://m2x.att.com/developer/documentation/v2/keys#Regenerate-Key Regenerate Key} endpoint.
@return Key The regenrated Key | [
"Method",
"for",
"{",
"@link",
"https",
":",
"//",
"m2x",
".",
"att",
".",
"com",
"/",
"developer",
"/",
"documentation",
"/",
"v2",
"/",
"keys#Regenerate",
"-",
"Key",
"Regenerate",
"Key",
"}",
"endpoint",
"."
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/Key.php#L41-L45 |
inpsyde/wp-db-tools | src/Action/MySqlTableLookup.php | MySqlTableLookup.table_exists | public function table_exists( Table $table ) {
$statement = new GenericStatement( "SHOW TABLES LIKE %s" );
$result = $this->database
->query_statement( $statement, [ (string) $table ] );
if ( ! $result->valid() )
return FALSE;
/**
* @todo refactor this as soon as
* we have unified options bit-mas... | php | public function table_exists( Table $table ) {
$statement = new GenericStatement( "SHOW TABLES LIKE %s" );
$result = $this->database
->query_statement( $statement, [ (string) $table ] );
if ( ! $result->valid() )
return FALSE;
/**
* @todo refactor this as soon as
* we have unified options bit-mas... | [
"public",
"function",
"table_exists",
"(",
"Table",
"$",
"table",
")",
"{",
"$",
"statement",
"=",
"new",
"GenericStatement",
"(",
"\"SHOW TABLES LIKE %s\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"database",
"->",
"query_statement",
"(",
"$",
"sta... | @param Table $table
@return bool | [
"@param",
"Table",
"$table"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Action/MySqlTableLookup.php#L34-L61 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.getAllUsers | public function getAllUsers($parameters = array())
{
$response = $this->client->get('/v2/user', $parameters);
$users = array();
foreach ($response['items'] as $response) {
$users[] = new User($response);
}
return $users;
} | php | public function getAllUsers($parameters = array())
{
$response = $this->client->get('/v2/user', $parameters);
$users = array();
foreach ($response['items'] as $response) {
$users[] = new User($response);
}
return $users;
} | [
"public",
"function",
"getAllUsers",
"(",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"'/v2/user'",
",",
"$",
"parameters",
")",
";",
"$",
"users",
"=",
"array",
"(",
")",
... | List all users in the group
More info: https://www.hipchat.com/docs/apiv2/method/get_all_users
@param array $parameters The following are accepted: start-index, max-results, include-guests, include-deleted
@return array of Users | [
"List",
"all",
"users",
"in",
"the",
"group",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"get_all_users"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L32-L42 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.getUser | public function getUser($userId)
{
$response = $this->client->get(sprintf('/v2/user/%s', $userId));
return new User($response);
} | php | public function getUser($userId)
{
$response = $this->client->get(sprintf('/v2/user/%s', $userId));
return new User($response);
} | [
"public",
"function",
"getUser",
"(",
"$",
"userId",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"sprintf",
"(",
"'/v2/user/%s'",
",",
"$",
"userId",
")",
")",
";",
"return",
"new",
"User",
"(",
"$",
"response",
")"... | Gets user by id, email or mention name
More info: https://www.hipchat.com/docs/apiv2/method/view_user
@param string $userId The id, email address, or mention name (beginning with an '@') of the user to view
@return User | [
"Gets",
"user",
"by",
"id",
"email",
"or",
"mention",
"name",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"view_user"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L52-L57 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.createUser | public function createUser(User $user, $password)
{
$request = $user->toJson();
$request['password'] = $password;
$response = $this->client->post('/v2/user', $request);
return $response['id'];
} | php | public function createUser(User $user, $password)
{
$request = $user->toJson();
$request['password'] = $password;
$response = $this->client->post('/v2/user', $request);
return $response['id'];
} | [
"public",
"function",
"createUser",
"(",
"User",
"$",
"user",
",",
"$",
"password",
")",
"{",
"$",
"request",
"=",
"$",
"user",
"->",
"toJson",
"(",
")",
";",
"$",
"request",
"[",
"'password'",
"]",
"=",
"$",
"password",
";",
"$",
"response",
"=",
... | Creates a new user
More info: https://www.hipchat.com/docs/apiv2/method/create_user
@param User $user User to be created
@param string $password User's password
@return mixed | [
"Creates",
"a",
"new",
"user",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"create_user"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L68-L75 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.updateUser | public function updateUser(User $user)
{
$request = $user->toJson();
$this->client->put(sprintf('/v2/user/%s', $user->getId()), $request);
} | php | public function updateUser(User $user)
{
$request = $user->toJson();
$this->client->put(sprintf('/v2/user/%s', $user->getId()), $request);
} | [
"public",
"function",
"updateUser",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"request",
"=",
"$",
"user",
"->",
"toJson",
"(",
")",
";",
"$",
"this",
"->",
"client",
"->",
"put",
"(",
"sprintf",
"(",
"'/v2/user/%s'",
",",
"$",
"user",
"->",
"getId",
... | Update a user
More info: https://www.hipchat.com/docs/apiv2/method/update_user
@param User $user User to be updated | [
"Update",
"a",
"user",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"update_user"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L83-L87 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.privateMessageUser | public function privateMessageUser($userId, $message)
{
if (is_string($message)) {
$content = array('message' => $message);
} else { // Assuming its a Message
$content = $message->toJson();
}
$this->client->post(sprintf('/v2/user/%s/message', $userId), $conten... | php | public function privateMessageUser($userId, $message)
{
if (is_string($message)) {
$content = array('message' => $message);
} else { // Assuming its a Message
$content = $message->toJson();
}
$this->client->post(sprintf('/v2/user/%s/message', $userId), $conten... | [
"public",
"function",
"privateMessageUser",
"(",
"$",
"userId",
",",
"$",
"message",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"message",
")",
")",
"{",
"$",
"content",
"=",
"array",
"(",
"'message'",
"=>",
"$",
"message",
")",
";",
"}",
"else",
"{... | Sends a user a private message
More info: https://www.hipchat.com/docs/apiv2/method/private_message_user
@param string $userId The id, email address, or mention name (beginning with an '@') of the user to send a message to
@param mixed $message The message to send as plain text | [
"Sends",
"a",
"user",
"a",
"private",
"message",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"private_message_user"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L106-L114 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.getRecentPrivateChatHistory | public function getRecentPrivateChatHistory($userId, array $parameters = array())
{
$response = $this->client->get(
sprintf('/v2/user/%s/history/latest', $userId),
$parameters
);
$messages = array();
foreach ($response['items'] as $response) {
$me... | php | public function getRecentPrivateChatHistory($userId, array $parameters = array())
{
$response = $this->client->get(
sprintf('/v2/user/%s/history/latest', $userId),
$parameters
);
$messages = array();
foreach ($response['items'] as $response) {
$me... | [
"public",
"function",
"getRecentPrivateChatHistory",
"(",
"$",
"userId",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"sprintf",
"(",
"'/v2/user/%s/history/latest'",
"... | Fetch latest chat history for the 1:1 chat with the user
More info: https://www.hipchat.com/docs/apiv2/method/view_recent_privatechat_history
@param string $userId The id, email address, or mention name (beginning with an '@') of the user
@param mixed $parameters Optional parameters, check above documentation for... | [
"Fetch",
"latest",
"chat",
"history",
"for",
"the",
"1",
":",
"1",
"chat",
"with",
"the",
"user",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"view_recent_privatechat_history"... | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L125-L138 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.getPrivateChatMessage | public function getPrivateChatMessage($user, $messageId, array $parameters = array())
{
$response = $this->client->get(
sprintf('/v2/user/%s/history/%s', $user, $messageId),
$parameters
);
$message = new Message($response['message']);
return $message;
} | php | public function getPrivateChatMessage($user, $messageId, array $parameters = array())
{
$response = $this->client->get(
sprintf('/v2/user/%s/history/%s', $user, $messageId),
$parameters
);
$message = new Message($response['message']);
return $message;
} | [
"public",
"function",
"getPrivateChatMessage",
"(",
"$",
"user",
",",
"$",
"messageId",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"sprintf",
"(",
"'/v2/user/%s/... | Fetch one specific message by id
More info: https://www.hipchat.com/docs/apiv2/method/get_privatechat_message
@param string $user The id, email address, or mention name (beginning with an '@') of the user
@param string $messageId The id of the message to retrieve
@param array $parameters Optional parameters, c... | [
"Fetch",
"one",
"specific",
"message",
"by",
"id",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"get_privatechat_message"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L150-L160 |
gorkalaucirica/HipchatAPIv2Client | API/UserAPI.php | UserAPI.getPhoto | public function getPhoto($userId, $size)
{
$response = $this->client->get(
sprintf('/v2/user/%s/photo/%s', $userId, $size)
);
return $response;
} | php | public function getPhoto($userId, $size)
{
$response = $this->client->get(
sprintf('/v2/user/%s/photo/%s', $userId, $size)
);
return $response;
} | [
"public",
"function",
"getPhoto",
"(",
"$",
"userId",
",",
"$",
"size",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"sprintf",
"(",
"'/v2/user/%s/photo/%s'",
",",
"$",
"userId",
",",
"$",
"size",
")",
")",
";",
"ret... | Gets a user photo
More info: https://www.hipchat.com/docs/apiv2/method/get_photo
@param string $userId The id, email address, or mention name (beginning with an '@') of the user
@param string $size The size to retrieve ("small" or "big")
@return string | [
"Gets",
"a",
"user",
"photo",
"More",
"info",
":",
"https",
":",
"//",
"www",
".",
"hipchat",
".",
"com",
"/",
"docs",
"/",
"apiv2",
"/",
"method",
"/",
"get_photo"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/UserAPI.php#L171-L178 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.data_output | static function data_output ( $columns, $data )
{
$out = array();
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
$row = array();
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
$column = $columns[$j];
// Is there a formatter?
if ( isset( $column['formatter'] ) ) {
$row[ $column[... | php | static function data_output ( $columns, $data )
{
$out = array();
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
$row = array();
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
$column = $columns[$j];
// Is there a formatter?
if ( isset( $column['formatter'] ) ) {
$row[ $column[... | [
"static",
"function",
"data_output",
"(",
"$",
"columns",
",",
"$",
"data",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"ien",
"=",
"count",
"(",
"$",
"data",
")",
";",
"$",
"i",
"<",
"$",
"i... | Create the data output array for the DataTables rows
@param array $columns Column information array
@param array $data Data from the SQL get
@return array Formatted data in a row based format | [
"Create",
"the",
"data",
"output",
"array",
"for",
"the",
"DataTables",
"rows"
] | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L34-L57 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.limit | static function limit ( $request, $columns )
{
$limit = '';
if ( isset($request['start']) && $request['length'] != -1 ) {
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
}
return $limit;
} | php | static function limit ( $request, $columns )
{
$limit = '';
if ( isset($request['start']) && $request['length'] != -1 ) {
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
}
return $limit;
} | [
"static",
"function",
"limit",
"(",
"$",
"request",
",",
"$",
"columns",
")",
"{",
"$",
"limit",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"request",
"[",
"'start'",
"]",
")",
"&&",
"$",
"request",
"[",
"'length'",
"]",
"!=",
"-",
"1",
")",
... | Paging
Construct the LIMIT clause for server-side processing SQL query
@param array $request Data sent to server by DataTables
@param array $columns Column information array
@return string SQL limit clause | [
"Paging"
] | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L69-L78 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.simple | static function simple ( $request, $sql_details, $table, $primaryKey, $columns )
{
$bindings = array();
$db = self::sql_connect( $sql_details );
// Build the SQL query string from the request
$limit = self::limit( $request, $columns );
$order = self::order( $request, $columns );
$where = self::filter( $re... | php | static function simple ( $request, $sql_details, $table, $primaryKey, $columns )
{
$bindings = array();
$db = self::sql_connect( $sql_details );
// Build the SQL query string from the request
$limit = self::limit( $request, $columns );
$order = self::order( $request, $columns );
$where = self::filter( $re... | [
"static",
"function",
"simple",
"(",
"$",
"request",
",",
"$",
"sql_details",
",",
"$",
"table",
",",
"$",
"primaryKey",
",",
"$",
"columns",
")",
"{",
"$",
"bindings",
"=",
"array",
"(",
")",
";",
"$",
"db",
"=",
"self",
"::",
"sql_connect",
"(",
... | Perform the SQL queries needed for an server-side processing requested,
utilising the helper functions of this class, limit(), order() and
filter() among others. The returned array is ready to be encoded as JSON
in response to an SSP request, or can be modified if needed before
sending back to the client.
@param arra... | [
"Perform",
"the",
"SQL",
"queries",
"needed",
"for",
"an",
"server",
"-",
"side",
"processing",
"requested",
"utilising",
"the",
"helper",
"functions",
"of",
"this",
"class",
"limit",
"()",
"order",
"()",
"and",
"filter",
"()",
"among",
"others",
".",
"The",... | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L208-L250 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.sql_connect | static function sql_connect ( $sql_details )
{
try {
$db = @new PDO(
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
$sql_details['user'],
$sql_details['pass'],
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
);
}
catch (PDOException $e) {
self::fatal(
"An error... | php | static function sql_connect ( $sql_details )
{
try {
$db = @new PDO(
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
$sql_details['user'],
$sql_details['pass'],
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
);
}
catch (PDOException $e) {
self::fatal(
"An error... | [
"static",
"function",
"sql_connect",
"(",
"$",
"sql_details",
")",
"{",
"try",
"{",
"$",
"db",
"=",
"@",
"new",
"PDO",
"(",
"\"mysql:host={$sql_details['host']};dbname={$sql_details['db']}\"",
",",
"$",
"sql_details",
"[",
"'user'",
"]",
",",
"$",
"sql_details",
... | Connect to the database
@param array $sql_details SQL server connection details array, with the
properties:
* host - host name
* db - database name
* user - user name
* pass - user password
@return resource Database connection handle | [
"Connect",
"to",
"the",
"database"
] | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L264-L282 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.sql_exec | static function sql_exec ( $db, $bindings, $sql=null )
{
// Argument shifting
if ( $sql === null ) {
$sql = $bindings;
}
$stmt = $db->prepare( $sql );
//echo $sql;
// Bind parameters
if ( is_array( $bindings ) ) {
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
$binding = $bindings[$i]... | php | static function sql_exec ( $db, $bindings, $sql=null )
{
// Argument shifting
if ( $sql === null ) {
$sql = $bindings;
}
$stmt = $db->prepare( $sql );
//echo $sql;
// Bind parameters
if ( is_array( $bindings ) ) {
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
$binding = $bindings[$i]... | [
"static",
"function",
"sql_exec",
"(",
"$",
"db",
",",
"$",
"bindings",
",",
"$",
"sql",
"=",
"null",
")",
"{",
"// Argument shifting",
"if",
"(",
"$",
"sql",
"===",
"null",
")",
"{",
"$",
"sql",
"=",
"$",
"bindings",
";",
"}",
"$",
"stmt",
"=",
... | Execute an SQL query on the database
@param resource $db Database handler
@param array $bindings Array of PDO binding values from bind() to be
used for safely escaping strings. Note that this can be given as the
SQL query string if no bindings are required.
@param string $sql SQL query to execute.
@return arr... | [
"Execute",
"an",
"SQL",
"query",
"on",
"the",
"database"
] | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L295-L323 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.bind | static function bind ( &$a, $val, $type )
{
$key = ':binding_'.count( $a );
$a[] = array(
'key' => $key,
'val' => $val,
'type' => $type
);
return $key;
} | php | static function bind ( &$a, $val, $type )
{
$key = ':binding_'.count( $a );
$a[] = array(
'key' => $key,
'val' => $val,
'type' => $type
);
return $key;
} | [
"static",
"function",
"bind",
"(",
"&",
"$",
"a",
",",
"$",
"val",
",",
"$",
"type",
")",
"{",
"$",
"key",
"=",
"':binding_'",
".",
"count",
"(",
"$",
"a",
")",
";",
"$",
"a",
"[",
"]",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'v... | Create a PDO binding key which can be used for escaping variables safely
when executing a query with sql_exec()
@param array &$a Array of bindings
@param * $val Value to bind
@param int $type PDO field type
@return string Bound key to be used in the SQL where this parameter
would be used. | [
"Create",
"a",
"PDO",
"binding",
"key",
"which",
"can",
"be",
"used",
"for",
"escaping",
"variables",
"safely",
"when",
"executing",
"a",
"query",
"with",
"sql_exec",
"()"
] | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L357-L368 |
liupdhc/yii2-liuxy-themes | admin/plugins/datatables/examples/server_side/scripts/ssp.class.php | SSP.pluck | static function pluck ( $a, $prop )
{
$out = array();
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
$out[] = $a[$i][$prop];
}
return $out;
} | php | static function pluck ( $a, $prop )
{
$out = array();
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
$out[] = $a[$i][$prop];
}
return $out;
} | [
"static",
"function",
"pluck",
"(",
"$",
"a",
",",
"$",
"prop",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"len",
"=",
"count",
"(",
"$",
"a",
")",
";",
"$",
"i",
"<",
"$",
"len",
";",
"... | Pull a particular property from each assoc. array in a numeric array,
returning and array of the property values from each item.
@param array $a Array to get data from
@param string $prop Property to read
@return array Array of property values | [
"Pull",
"a",
"particular",
"property",
"from",
"each",
"assoc",
".",
"array",
"in",
"a",
"numeric",
"array",
"returning",
"and",
"array",
"of",
"the",
"property",
"values",
"from",
"each",
"item",
"."
] | train | https://github.com/liupdhc/yii2-liuxy-themes/blob/0f804715092718776ecab9748d1dc0562b6ebcac/admin/plugins/datatables/examples/server_side/scripts/ssp.class.php#L379-L388 |
PandaPlatform/framework | src/Panda/Support/Configuration/Parsers/PhpParser.php | PhpParser.parse | public function parse($configFile = '')
{
// Load default configuration
$defaultConfigFile = $this->getConfigFile($configFile, 'default');
$defaultConfigArray = parent::parse($defaultConfigFile) ?: [];
// Load environment configuration
$envConfigFile = $this->getConfigFile($... | php | public function parse($configFile = '')
{
// Load default configuration
$defaultConfigFile = $this->getConfigFile($configFile, 'default');
$defaultConfigArray = parent::parse($defaultConfigFile) ?: [];
// Load environment configuration
$envConfigFile = $this->getConfigFile($... | [
"public",
"function",
"parse",
"(",
"$",
"configFile",
"=",
"''",
")",
"{",
"// Load default configuration",
"$",
"defaultConfigFile",
"=",
"$",
"this",
"->",
"getConfigFile",
"(",
"$",
"configFile",
",",
"'default'",
")",
";",
"$",
"defaultConfigArray",
"=",
... | Parse the configuration file and get the configuration array.
@param string $configFile
@return array | [
"Parse",
"the",
"configuration",
"file",
"and",
"get",
"the",
"configuration",
"array",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Configuration/Parsers/PhpParser.php#L46-L58 |
PandaPlatform/framework | src/Panda/Support/Configuration/Parsers/PhpParser.php | PhpParser.getConfigFile | private function getConfigFile($configFile, $environment = 'default')
{
// Normalize config file
$configFile = $configFile ?: 'config';
// Check if there is an environment-specific config file
$envConfigFile = $this->app->getConfigPath() . DIRECTORY_SEPARATOR . $configFile . '-' . $... | php | private function getConfigFile($configFile, $environment = 'default')
{
// Normalize config file
$configFile = $configFile ?: 'config';
// Check if there is an environment-specific config file
$envConfigFile = $this->app->getConfigPath() . DIRECTORY_SEPARATOR . $configFile . '-' . $... | [
"private",
"function",
"getConfigFile",
"(",
"$",
"configFile",
",",
"$",
"environment",
"=",
"'default'",
")",
"{",
"// Normalize config file",
"$",
"configFile",
"=",
"$",
"configFile",
"?",
":",
"'config'",
";",
"// Check if there is an environment-specific config fi... | Get the configuration file according to the given environment, if any.
@param string $configFile
@param string $environment
@return string | [
"Get",
"the",
"configuration",
"file",
"according",
"to",
"the",
"given",
"environment",
"if",
"any",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Configuration/Parsers/PhpParser.php#L68-L80 |
vi-kon/laravel-parser | src/ViKon/Parser/rule/AbstractRuleSet.php | AbstractRuleSet.getRulesByCategory | public function getRulesByCategory($name, array $except = []) {
if (!isset($this->categories[$name])) {
throw new ParserException('Category with ' . $name . ' not found');
}
if (count($except) === 0) {
return $this->categories[$name];
}
$rules = [];
... | php | public function getRulesByCategory($name, array $except = []) {
if (!isset($this->categories[$name])) {
throw new ParserException('Category with ' . $name . ' not found');
}
if (count($except) === 0) {
return $this->categories[$name];
}
$rules = [];
... | [
"public",
"function",
"getRulesByCategory",
"(",
"$",
"name",
",",
"array",
"$",
"except",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"categories",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"ParserException"... | Get rule names by category
@param string $name category name
@param string[] $except array with rule names (exception list)
@return \ViKon\Parser\Rule\AbstractRule[]
@throws \ViKon\Parser\ParserException | [
"Get",
"rule",
"names",
"by",
"category"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractRuleSet.php#L53-L70 |
vi-kon/laravel-parser | src/ViKon/Parser/rule/AbstractRuleSet.php | AbstractRuleSet.getRuleNamesByCategory | public function getRuleNamesByCategory($name, array $except = []) {
if (!isset($this->categories[$name])) {
throw new ParserException('Category with ' . $name . ' not found');
}
$ruleNames = [];
foreach ($this->categories[$name] as $rule) {
if (!in_array($rule->... | php | public function getRuleNamesByCategory($name, array $except = []) {
if (!isset($this->categories[$name])) {
throw new ParserException('Category with ' . $name . ' not found');
}
$ruleNames = [];
foreach ($this->categories[$name] as $rule) {
if (!in_array($rule->... | [
"public",
"function",
"getRuleNamesByCategory",
"(",
"$",
"name",
",",
"array",
"$",
"except",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"categories",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"ParserExcept... | Get rule names by category
@param string $name category name
@param array $except array with rule names (exception list)
@return string[]
@throws \ViKon\Parser\ParserException | [
"Get",
"rule",
"names",
"by",
"category"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractRuleSet.php#L82-L96 |
vi-kon/laravel-parser | src/ViKon/Parser/rule/AbstractRuleSet.php | AbstractRuleSet.init | public function init(Parser $parser, Lexer $lexer) {
$parser->setStartRule($this->startRule);
foreach ($this->rules as $rule) {
$parser->addRule($rule);
}
$parser->setLexer($lexer);
$lexer->setParser($parser);
return $this;
} | php | public function init(Parser $parser, Lexer $lexer) {
$parser->setStartRule($this->startRule);
foreach ($this->rules as $rule) {
$parser->addRule($rule);
}
$parser->setLexer($lexer);
$lexer->setParser($parser);
return $this;
} | [
"public",
"function",
"init",
"(",
"Parser",
"$",
"parser",
",",
"Lexer",
"$",
"lexer",
")",
"{",
"$",
"parser",
"->",
"setStartRule",
"(",
"$",
"this",
"->",
"startRule",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"rule",
")",
... | Set start rule and add set's rules to parser
@param \ViKon\Parser\Parser $parser
@param \ViKon\Parser\Lexer\Lexer $lexer
@return $this
@throws \ViKon\Parser\ParserException | [
"Set",
"start",
"rule",
"and",
"add",
"set",
"s",
"rules",
"to",
"parser"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractRuleSet.php#L125-L136 |
vi-kon/laravel-parser | src/ViKon/Parser/rule/AbstractRuleSet.php | AbstractRuleSet.addRule | protected function addRule(AbstractRule $rule, $category = self::CATEGORY_NONE) {
$rule->setRuleSet($this);
$this->rules[] = $rule;
$this->categories[$category][] = $rule;
return $this;
} | php | protected function addRule(AbstractRule $rule, $category = self::CATEGORY_NONE) {
$rule->setRuleSet($this);
$this->rules[] = $rule;
$this->categories[$category][] = $rule;
return $this;
} | [
"protected",
"function",
"addRule",
"(",
"AbstractRule",
"$",
"rule",
",",
"$",
"category",
"=",
"self",
"::",
"CATEGORY_NONE",
")",
"{",
"$",
"rule",
"->",
"setRuleSet",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"rules",
"[",
"]",
"=",
"$",
"ru... | Add new rule to set
@param \ViKon\Parser\Rule\AbstractRule $rule
@param string $category
@return $this | [
"Add",
"new",
"rule",
"to",
"set"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractRuleSet.php#L146-L153 |
venta/framework | src/Event/src/EventDispatcher.php | EventDispatcher.getListeners | protected function getListeners(string $eventName): array
{
if (!isset($this->listeners[$eventName])) {
return [];
}
if (!isset($this->sortedListeners[$eventName])) {
$this->sortedListeners[$eventName] = $this->sortEventListeners($eventName);
}
retur... | php | protected function getListeners(string $eventName): array
{
if (!isset($this->listeners[$eventName])) {
return [];
}
if (!isset($this->sortedListeners[$eventName])) {
$this->sortedListeners[$eventName] = $this->sortEventListeners($eventName);
}
retur... | [
"protected",
"function",
"getListeners",
"(",
"string",
"$",
"eventName",
")",
":",
"array",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"!",... | Returns array of event listeners.
@param string $eventName
@return array | [
"Returns",
"array",
"of",
"event",
"listeners",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Event/src/EventDispatcher.php#L102-L113 |
venta/framework | src/Event/src/EventDispatcher.php | EventDispatcher.sortEventListeners | protected function sortEventListeners(string $eventName): array
{
$listeners = $this->listeners[$eventName];
$normalised = [];
ksort($listeners);
foreach ($listeners as $priorityListeners) {
foreach ($priorityListeners as $listener) {
$normalised[] = $li... | php | protected function sortEventListeners(string $eventName): array
{
$listeners = $this->listeners[$eventName];
$normalised = [];
ksort($listeners);
foreach ($listeners as $priorityListeners) {
foreach ($priorityListeners as $listener) {
$normalised[] = $li... | [
"protected",
"function",
"sortEventListeners",
"(",
"string",
"$",
"eventName",
")",
":",
"array",
"{",
"$",
"listeners",
"=",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
";",
"$",
"normalised",
"=",
"[",
"]",
";",
"ksort",
"(",
"$",
"l... | Merges all event listeners for particular event.
@param string $eventName
@return array | [
"Merges",
"all",
"event",
"listeners",
"for",
"particular",
"event",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Event/src/EventDispatcher.php#L121-L135 |
taskforcedev/laravel-support | src/Helpers/UI.php | UI.cssClass | public function cssClass($type)
{
$framework = $this->getFramework();
$classes = $this->getClasses($framework);
if (property_exists($classes, $type)) {
return $classes->$type;
}
return '';
} | php | public function cssClass($type)
{
$framework = $this->getFramework();
$classes = $this->getClasses($framework);
if (property_exists($classes, $type)) {
return $classes->$type;
}
return '';
} | [
"public",
"function",
"cssClass",
"(",
"$",
"type",
")",
"{",
"$",
"framework",
"=",
"$",
"this",
"->",
"getFramework",
"(",
")",
";",
"$",
"classes",
"=",
"$",
"this",
"->",
"getClasses",
"(",
"$",
"framework",
")",
";",
"if",
"(",
"property_exists",
... | Get the css class for a given object type.
@param string $type Object type.
@return string | [
"Get",
"the",
"css",
"class",
"for",
"a",
"given",
"object",
"type",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/UI.php#L25-L35 |
taskforcedev/laravel-support | src/Helpers/UI.php | UI.columns | public function columns($xs, $sm, $md, $lg)
{
$framework = $this->getFramework();
switch ($framework)
{
case 'bs3':
case 'bs4':
$xsC = $this->cssClass('column_extra_small') . $xs;
$smC = $this->cssClass('column_small') . $sm;
... | php | public function columns($xs, $sm, $md, $lg)
{
$framework = $this->getFramework();
switch ($framework)
{
case 'bs3':
case 'bs4':
$xsC = $this->cssClass('column_extra_small') . $xs;
$smC = $this->cssClass('column_small') . $sm;
... | [
"public",
"function",
"columns",
"(",
"$",
"xs",
",",
"$",
"sm",
",",
"$",
"md",
",",
"$",
"lg",
")",
"{",
"$",
"framework",
"=",
"$",
"this",
"->",
"getFramework",
"(",
")",
";",
"switch",
"(",
"$",
"framework",
")",
"{",
"case",
"'bs3'",
":",
... | Create framework column class.
@param integer $xs Extra Small (Ignored on Foundation
@param integer $sm Small.
@param integer $md Medium.
@param integer $lg Large.
@return string | [
"Create",
"framework",
"column",
"class",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/UI.php#L47-L71 |
taskforcedev/laravel-support | src/Helpers/UI.php | UI.getClasses | public function getClasses($framework)
{
switch ($framework)
{
case 'bs3':
$classes = $this->json->bs3;
break;
case 'bs4':
$classes = $this->json->bs4;
break;
case 'f6':
$classes = $th... | php | public function getClasses($framework)
{
switch ($framework)
{
case 'bs3':
$classes = $this->json->bs3;
break;
case 'bs4':
$classes = $this->json->bs4;
break;
case 'f6':
$classes = $th... | [
"public",
"function",
"getClasses",
"(",
"$",
"framework",
")",
"{",
"switch",
"(",
"$",
"framework",
")",
"{",
"case",
"'bs3'",
":",
"$",
"classes",
"=",
"$",
"this",
"->",
"json",
"->",
"bs3",
";",
"break",
";",
"case",
"'bs4'",
":",
"$",
"classes"... | Get the css class matrix for the given framework.
@param string $framework Framework.
@return string | [
"Get",
"the",
"css",
"class",
"matrix",
"for",
"the",
"given",
"framework",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/UI.php#L96-L114 |
wpup/digster | src/nodes/class-trans.php | Trans.compile | public function compile(Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
list($msg, $vars) = $this->compileString($this->getNode('body'));
if (null !== $this->getNode('plural')) {
list($msg1, $vars1) = $this->compileString($this->getNode('plural'));
$vars... | php | public function compile(Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
list($msg, $vars) = $this->compileString($this->getNode('body'));
if (null !== $this->getNode('plural')) {
list($msg1, $vars1) = $this->compileString($this->getNode('plural'));
$vars... | [
"public",
"function",
"compile",
"(",
"Twig_Compiler",
"$",
"compiler",
")",
"{",
"$",
"compiler",
"->",
"addDebugInfo",
"(",
"$",
"this",
")",
";",
"list",
"(",
"$",
"msg",
",",
"$",
"vars",
")",
"=",
"$",
"this",
"->",
"compileString",
"(",
"$",
"t... | Compiles the node to PHP.
@param Twig_Compiler $compiler A Twig_Compiler instance | [
"Compiles",
"the",
"node",
"to",
"PHP",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/nodes/class-trans.php#L54-L146 |
wpup/digster | src/nodes/class-trans.php | Trans.compileString | protected function compileString(Twig_Node $body)
{
if ($body instanceof Twig_Node_Expression_Name || $body instanceof Twig_Node_Expression_Constant || $body instanceof Twig_Node_Expression_TempName) {
return array($body, array());
}
$vars = array();
if (count($body)) {
... | php | protected function compileString(Twig_Node $body)
{
if ($body instanceof Twig_Node_Expression_Name || $body instanceof Twig_Node_Expression_Constant || $body instanceof Twig_Node_Expression_TempName) {
return array($body, array());
}
$vars = array();
if (count($body)) {
... | [
"protected",
"function",
"compileString",
"(",
"Twig_Node",
"$",
"body",
")",
"{",
"if",
"(",
"$",
"body",
"instanceof",
"Twig_Node_Expression_Name",
"||",
"$",
"body",
"instanceof",
"Twig_Node_Expression_Constant",
"||",
"$",
"body",
"instanceof",
"Twig_Node_Expressi... | @param Twig_Node $body A Twig_Node instance
@return array | [
"@param",
"Twig_Node",
"$body",
"A",
"Twig_Node",
"instance"
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/nodes/class-trans.php#L153-L184 |
sifophp/sifo-common-instance | classes/MailExt.php | MailExt.send | public function send( $to, $subject, $body )
{
// Debug advice:
if ( \Sifo\Domains::getInstance()->getDebugMode() )
{
$this->_dispatchMailController( $to, $subject, $body );
}
return parent::send( $to, $subject, $body );
} | php | public function send( $to, $subject, $body )
{
// Debug advice:
if ( \Sifo\Domains::getInstance()->getDebugMode() )
{
$this->_dispatchMailController( $to, $subject, $body );
}
return parent::send( $to, $subject, $body );
} | [
"public",
"function",
"send",
"(",
"$",
"to",
",",
"$",
"subject",
",",
"$",
"body",
")",
"{",
"// Debug advice:",
"if",
"(",
"\\",
"Sifo",
"\\",
"Domains",
"::",
"getInstance",
"(",
")",
"->",
"getDebugMode",
"(",
")",
")",
"{",
"$",
"this",
"->",
... | Send an email whith debug interruption.
@param string $to
@param string $subject
@param string $body
@return boolean | [
"Send",
"an",
"email",
"whith",
"debug",
"interruption",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/MailExt.php#L15-L23 |
venta/framework | src/Http/src/ResponseFactory.php | ResponseFactory.createJsonResponse | public function createJsonResponse(
$data,
int $status = 200,
array $headers = [],
int $encodingOptions = ResponseFactoryContract::JSON_FLAG
): ResponseInterface {
return new JsonResponse($data, $status, $headers, $encodingOptions);
} | php | public function createJsonResponse(
$data,
int $status = 200,
array $headers = [],
int $encodingOptions = ResponseFactoryContract::JSON_FLAG
): ResponseInterface {
return new JsonResponse($data, $status, $headers, $encodingOptions);
} | [
"public",
"function",
"createJsonResponse",
"(",
"$",
"data",
",",
"int",
"$",
"status",
"=",
"200",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"int",
"$",
"encodingOptions",
"=",
"ResponseFactoryContract",
"::",
"JSON_FLAG",
")",
":",
"ResponseInterf... | {@inheritdoc} | [
"{"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Http/src/ResponseFactory.php#L40-L48 |
venta/framework | src/Http/src/ResponseFactory.php | ResponseFactory.createRedirectResponse | public function createRedirectResponse($uri, int $status = 302, array $headers = []): ResponseInterface
{
return new RedirectResponse($uri, $status, $headers);
} | php | public function createRedirectResponse($uri, int $status = 302, array $headers = []): ResponseInterface
{
return new RedirectResponse($uri, $status, $headers);
} | [
"public",
"function",
"createRedirectResponse",
"(",
"$",
"uri",
",",
"int",
"$",
"status",
"=",
"302",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"return",
"new",
"RedirectResponse",
"(",
"$",
"uri",
",",
"$",
"stat... | {@inheritdoc} | [
"{"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Http/src/ResponseFactory.php#L53-L56 |
venta/framework | src/Http/src/ResponseFactory.php | ResponseFactory.createResponse | public function createResponse($body = 'php://memory', int $status = 200, array $headers = []): ResponseInterface
{
return new Response($body, $status, $headers);
} | php | public function createResponse($body = 'php://memory', int $status = 200, array $headers = []): ResponseInterface
{
return new Response($body, $status, $headers);
} | [
"public",
"function",
"createResponse",
"(",
"$",
"body",
"=",
"'php://memory'",
",",
"int",
"$",
"status",
"=",
"200",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"return",
"new",
"Response",
"(",
"$",
"body",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Http/src/ResponseFactory.php#L61-L64 |
f3ath/appnexusclient | src/MemcachedTokenStorage.php | MemcachedTokenStorage.set | public function set($username, $token)
{
$this->memcached->set($this->prefix.$username, $token);
} | php | public function set($username, $token)
{
$this->memcached->set($this->prefix.$username, $token);
} | [
"public",
"function",
"set",
"(",
"$",
"username",
",",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"memcached",
"->",
"set",
"(",
"$",
"this",
"->",
"prefix",
".",
"$",
"username",
",",
"$",
"token",
")",
";",
"}"
] | set token
@param string $username
@param string $token
@return void | [
"set",
"token"
] | train | https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/MemcachedTokenStorage.php#L38-L41 |
ignasbernotas/console | src/Question/MultipleChoiceQuestion.php | MultipleChoiceQuestion.selectChoice | protected function selectChoice()
{
$index = array_search(
$this->choices[$this->cursor->getPosition()],
$this->answers
);
if (false !== $index) {
unset($this->answers[$index]);
} else {
$this->answers[] = $this->choices[$this->cursor-... | php | protected function selectChoice()
{
$index = array_search(
$this->choices[$this->cursor->getPosition()],
$this->answers
);
if (false !== $index) {
unset($this->answers[$index]);
} else {
$this->answers[] = $this->choices[$this->cursor-... | [
"protected",
"function",
"selectChoice",
"(",
")",
"{",
"$",
"index",
"=",
"array_search",
"(",
"$",
"this",
"->",
"choices",
"[",
"$",
"this",
"->",
"cursor",
"->",
"getPosition",
"(",
")",
"]",
",",
"$",
"this",
"->",
"answers",
")",
";",
"if",
"("... | Allows selecting multiple choices
@return $this | [
"Allows",
"selecting",
"multiple",
"choices"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/Question/MultipleChoiceQuestion.php#L27-L43 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.setData | public function setData($type = 'request')
{
// Reset it.
$this->_request = false;
$types = array('request' => $_REQUEST, 'get' => $_GET, 'post' => $_POST);
$typeSet = (empty($type) || !isset($types[$type])) ? $_REQUEST : $types[$type];
$this->_request = $this->sanitize($typeSet);
unset($types, $type);
... | php | public function setData($type = 'request')
{
// Reset it.
$this->_request = false;
$types = array('request' => $_REQUEST, 'get' => $_GET, 'post' => $_POST);
$typeSet = (empty($type) || !isset($types[$type])) ? $_REQUEST : $types[$type];
$this->_request = $this->sanitize($typeSet);
unset($types, $type);
... | [
"public",
"function",
"setData",
"(",
"$",
"type",
"=",
"'request'",
")",
"{",
"// Reset it.",
"$",
"this",
"->",
"_request",
"=",
"false",
";",
"$",
"types",
"=",
"array",
"(",
"'request'",
"=>",
"$",
"_REQUEST",
",",
"'get'",
"=>",
"$",
"_GET",
",",
... | Sets {@link $_request} with the value of the requested superglobal var
can be called directly but its also called by Ohara::data()
@param string $type request, post or get. The name of the superblogal you want to fetch, defaults to request
@access public
@return void | [
"Sets",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L37-L48 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.put | public function put($data = [])
{
if (empty($data))
return false;
$this->setData();
$data = (array) $data;
foreach ($data as $name => $value)
$this->_request[$name] = $_REQUEST[$name] = $this->sanitize($value);
return $this->_request;
} | php | public function put($data = [])
{
if (empty($data))
return false;
$this->setData();
$data = (array) $data;
foreach ($data as $name => $value)
$this->_request[$name] = $_REQUEST[$name] = $this->sanitize($value);
return $this->_request;
} | [
"public",
"function",
"put",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"setData",
"(",
")",
";",
"$",
"data",
"=",
"(",
"array",
")",
"$",
"data",
";"... | Inserts a new value to {@link $_request}
@param array $data an array of data to be added. Uses a name => value format.
@access public
@return mixed false on fail array. | [
"Inserts",
"a",
"new",
"value",
"to",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L56-L69 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.get | public function get($var = '', $default = null)
{
if (empty($var))
return false;
$this->setData();
return $this->validate($var) ? $this->_request[$var] : (!is_null($default) ? $default : false);
} | php | public function get($var = '', $default = null)
{
if (empty($var))
return false;
$this->setData();
return $this->validate($var) ? $this->_request[$var] : (!is_null($default) ? $default : false);
} | [
"public",
"function",
"get",
"(",
"$",
"var",
"=",
"''",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"var",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"setData",
"(",
")",
";",
"return",
"$",
"this",
"->"... | Sanitizes and returns the requested value.
calls Suki\Data::sanitize() to properly clean up
@param string $var the superglobal's key name you want to retrieve.
@param mixed $default The default value used if the setting doesn't exists.
@access public
@return mixed | [
"Sanitizes",
"and",
"returns",
"the",
"requested",
"value",
".",
"calls",
"Suki",
"\\",
"Data",
"::",
"sanitize",
"()",
"to",
"properly",
"clean",
"up"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L79-L87 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.validate | public function validate($var): bool
{
// $var should always be a string, it should be the name of the var you want to validate, not the actual var!
if (!is_string($var))
return false;
// Forgot something?
if (!$this->_request)
$this->setData();
return (isset($this->_request[$var]));
} | php | public function validate($var): bool
{
// $var should always be a string, it should be the name of the var you want to validate, not the actual var!
if (!is_string($var))
return false;
// Forgot something?
if (!$this->_request)
$this->setData();
return (isset($this->_request[$var]));
} | [
"public",
"function",
"validate",
"(",
"$",
"var",
")",
":",
"bool",
"{",
"// $var should always be a string, it should be the name of the var you want to validate, not the actual var!",
"if",
"(",
"!",
"is_string",
"(",
"$",
"var",
")",
")",
"return",
"false",
";",
"//... | Checks the var against {@link $_request} to know if it exists and its defined or not.
calls Ohara::setData() in case {@link $_request} is empty by the time this method its called
@param string $var the superglobal's key name you want to check
@access public
@return boolean | [
"Checks",
"the",
"var",
"against",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L110-L121 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.sanitize | public function sanitize($var)
{
global $smcFunc;
if (is_array($var))
{
foreach ($var as $k => $v)
$var[$k] = $this->sanitize($v);
return $var;
}
else
{
$var = (string) $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($var), ENT_QUOTES);
if (ctype_digit($var))
$var = (int) $var;
... | php | public function sanitize($var)
{
global $smcFunc;
if (is_array($var))
{
foreach ($var as $k => $v)
$var[$k] = $this->sanitize($v);
return $var;
}
else
{
$var = (string) $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($var), ENT_QUOTES);
if (ctype_digit($var))
$var = (int) $var;
... | [
"public",
"function",
"sanitize",
"(",
"$",
"var",
")",
"{",
"global",
"$",
"smcFunc",
";",
"if",
"(",
"is_array",
"(",
"$",
"var",
")",
")",
"{",
"foreach",
"(",
"$",
"var",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"$",
"var",
"[",
"$",
"k",
"]"... | Sanitizes a var. Recursive.
Treats any var as a string and cast it as an integer if necessary.
@param mixed $var The var you want to sanitize
@access public
@return mixed | [
"Sanitizes",
"a",
"var",
".",
"Recursive",
".",
"Treats",
"any",
"var",
"as",
"a",
"string",
"and",
"cast",
"it",
"as",
"an",
"integer",
"if",
"necessary",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L130-L154 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.setUpdate | public function setUpdate($key, $message)
{
// Define an update key for this class.
if (!isset($_SESSION[$this->_app->name]['update']))
$_SESSION[$this->_app->name]['update'] = [];
// We need a key and an actual message...
if (empty($key) || empty($message))
return false;
// Store it! or overwrite it... | php | public function setUpdate($key, $message)
{
// Define an update key for this class.
if (!isset($_SESSION[$this->_app->name]['update']))
$_SESSION[$this->_app->name]['update'] = [];
// We need a key and an actual message...
if (empty($key) || empty($message))
return false;
// Store it! or overwrite it... | [
"public",
"function",
"setUpdate",
"(",
"$",
"key",
",",
"$",
"message",
")",
"{",
"// Define an update key for this class.",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_app",
"->",
"name",
"]",
"[",
"'update'",
"]",
")",
")"... | Sets a temp var in $_SESSION.
Ohara automatically creates a new key in $_SESSION using {@link $name}
@param string $key The unique identifier for your message
@param mixed $message ideally to store a message but can be used to store any type of variable
@access public
@return boolean | [
"Sets",
"a",
"temp",
"var",
"in",
"$_SESSION",
".",
"Ohara",
"automatically",
"creates",
"a",
"new",
"key",
"in",
"$_SESSION",
"using",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L164-L176 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.getUpdate | public function getUpdate($key)
{
if (empty($key))
return false;
$update = !empty($_SESSION[$this->_app->name]['update'][$key]) ? $_SESSION[$this->_app->name]['update'][$key] : false;
if (!empty($update))
$this->cleanUpdate($key);
return $update;
} | php | public function getUpdate($key)
{
if (empty($key))
return false;
$update = !empty($_SESSION[$this->_app->name]['update'][$key]) ? $_SESSION[$this->_app->name]['update'][$key] : false;
if (!empty($update))
$this->cleanUpdate($key);
return $update;
} | [
"public",
"function",
"getUpdate",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
")",
"return",
"false",
";",
"$",
"update",
"=",
"!",
"empty",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_app",
"->",
"name",
"]",
"[",
... | Gets the var previously added by Ohara::setUpdate()
calls Ohara::cleanUpdate() to delete the entry from $_SESSION
@param string $key The unique identifier for your message
@access public
@return mixed | [
"Gets",
"the",
"var",
"previously",
"added",
"by",
"Ohara",
"::",
"setUpdate",
"()",
"calls",
"Ohara",
"::",
"cleanUpdate",
"()",
"to",
"delete",
"the",
"entry",
"from",
"$_SESSION"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L185-L196 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.getAllUpdates | public function getAllUpdates()
{
$update = !empty($_SESSION[$this->_app->name]['update']) ? $_SESSION[$this->_app->name]['update'] : false;
// Clean em all!
$this->cleanUpdate();
return $update;
} | php | public function getAllUpdates()
{
$update = !empty($_SESSION[$this->_app->name]['update']) ? $_SESSION[$this->_app->name]['update'] : false;
// Clean em all!
$this->cleanUpdate();
return $update;
} | [
"public",
"function",
"getAllUpdates",
"(",
")",
"{",
"$",
"update",
"=",
"!",
"empty",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_app",
"->",
"name",
"]",
"[",
"'update'",
"]",
")",
"?",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_app",
"->",
... | Gets all vars associated with the the extending class using {@link $name}
calls Ohara::cleanUpdate() to delete the entry from $_SESSION
@access public
@return mixed|boolean | [
"Gets",
"all",
"vars",
"associated",
"with",
"the",
"the",
"extending",
"class",
"using",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L204-L212 |
MissAllSunday/Ohara | src/Suki/Data.php | Data.cleanUpdate | public function cleanUpdate($key = '')
{
// No key means you want to clean em all.
if (empty($key))
unset($_SESSION[$this->_app->name]['update']);
else
unset($_SESSION[$this->_app->name]['update'][$key]);
} | php | public function cleanUpdate($key = '')
{
// No key means you want to clean em all.
if (empty($key))
unset($_SESSION[$this->_app->name]['update']);
else
unset($_SESSION[$this->_app->name]['update'][$key]);
} | [
"public",
"function",
"cleanUpdate",
"(",
"$",
"key",
"=",
"''",
")",
"{",
"// No key means you want to clean em all.",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
")",
"unset",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_app",
"->",
"name",
"]",
"[",
... | Deletes the key from $_SESSION
automatically called by any getter after retrieving the needed message.
@param string $key The unique identifier for your message. No key means all messages will be cleaned.
@access public | [
"Deletes",
"the",
"key",
"from",
"$_SESSION",
"automatically",
"called",
"by",
"any",
"getter",
"after",
"retrieving",
"the",
"needed",
"message",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Data.php#L220-L228 |
dpu/edu-sdk-php | src/Account/Service/AccountService.php | AccountService.updatePassword | public function updatePassword($token, $oldPassword, $newPassword)
{
return $this->bizImpl->updatePassword($token, $oldPassword, $newPassword);
} | php | public function updatePassword($token, $oldPassword, $newPassword)
{
return $this->bizImpl->updatePassword($token, $oldPassword, $newPassword);
} | [
"public",
"function",
"updatePassword",
"(",
"$",
"token",
",",
"$",
"oldPassword",
",",
"$",
"newPassword",
")",
"{",
"return",
"$",
"this",
"->",
"bizImpl",
"->",
"updatePassword",
"(",
"$",
"token",
",",
"$",
"oldPassword",
",",
"$",
"newPassword",
")",... | !!!不建议使用!!!
更新密码
@param string $token 用户身份令牌
@param string $oldPassword 旧密码
@param string $newPassword 新密码
@return bool | [
"!!!不建议使用!!!",
"更新密码"
] | train | https://github.com/dpu/edu-sdk-php/blob/a2994e89c6222021a62b5d2fa125680905146527/src/Account/Service/AccountService.php#L39-L42 |
kriskbx/mikado | spec/DummyData.php | DummyData.getStdClass | public function getStdClass($formatAble = false)
{
$object = new stdClass();
$object->testProperty = 'test';
$object->nullProperty = null;
$object->arrayProperty = [
'level1' => [
'level2a' => null,
'level2' => [
'level3... | php | public function getStdClass($formatAble = false)
{
$object = new stdClass();
$object->testProperty = 'test';
$object->nullProperty = null;
$object->arrayProperty = [
'level1' => [
'level2a' => null,
'level2' => [
'level3... | [
"public",
"function",
"getStdClass",
"(",
"$",
"formatAble",
"=",
"false",
")",
"{",
"$",
"object",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"object",
"->",
"testProperty",
"=",
"'test'",
";",
"$",
"object",
"->",
"nullProperty",
"=",
"null",
";",
"... | Get stdClass dummy data.
@param bool $formatAble
@return stdClass | [
"Get",
"stdClass",
"dummy",
"data",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/spec/DummyData.php#L20-L40 |
kriskbx/mikado | spec/DummyData.php | DummyData.getStdClassWithArray | public function getStdClassWithArray($formatAble = false)
{
$object = new stdClass();
$object->array = [
[
'key' => 'value',
'key2' => 'value2',
],
];
if ($formatAble) {
$object = Manager::formatAble($object);
... | php | public function getStdClassWithArray($formatAble = false)
{
$object = new stdClass();
$object->array = [
[
'key' => 'value',
'key2' => 'value2',
],
];
if ($formatAble) {
$object = Manager::formatAble($object);
... | [
"public",
"function",
"getStdClassWithArray",
"(",
"$",
"formatAble",
"=",
"false",
")",
"{",
"$",
"object",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"object",
"->",
"array",
"=",
"[",
"[",
"'key'",
"=>",
"'value'",
",",
"'key2'",
"=>",
"'value2'",
... | Get stdClass dummy data with array.
@param bool|false $formatAble
@return stdClass | [
"Get",
"stdClass",
"dummy",
"data",
"with",
"array",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/spec/DummyData.php#L49-L64 |
kriskbx/mikado | spec/DummyData.php | DummyData.getPost | public function getPost($formatAble = false)
{
$post = Post::published()->first();
$post = self::fix($post);
if ($formatAble) {
$post = Manager::formatAble($post);
}
return $post;
} | php | public function getPost($formatAble = false)
{
$post = Post::published()->first();
$post = self::fix($post);
if ($formatAble) {
$post = Manager::formatAble($post);
}
return $post;
} | [
"public",
"function",
"getPost",
"(",
"$",
"formatAble",
"=",
"false",
")",
"{",
"$",
"post",
"=",
"Post",
"::",
"published",
"(",
")",
"->",
"first",
"(",
")",
";",
"$",
"post",
"=",
"self",
"::",
"fix",
"(",
"$",
"post",
")",
";",
"if",
"(",
... | Get WordPress dummy data.
@param bool $formatAble
@return object | [
"Get",
"WordPress",
"dummy",
"data",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/spec/DummyData.php#L73-L83 |
kriskbx/mikado | spec/DummyData.php | DummyData.getMultiplePosts | public function getMultiplePosts($formatAble = false)
{
$posts = Post::published()->get();
foreach ($posts as $key => $post) {
$posts[$key] = self::fix($post);
if ($formatAble) {
$posts[$key] = Manager::formatAble($posts[$key]);
}
}
... | php | public function getMultiplePosts($formatAble = false)
{
$posts = Post::published()->get();
foreach ($posts as $key => $post) {
$posts[$key] = self::fix($post);
if ($formatAble) {
$posts[$key] = Manager::formatAble($posts[$key]);
}
}
... | [
"public",
"function",
"getMultiplePosts",
"(",
"$",
"formatAble",
"=",
"false",
")",
"{",
"$",
"posts",
"=",
"Post",
"::",
"published",
"(",
")",
"->",
"get",
"(",
")",
";",
"foreach",
"(",
"$",
"posts",
"as",
"$",
"key",
"=>",
"$",
"post",
")",
"{... | Get multiple WordPress data.
@param bool|false $formatAble
@return mixed | [
"Get",
"multiple",
"WordPress",
"data",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/spec/DummyData.php#L92-L105 |
kriskbx/mikado | spec/DummyData.php | DummyData.fix | public function fix($object)
{
$reflection = new ReflectionObject($object);
$attributeProperty = $reflection->getProperty('attributes');
$attributeProperty->setAccessible(true);
$attributes = $attributeProperty->getValue($object);
$dateProperty = $reflection->getProperty('d... | php | public function fix($object)
{
$reflection = new ReflectionObject($object);
$attributeProperty = $reflection->getProperty('attributes');
$attributeProperty->setAccessible(true);
$attributes = $attributeProperty->getValue($object);
$dateProperty = $reflection->getProperty('d... | [
"public",
"function",
"fix",
"(",
"$",
"object",
")",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionObject",
"(",
"$",
"object",
")",
";",
"$",
"attributeProperty",
"=",
"$",
"reflection",
"->",
"getProperty",
"(",
"'attributes'",
")",
";",
"$",
"attribut... | The SQLite database stores datetime values including microseconds. WordPress does not.
So toArray() and toJson() will fail in the tests if we don't fix that.
Carbon wants a specific format and gets something else thus throws an Exception.
@param object $object
@return object | [
"The",
"SQLite",
"database",
"stores",
"datetime",
"values",
"including",
"microseconds",
".",
"WordPress",
"does",
"not",
".",
"So",
"toArray",
"()",
"and",
"toJson",
"()",
"will",
"fail",
"in",
"the",
"tests",
"if",
"we",
"don",
"t",
"fix",
"that",
".",
... | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/spec/DummyData.php#L116-L135 |
pantera-digital/yii2-seo | models/SeoModelSearch.php | SeoModelSearch.search | public function search($params)
{
$dataProvider = parent::search($params);
if (!$this->validate()) {
return $dataProvider;
}
$dataProvider->query->andWhere(['IS NOT', Seo::tableName() . '.item_id', null])
->andFilterWhere([
Seo::tableName() . '... | php | public function search($params)
{
$dataProvider = parent::search($params);
if (!$this->validate()) {
return $dataProvider;
}
$dataProvider->query->andWhere(['IS NOT', Seo::tableName() . '.item_id', null])
->andFilterWhere([
Seo::tableName() . '... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"dataProvider",
"=",
"parent",
"::",
"search",
"(",
"$",
"params",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"return",
"$",
"dataProvider",
";",
"... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoModelSearch.php#L27-L39 |
Stratadox/ImmutableCollection | src/ImmutableCollection.php | ImmutableCollection.offsetSet | final public function offsetSet($index, $value): void
{
if (is_null($index)) {
throw CannotAlterCollection::byAddingTo($this);
}
throw CannotAlterCollection::byOverWriting($this, $index);
} | php | final public function offsetSet($index, $value): void
{
if (is_null($index)) {
throw CannotAlterCollection::byAddingTo($this);
}
throw CannotAlterCollection::byOverWriting($this, $index);
} | [
"final",
"public",
"function",
"offsetSet",
"(",
"$",
"index",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"is_null",
"(",
"$",
"index",
")",
")",
"{",
"throw",
"CannotAlterCollection",
"::",
"byAddingTo",
"(",
"$",
"this",
")",
";",
"}",
"t... | Disallows use of the offsetSet method.
@param int|mixed $index The index that may not be mutated.
@param mixed $value The value that will not be written.
@throws NotAllowed Whenever called upon. | [
"Disallows",
"use",
"of",
"the",
"offsetSet",
"method",
"."
] | train | https://github.com/Stratadox/ImmutableCollection/blob/eac441bc1762eefda6da25354b4e8f91f48bd733/src/ImmutableCollection.php#L60-L66 |
fetus-hina/docomo-dialogue | src/UserInformation.php | UserInformation.setNickname | public function setNickname($value)
{
validators\Text::validate($value, 10, 'nickname too long');
$this->parameters['nickname'] = mb_substr($value, 0, 10, 'UTF-8');
return $this;
} | php | public function setNickname($value)
{
validators\Text::validate($value, 10, 'nickname too long');
$this->parameters['nickname'] = mb_substr($value, 0, 10, 'UTF-8');
return $this;
} | [
"public",
"function",
"setNickname",
"(",
"$",
"value",
")",
"{",
"validators",
"\\",
"Text",
"::",
"validate",
"(",
"$",
"value",
",",
"10",
",",
"'nickname too long'",
")",
";",
"$",
"this",
"->",
"parameters",
"[",
"'nickname'",
"]",
"=",
"mb_substr",
... | ユーザのニックネームを設定する
@param string $value ニックネーム(最大10文字)
@return self
@throws DomainError | [
"ユーザのニックネームを設定する"
] | train | https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/UserInformation.php#L307-L312 |
fetus-hina/docomo-dialogue | src/UserInformation.php | UserInformation.setNicknameY | public function setNicknameY($value)
{
validators\Text::validate($value, 20, 'nickname(yomi) too long');
$value = mb_substr($value, 0, 20, 'UTF-8');
if (!preg_match('/^[゠-ヿ]+$/u', $value)) {
throw new DomainError('nickname(yomi) accept only katakana');
}
$this->pa... | php | public function setNicknameY($value)
{
validators\Text::validate($value, 20, 'nickname(yomi) too long');
$value = mb_substr($value, 0, 20, 'UTF-8');
if (!preg_match('/^[゠-ヿ]+$/u', $value)) {
throw new DomainError('nickname(yomi) accept only katakana');
}
$this->pa... | [
"public",
"function",
"setNicknameY",
"(",
"$",
"value",
")",
"{",
"validators",
"\\",
"Text",
"::",
"validate",
"(",
"$",
"value",
",",
"20",
",",
"'nickname(yomi) too long'",
")",
";",
"$",
"value",
"=",
"mb_substr",
"(",
"$",
"value",
",",
"0",
",",
... | ユーザのニックネーム(読み)を設定する
@param string $value ニックネームの読み(最大20文字)
@return self
@throws DomainError | [
"ユーザのニックネーム(読み)を設定する"
] | train | https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/UserInformation.php#L321-L330 |
fetus-hina/docomo-dialogue | src/UserInformation.php | UserInformation.setSex | public function setSex($value)
{
if ($value !== self::SEX_MALE &&
$value !== self::SEX_FEMALE &&
$value !== self::SEX_OTHERS) {
throw new DomainError("Invalid sex");
}
$this->parameters['sex'] = $value;
return $this;
} | php | public function setSex($value)
{
if ($value !== self::SEX_MALE &&
$value !== self::SEX_FEMALE &&
$value !== self::SEX_OTHERS) {
throw new DomainError("Invalid sex");
}
$this->parameters['sex'] = $value;
return $this;
} | [
"public",
"function",
"setSex",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"self",
"::",
"SEX_MALE",
"&&",
"$",
"value",
"!==",
"self",
"::",
"SEX_FEMALE",
"&&",
"$",
"value",
"!==",
"self",
"::",
"SEX_OTHERS",
")",
"{",
"throw",
"n... | ユーザの性別を設定する
@param string $value ユーザの性別 SEX_MALE | SEX_FEMALE | SEX_OTHERS
@return self
@throws DomainError | [
"ユーザの性別を設定する"
] | train | https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/UserInformation.php#L339-L348 |
fetus-hina/docomo-dialogue | src/UserInformation.php | UserInformation.setBloodType | public function setBloodType($value)
{
if ($value !== self::BLOOD_TYPE_A &&
$value !== self::BLOOD_TYPE_B &&
$value !== self::BLOOD_TYPE_O &&
$value !== self::BLOOD_TYPE_AB &&
$value !== self::BLOOD_TYPE_UNKNOWN) {
throw new DomainError("Invalid bloodt... | php | public function setBloodType($value)
{
if ($value !== self::BLOOD_TYPE_A &&
$value !== self::BLOOD_TYPE_B &&
$value !== self::BLOOD_TYPE_O &&
$value !== self::BLOOD_TYPE_AB &&
$value !== self::BLOOD_TYPE_UNKNOWN) {
throw new DomainError("Invalid bloodt... | [
"public",
"function",
"setBloodType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"self",
"::",
"BLOOD_TYPE_A",
"&&",
"$",
"value",
"!==",
"self",
"::",
"BLOOD_TYPE_B",
"&&",
"$",
"value",
"!==",
"self",
"::",
"BLOOD_TYPE_O",
"&&",
"$",
... | ユーザの血液型を設定する
@param string $value ユーザの血液型 BLOOD_TYPE_*
@return self
@throws DomainError | [
"ユーザの血液型を設定する"
] | train | https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/UserInformation.php#L357-L368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.