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 |
|---|---|---|---|---|---|---|---|---|---|---|
wisp-x/hopephp | hopephp/library/hope/Config.php | Config.init | public static function init()
{
$files = File::getFolder(CONF_PATH)['file'];
foreach ($files as $item => $file) {
if (is_file(CONF_PATH . $file)) {
$conf = self::load(CONF_PATH . $file);
if (0 === $item) {
self::$config = $conf;
} else {
self::$config[basename($file, EXT)] = $conf;
}
}
}
return self::$config;
} | php | public static function init()
{
$files = File::getFolder(CONF_PATH)['file'];
foreach ($files as $item => $file) {
if (is_file(CONF_PATH . $file)) {
$conf = self::load(CONF_PATH . $file);
if (0 === $item) {
self::$config = $conf;
} else {
self::$config[basename($file, EXT)] = $conf;
}
}
}
return self::$config;
} | [
"public",
"static",
"function",
"init",
"(",
")",
"{",
"$",
"files",
"=",
"File",
"::",
"getFolder",
"(",
"CONF_PATH",
")",
"[",
"'file'",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"item",
"=>",
"$",
"file",
")",
"{",
"if",
"(",
"is_file",... | 初始化系统配置
@return array | [
"初始化系统配置"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Config.php#L26-L40 |
wisp-x/hopephp | hopephp/library/hope/Config.php | Config.has | public static function has($name)
{
if (!strpos($name, '.')) {
return isset(self::$config[strtolower($name)]);
}
$name = explode('.', $name, 2);
return isset(self::$config[strtolower($name[0])][$name[1]]);
} | php | public static function has($name)
{
if (!strpos($name, '.')) {
return isset(self::$config[strtolower($name)]);
}
$name = explode('.', $name, 2);
return isset(self::$config[strtolower($name[0])][$name[1]]);
} | [
"public",
"static",
"function",
"has",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
")",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"config",
"[",
"strtolower",
"(",
"$",
"name",
")",
"]",
")",
"... | 判断配置是否设置
@param $name
@return bool | [
"判断配置是否设置"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Config.php#L47-L55 |
wisp-x/hopephp | hopephp/library/hope/Config.php | Config.get | public static function get($name = '')
{
if (!empty($name)) {
if (false !== strpos($name, '.')) {
$data = explode('.', $name, 2);
$data[0] = strtolower($data[0]);
if (isset($data[1]) && $data[1]) {
return isset(self::$config[$data[0]][$data[1]]) ? self::$config[$data[0]][$data[1]] : null;
}
return isset(self::$config[$data[0]]) ? self::$config[$data[0]] : null;
} else {
return isset(self::$config[$name]) ? self::$config[$name] : null;
}
}
return self::$config;
} | php | public static function get($name = '')
{
if (!empty($name)) {
if (false !== strpos($name, '.')) {
$data = explode('.', $name, 2);
$data[0] = strtolower($data[0]);
if (isset($data[1]) && $data[1]) {
return isset(self::$config[$data[0]][$data[1]]) ? self::$config[$data[0]][$data[1]] : null;
}
return isset(self::$config[$data[0]]) ? self::$config[$data[0]] : null;
} else {
return isset(self::$config[$name]) ? self::$config[$name] : null;
}
}
return self::$config;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
")",
"{",
"$",
"data",
"=",
"explo... | 获取配置数据
@param string $name 配置名,支持二级配置(. 分割)
@return array | [
"获取配置数据"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Config.php#L73-L90 |
CampaignChain/core | Resources/update/schema/Version20161217131313.php | Version20161217131313.preUp | public function preUp(Schema $schema)
{
/** @var ManagerRegistry $doctrine */
$doctrine = $this->container->get('doctrine');
$em = $doctrine->getManager();
// Get all Campaigns.
$campaigns = $em->getRepository('CampaignChain\CoreBundle\Entity\Campaign')
->findAll();
if($campaigns){
try {
$em->getConnection()->beginTransaction();
/** @var Campaign $campaign */
foreach($campaigns as $campaign){
/** @var Action $firstAction */
$firstAction = $em->getRepository('CampaignChain\CoreBundle\Entity\Campaign')
->getFirstAction($campaign);
if($firstAction && $firstAction->getStartDate() < $campaign->getStartDate()){
$campaign->setStartDate($firstAction->getStartDate());
$em->persist($campaign);
$this->write(
'Changed start date of campaign "'.
$campaign->getName().'" ('.$campaign->getId().') '.
'to date "'.
$campaign->getStartDate()->format(\DateTime::ISO8601)
);
} else {
$this->write(
'No changes to campaign "'.
$campaign->getName().'" ('.$campaign->getId().').'
);
}
}
$em->flush();
$em->getConnection()->commit();
} catch (\Exception $e) {
$em->getConnection()->rollback();
$this->write($e->getMessage());
}
}
} | php | public function preUp(Schema $schema)
{
/** @var ManagerRegistry $doctrine */
$doctrine = $this->container->get('doctrine');
$em = $doctrine->getManager();
// Get all Campaigns.
$campaigns = $em->getRepository('CampaignChain\CoreBundle\Entity\Campaign')
->findAll();
if($campaigns){
try {
$em->getConnection()->beginTransaction();
/** @var Campaign $campaign */
foreach($campaigns as $campaign){
/** @var Action $firstAction */
$firstAction = $em->getRepository('CampaignChain\CoreBundle\Entity\Campaign')
->getFirstAction($campaign);
if($firstAction && $firstAction->getStartDate() < $campaign->getStartDate()){
$campaign->setStartDate($firstAction->getStartDate());
$em->persist($campaign);
$this->write(
'Changed start date of campaign "'.
$campaign->getName().'" ('.$campaign->getId().') '.
'to date "'.
$campaign->getStartDate()->format(\DateTime::ISO8601)
);
} else {
$this->write(
'No changes to campaign "'.
$campaign->getName().'" ('.$campaign->getId().').'
);
}
}
$em->flush();
$em->getConnection()->commit();
} catch (\Exception $e) {
$em->getConnection()->rollback();
$this->write($e->getMessage());
}
}
} | [
"public",
"function",
"preUp",
"(",
"Schema",
"$",
"schema",
")",
"{",
"/** @var ManagerRegistry $doctrine */",
"$",
"doctrine",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'doctrine'",
")",
";",
"$",
"em",
"=",
"$",
"doctrine",
"->",
"getManager... | Moves the start date of all campaigns beyond the first Action within
the campaign. This fixes the problem that before we implemented a check
that a campaign start date cannot be after its first Action, it was
actually possible.
@param Schema $schema | [
"Moves",
"the",
"start",
"date",
"of",
"all",
"campaigns",
"beyond",
"the",
"first",
"Action",
"within",
"the",
"campaign",
".",
"This",
"fixes",
"the",
"problem",
"that",
"before",
"we",
"implemented",
"a",
"check",
"that",
"a",
"campaign",
"start",
"date",... | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Resources/update/schema/Version20161217131313.php#L55-L100 |
wisp-x/hopephp | hopephp/library/hope/Request.php | Request.isSsl | public function isSsl()
{
if ($this->server('HTTPS') && ('1' == $this->server('HTTPS') || 'on' == strtolower($this->server('HTTPS')))) {
return true;
} elseif ($this->server('SERVER_PORT') && ('443' == $this->server('SERVER_PORT'))) {
return true;
}
return false;
} | php | public function isSsl()
{
if ($this->server('HTTPS') && ('1' == $this->server('HTTPS') || 'on' == strtolower($this->server('HTTPS')))) {
return true;
} elseif ($this->server('SERVER_PORT') && ('443' == $this->server('SERVER_PORT'))) {
return true;
}
return false;
} | [
"public",
"function",
"isSsl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"server",
"(",
"'HTTPS'",
")",
"&&",
"(",
"'1'",
"==",
"$",
"this",
"->",
"server",
"(",
"'HTTPS'",
")",
"||",
"'on'",
"==",
"strtolower",
"(",
"$",
"this",
"->",
"server",... | 是否Ssl
@return bool | [
"是否Ssl"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Request.php#L202-L210 |
wisp-x/hopephp | hopephp/library/hope/Request.php | Request.param | public function param($name = '')
{
switch ($this->method) {
case 'POST':
$data = $this->post();
break;
case 'GET':
$data = $this->get();
break;
}
if (empty($name)) {
return $data;
} else {
return isset($data[$name]) ? $data[$name] : null;
}
} | php | public function param($name = '')
{
switch ($this->method) {
case 'POST':
$data = $this->post();
break;
case 'GET':
$data = $this->get();
break;
}
if (empty($name)) {
return $data;
} else {
return isset($data[$name]) ? $data[$name] : null;
}
} | [
"public",
"function",
"param",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"method",
")",
"{",
"case",
"'POST'",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"post",
"(",
")",
";",
"break",
";",
"case",
"'GET'",
":",
"... | 获取请求数据
@param string $name
@return array|mixed|null | [
"获取请求数据"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Request.php#L321-L337 |
wisp-x/hopephp | hopephp/library/hope/Request.php | Request.post | public function post($name = '')
{
$data = $this->filter($_POST);
if (empty($name)) {
return $data;
} else {
return isset($data[$name]) ? $data[$name] : null;
}
} | php | public function post($name = '')
{
$data = $this->filter($_POST);
if (empty($name)) {
return $data;
} else {
return isset($data[$name]) ? $data[$name] : null;
}
} | [
"public",
"function",
"post",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"filter",
"(",
"$",
"_POST",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"else",
"{"... | 获取POST请求参数
@param string $name
@return mixed|null|array | [
"获取POST请求参数"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Request.php#L344-L353 |
wisp-x/hopephp | hopephp/library/hope/Request.php | Request.get | public function get($name = '')
{
$data = $this->filter($_GET);
if (empty($name)) {
return $data;
} else {
return isset($data[$name]) ? $data[$name] : null;
}
} | php | public function get($name = '')
{
$data = $this->filter($_GET);
if (empty($name)) {
return $data;
} else {
return isset($data[$name]) ? $data[$name] : null;
}
} | [
"public",
"function",
"get",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"filter",
"(",
"$",
"_GET",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"else",
"{",
... | 获取GET参数
@param string $name
@return mixed|null|array | [
"获取GET参数"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Request.php#L360-L369 |
wisp-x/hopephp | hopephp/library/hope/Request.php | Request.filter | public function filter(&$array) {
while(list($key, $var) = each($array)) {
if ($key != 'argc' && $key != 'argv' && (strtoupper($key) != $key || '' . intval($key) == "$key")) {
if (is_string($var)) {
$array[$key] = stripslashes($var);
}
if (is_array($var)) {
$array[$key] = $this->filter($var);
}
}
}
return $array;
} | php | public function filter(&$array) {
while(list($key, $var) = each($array)) {
if ($key != 'argc' && $key != 'argv' && (strtoupper($key) != $key || '' . intval($key) == "$key")) {
if (is_string($var)) {
$array[$key] = stripslashes($var);
}
if (is_array($var)) {
$array[$key] = $this->filter($var);
}
}
}
return $array;
} | [
"public",
"function",
"filter",
"(",
"&",
"$",
"array",
")",
"{",
"while",
"(",
"list",
"(",
"$",
"key",
",",
"$",
"var",
")",
"=",
"each",
"(",
"$",
"array",
")",
")",
"{",
"if",
"(",
"$",
"key",
"!=",
"'argc'",
"&&",
"$",
"key",
"!=",
"'arg... | 过滤
@param $array
@return mixed | [
"过滤"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/Request.php#L376-L388 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.make | public static function make($outbox_root_path, $stubbox_root_path)
{
if (!is_dir($outbox_root_path)) {
mkdir($outbox_root_path, 0755, true);
}
$outbox = FilesystemFactory::local($outbox_root_path);
$stubbox = FilesystemFactory::local($stubbox_root_path);
$context = (object) [
'outbox_root' => $outbox_root_path,
'stubbox_root' => $stubbox_root_path,
'directory' => null,
'file' => null,
];
return new static($outbox, $stubbox, $context);
} | php | public static function make($outbox_root_path, $stubbox_root_path)
{
if (!is_dir($outbox_root_path)) {
mkdir($outbox_root_path, 0755, true);
}
$outbox = FilesystemFactory::local($outbox_root_path);
$stubbox = FilesystemFactory::local($stubbox_root_path);
$context = (object) [
'outbox_root' => $outbox_root_path,
'stubbox_root' => $stubbox_root_path,
'directory' => null,
'file' => null,
];
return new static($outbox, $stubbox, $context);
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"outbox_root_path",
",",
"$",
"stubbox_root_path",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"outbox_root_path",
")",
")",
"{",
"mkdir",
"(",
"$",
"outbox_root_path",
",",
"0755",
",",
"true",
")",
";... | Create file generator.
@param string $outbox_root_path
@param string $stubbox_root_path
@return static | [
"Create",
"file",
"generator",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L40-L58 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.directory | public function directory($path, callable $callable = null)
{
$directory_path = $this->makePath($path);
$this->outbox->createDir($directory_path);
$context = clone($this->context);
$context->directory = $directory_path;
$sub = new static($this->outbox, $this->stubbox, $context);
if ($callable) {
call_user_func($callable, $sub);
}
return $sub;
} | php | public function directory($path, callable $callable = null)
{
$directory_path = $this->makePath($path);
$this->outbox->createDir($directory_path);
$context = clone($this->context);
$context->directory = $directory_path;
$sub = new static($this->outbox, $this->stubbox, $context);
if ($callable) {
call_user_func($callable, $sub);
}
return $sub;
} | [
"public",
"function",
"directory",
"(",
"$",
"path",
",",
"callable",
"$",
"callable",
"=",
"null",
")",
"{",
"$",
"directory_path",
"=",
"$",
"this",
"->",
"makePath",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"outbox",
"->",
"createDir",
"(",
... | Get directory walker.
@param string $path
@param callable $callable
@return static | [
"Get",
"directory",
"walker",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L82-L98 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.sourceDirectory | public function sourceDirectory($path)
{
foreach ($this->allFiles($this->stubbox, $this->makePath($path)) as $stubbox_path) {
if ($this->context->directory) {
$outbox_path = substr($stubbox_path, strlen($this->context->directory) + 1);
} else {
$outbox_path = $stubbox_path;
}
$this->directory(dirname($outbox_path))->file(basename($outbox_path))->source($stubbox_path);
}
} | php | public function sourceDirectory($path)
{
foreach ($this->allFiles($this->stubbox, $this->makePath($path)) as $stubbox_path) {
if ($this->context->directory) {
$outbox_path = substr($stubbox_path, strlen($this->context->directory) + 1);
} else {
$outbox_path = $stubbox_path;
}
$this->directory(dirname($outbox_path))->file(basename($outbox_path))->source($stubbox_path);
}
} | [
"public",
"function",
"sourceDirectory",
"(",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"allFiles",
"(",
"$",
"this",
"->",
"stubbox",
",",
"$",
"this",
"->",
"makePath",
"(",
"$",
"path",
")",
")",
"as",
"$",
"stubbox_path",
")",
"{"... | Generate sources.
@param string $path | [
"Generate",
"sources",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L105-L115 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.templateDirectory | public function templateDirectory($path, array $arguments = [])
{
foreach ($this->allFiles($this->stubbox, $this->makePath($path)) as $stubbox_path) {
if ($this->context->directory) {
$outbox_path = substr($stubbox_path, strlen($this->context->directory) + 1);
} else {
$outbox_path = $stubbox_path;
}
$this->directory(dirname($outbox_path))->file(basename($outbox_path))->template($stubbox_path, $arguments);
}
} | php | public function templateDirectory($path, array $arguments = [])
{
foreach ($this->allFiles($this->stubbox, $this->makePath($path)) as $stubbox_path) {
if ($this->context->directory) {
$outbox_path = substr($stubbox_path, strlen($this->context->directory) + 1);
} else {
$outbox_path = $stubbox_path;
}
$this->directory(dirname($outbox_path))->file(basename($outbox_path))->template($stubbox_path, $arguments);
}
} | [
"public",
"function",
"templateDirectory",
"(",
"$",
"path",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"allFiles",
"(",
"$",
"this",
"->",
"stubbox",
",",
"$",
"this",
"->",
"makePath",
"(",
"$",
"pat... | Generate sources from templates.
@param string $path
@param array $arguments | [
"Generate",
"sources",
"from",
"templates",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L123-L133 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.text | public function text($content, array $arguments = [])
{
$this->outbox->put($this->context->file, $arguments ? $this->generate($content, $arguments) : $content);
} | php | public function text($content, array $arguments = [])
{
$this->outbox->put($this->context->file, $arguments ? $this->generate($content, $arguments) : $content);
} | [
"public",
"function",
"text",
"(",
"$",
"content",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"outbox",
"->",
"put",
"(",
"$",
"this",
"->",
"context",
"->",
"file",
",",
"$",
"arguments",
"?",
"$",
"this",
"->",
... | Generate text file.
@param string $content
@param array $arguments | [
"Generate",
"text",
"file",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L184-L187 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.json | public function json(array $data)
{
$this->outbox->put($this->context->file, json_encode($data, JSON_PRETTY_PRINT));
} | php | public function json(array $data)
{
$this->outbox->put($this->context->file, json_encode($data, JSON_PRETTY_PRINT));
} | [
"public",
"function",
"json",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"outbox",
"->",
"put",
"(",
"$",
"this",
"->",
"context",
"->",
"file",
",",
"json_encode",
"(",
"$",
"data",
",",
"JSON_PRETTY_PRINT",
")",
")",
";",
"}"
] | Generate json file.
@param array $data | [
"Generate",
"json",
"file",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L194-L197 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.source | public function source($stub_path)
{
$this->outbox->put($this->context->file, $this->read($stub_path));
} | php | public function source($stub_path)
{
$this->outbox->put($this->context->file, $this->read($stub_path));
} | [
"public",
"function",
"source",
"(",
"$",
"stub_path",
")",
"{",
"$",
"this",
"->",
"outbox",
"->",
"put",
"(",
"$",
"this",
"->",
"context",
"->",
"file",
",",
"$",
"this",
"->",
"read",
"(",
"$",
"stub_path",
")",
")",
";",
"}"
] | Generate source file from stub.
@param string $stub_path | [
"Generate",
"source",
"file",
"from",
"stub",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L204-L207 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.template | public function template($stub_path, array $arguments = [])
{
$this->outbox->put($this->context->file, $this->generate($this->read($stub_path), $arguments));
} | php | public function template($stub_path, array $arguments = [])
{
$this->outbox->put($this->context->file, $this->generate($this->read($stub_path), $arguments));
} | [
"public",
"function",
"template",
"(",
"$",
"stub_path",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"outbox",
"->",
"put",
"(",
"$",
"this",
"->",
"context",
"->",
"file",
",",
"$",
"this",
"->",
"generate",
"(",
"$... | Generate source file from template.
@param string $stub_path
@param array $arguments | [
"Generate",
"source",
"file",
"from",
"template",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L215-L218 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.phpConfigFile | public function phpConfigFile($path, array $config = [], $namespace = null)
{
$this->file($path)->text(Php\ConfigGenerator::generateText($config, $namespace));
} | php | public function phpConfigFile($path, array $config = [], $namespace = null)
{
$this->file($path)->text(Php\ConfigGenerator::generateText($config, $namespace));
} | [
"public",
"function",
"phpConfigFile",
"(",
"$",
"path",
",",
"array",
"$",
"config",
"=",
"[",
"]",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"file",
"(",
"$",
"path",
")",
"->",
"text",
"(",
"Php",
"\\",
"ConfigGenerator",
... | Generate PHP config file.
@param string $path
@param string $namespace | [
"Generate",
"PHP",
"config",
"file",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L246-L249 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.phpSourceFile | public function phpSourceFile($path, $source, $namespace = '')
{
if ($namespace) {
$namespace = "namespace {$namespace};".PHP_EOL.PHP_EOL;
}
$this->file($path)->text('<?php'.PHP_EOL.PHP_EOL.$namespace.$source.PHP_EOL);
} | php | public function phpSourceFile($path, $source, $namespace = '')
{
if ($namespace) {
$namespace = "namespace {$namespace};".PHP_EOL.PHP_EOL;
}
$this->file($path)->text('<?php'.PHP_EOL.PHP_EOL.$namespace.$source.PHP_EOL);
} | [
"public",
"function",
"phpSourceFile",
"(",
"$",
"path",
",",
"$",
"source",
",",
"$",
"namespace",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"namespace",
")",
"{",
"$",
"namespace",
"=",
"\"namespace {$namespace};\"",
".",
"PHP_EOL",
".",
"PHP_EOL",
";",
"}"... | Generate PHP source file.
@param string $path
@param string $source
@param string $namespace | [
"Generate",
"PHP",
"source",
"file",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L258-L265 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.templateFile | public function templateFile($path, array $arguments = [])
{
$this->file($path)->template($this->makePath($path), $arguments);
} | php | public function templateFile($path, array $arguments = [])
{
$this->file($path)->template($this->makePath($path), $arguments);
} | [
"public",
"function",
"templateFile",
"(",
"$",
"path",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"file",
"(",
"$",
"path",
")",
"->",
"template",
"(",
"$",
"this",
"->",
"makePath",
"(",
"$",
"path",
")",
",",
"... | Generate template file, same name.
@param string $path
@param array $arguments | [
"Generate",
"template",
"file",
"same",
"name",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L283-L286 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.makePath | protected function makePath($path)
{
return $this->context->directory ? $this->context->directory.'/'.$path : $path;
} | php | protected function makePath($path)
{
return $this->context->directory ? $this->context->directory.'/'.$path : $path;
} | [
"protected",
"function",
"makePath",
"(",
"$",
"path",
")",
"{",
"return",
"$",
"this",
"->",
"context",
"->",
"directory",
"?",
"$",
"this",
"->",
"context",
"->",
"directory",
".",
"'/'",
".",
"$",
"path",
":",
"$",
"path",
";",
"}"
] | Create relative path in box.
@param $path
@return string | [
"Create",
"relative",
"path",
"in",
"box",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L294-L297 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.allFiles | protected function allFiles(FilesystemInterface $filesystem, $path)
{
$files = [];
foreach ($filesystem->listContents($path, true) as $file) {
if ($file['type'] == 'file') {
$files[] = $file['path'];
}
}
return $files;
} | php | protected function allFiles(FilesystemInterface $filesystem, $path)
{
$files = [];
foreach ($filesystem->listContents($path, true) as $file) {
if ($file['type'] == 'file') {
$files[] = $file['path'];
}
}
return $files;
} | [
"protected",
"function",
"allFiles",
"(",
"FilesystemInterface",
"$",
"filesystem",
",",
"$",
"path",
")",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filesystem",
"->",
"listContents",
"(",
"$",
"path",
",",
"true",
")",
"as",
"$",
"f... | Get all files in directory
@param FilesystemInterface $filesystem
@param string $path
@return array | [
"Get",
"all",
"files",
"in",
"directory"
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L306-L317 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.generate | protected function generate($content, array $arguments)
{
foreach ($arguments as $name => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
$content = preg_replace('/\{\s*\$'.$name.'\s*\}/', $value, $content);
}
return $content;
} | php | protected function generate($content, array $arguments)
{
foreach ($arguments as $name => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
$content = preg_replace('/\{\s*\$'.$name.'\s*\}/', $value, $content);
}
return $content;
} | [
"protected",
"function",
"generate",
"(",
"$",
"content",
",",
"array",
"$",
"arguments",
")",
"{",
"foreach",
"(",
"$",
"arguments",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"va... | Generate template
@param string $content
@param array $arguments
@return mixed | [
"Generate",
"template"
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L326-L336 |
jumilla/php-source-generator | sources/FileGenerator.php | FileGenerator.read | protected function read($stub_path)
{
$content = $this->stubbox->read($stub_path);
if ($content === false) {
throw new InvalidArgumentException("File '$stub_path' is not found.");
}
return $content;
} | php | protected function read($stub_path)
{
$content = $this->stubbox->read($stub_path);
if ($content === false) {
throw new InvalidArgumentException("File '$stub_path' is not found.");
}
return $content;
} | [
"protected",
"function",
"read",
"(",
"$",
"stub_path",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"stubbox",
"->",
"read",
"(",
"$",
"stub_path",
")",
";",
"if",
"(",
"$",
"content",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentExc... | Read stub file
@param string $content
@param array $arguments
@return mixed | [
"Read",
"stub",
"file"
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/FileGenerator.php#L345-L354 |
wisp-x/hopephp | hopephp/library/hope/App.php | App.run | public static function run()
{
try {
self::init();
// 设置系统时区
date_default_timezone_set(self::$config['default_timezone']);
// 是否开启debug
self::$debug = self::$config['app_debug'];
// 初始化路由
Route::init();
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
return self::$config;
} | php | public static function run()
{
try {
self::init();
// 设置系统时区
date_default_timezone_set(self::$config['default_timezone']);
// 是否开启debug
self::$debug = self::$config['app_debug'];
// 初始化路由
Route::init();
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
return self::$config;
} | [
"public",
"static",
"function",
"run",
"(",
")",
"{",
"try",
"{",
"self",
"::",
"init",
"(",
")",
";",
"// 设置系统时区",
"date_default_timezone_set",
"(",
"self",
"::",
"$",
"config",
"[",
"'default_timezone'",
"]",
")",
";",
"// 是否开启debug",
"self",
"::",
"$",
... | 运行应用
@return array
@throws \Exception | [
"运行应用"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/App.php#L34-L53 |
wisp-x/hopephp | hopephp/library/hope/App.php | App.init | public static function init($module = '')
{
// 定位模块目录
$module = $module ? $module . DS : '';
// 加载第三方拓展包
require_once VENDOR_PATH . 'autoload' . EXT;
// 加载助手函数
include HOPE_PATH . 'helper' . EXT;
// 初始化系统配置
self::$config = Config::init();
$path = APP_PATH . $module;
// 加载公共文件
if (is_file($path . 'common' . EXT)) {
require $path . 'common' . EXT;
}
// 如果有自定义配置则加载
if (is_file($path . 'config' . EXT)) {
require $path . 'config' . EXT;
}
} | php | public static function init($module = '')
{
// 定位模块目录
$module = $module ? $module . DS : '';
// 加载第三方拓展包
require_once VENDOR_PATH . 'autoload' . EXT;
// 加载助手函数
include HOPE_PATH . 'helper' . EXT;
// 初始化系统配置
self::$config = Config::init();
$path = APP_PATH . $module;
// 加载公共文件
if (is_file($path . 'common' . EXT)) {
require $path . 'common' . EXT;
}
// 如果有自定义配置则加载
if (is_file($path . 'config' . EXT)) {
require $path . 'config' . EXT;
}
} | [
"public",
"static",
"function",
"init",
"(",
"$",
"module",
"=",
"''",
")",
"{",
"// 定位模块目录",
"$",
"module",
"=",
"$",
"module",
"?",
"$",
"module",
".",
"DS",
":",
"''",
";",
"// 加载第三方拓展包",
"require_once",
"VENDOR_PATH",
".",
"'autoload'",
".",
"EXT",
... | 初始化应用
@param string $module | [
"初始化应用"
] | train | https://github.com/wisp-x/hopephp/blob/5d4ec0fdb847772783259c16c97e9843b81df3c9/hopephp/library/hope/App.php#L59-L85 |
civicrm/civicrm-setup | src/Setup/Template.php | Template.getContent | public function getContent($infile) {
$contents = $this->smarty->fetch($infile);
if ($this->filetype === 'php') {
$this->beautifier->setInputString($contents);
$this->beautifier->process();
$contents = $this->beautifier->get();
// The beautifier isn't as beautiful as one would hope. Here's some extra string fudging.
$replacements = [
') ,' => '),',
"\n }\n}\n" => "\n }\n\n}\n",
'=> true,' => '=> TRUE,',
'=> false,' => '=> FALSE,',
];
$contents = str_replace(array_keys($replacements), array_values($replacements), $contents);
$contents = preg_replace('#(\s*)\\/\\*\\*#', "\n\$1/**", $contents);
// Convert old array syntax to new square brackets
$contents = CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents);
}
return $contents;
} | php | public function getContent($infile) {
$contents = $this->smarty->fetch($infile);
if ($this->filetype === 'php') {
$this->beautifier->setInputString($contents);
$this->beautifier->process();
$contents = $this->beautifier->get();
// The beautifier isn't as beautiful as one would hope. Here's some extra string fudging.
$replacements = [
') ,' => '),',
"\n }\n}\n" => "\n }\n\n}\n",
'=> true,' => '=> TRUE,',
'=> false,' => '=> FALSE,',
];
$contents = str_replace(array_keys($replacements), array_values($replacements), $contents);
$contents = preg_replace('#(\s*)\\/\\*\\*#', "\n\$1/**", $contents);
// Convert old array syntax to new square brackets
$contents = CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents);
}
return $contents;
} | [
"public",
"function",
"getContent",
"(",
"$",
"infile",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"smarty",
"->",
"fetch",
"(",
"$",
"infile",
")",
";",
"if",
"(",
"$",
"this",
"->",
"filetype",
"===",
"'php'",
")",
"{",
"$",
"this",
"->",... | Run template generator.
@param string $infile
Filename of the template, without a path.
@return string | [
"Run",
"template",
"generator",
"."
] | train | https://github.com/civicrm/civicrm-setup/blob/556b312faf78781c85c4fc4ae6c1c3b658da9e09/src/Setup/Template.php#L41-L62 |
CampaignChain/core | Entity/Milestone.php | Milestone.getJavascriptTimestamp | public function getJavascriptTimestamp()
{
$date = new \DateTime($this->startDate->format('Y-m-d H:i:s'));
$javascriptTimestamp = $date->getTimestamp()*1000;
return $javascriptTimestamp;
} | php | public function getJavascriptTimestamp()
{
$date = new \DateTime($this->startDate->format('Y-m-d H:i:s'));
$javascriptTimestamp = $date->getTimestamp()*1000;
return $javascriptTimestamp;
} | [
"public",
"function",
"getJavascriptTimestamp",
"(",
")",
"{",
"$",
"date",
"=",
"new",
"\\",
"DateTime",
"(",
"$",
"this",
"->",
"startDate",
"->",
"format",
"(",
"'Y-m-d H:i:s'",
")",
")",
";",
"$",
"javascriptTimestamp",
"=",
"$",
"date",
"->",
"getTime... | Get time in JavaScript timestamp format
@return \DateTime | [
"Get",
"time",
"in",
"JavaScript",
"timestamp",
"format"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Milestone.php#L69-L74 |
CampaignChain/core | Entity/Milestone.php | Milestone.setCampaign | public function setCampaign(\CampaignChain\CoreBundle\Entity\Campaign $campaign = null)
{
$this->campaign = $campaign;
return $this;
} | php | public function setCampaign(\CampaignChain\CoreBundle\Entity\Campaign $campaign = null)
{
$this->campaign = $campaign;
return $this;
} | [
"public",
"function",
"setCampaign",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"Campaign",
"$",
"campaign",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"campaign",
"=",
"$",
"campaign",
";",
"return",
"$",
"this",
";",
"}"
] | Set campaign
@param \CampaignChain\CoreBundle\Entity\Campaign $campaign
@return Milestone | [
"Set",
"campaign"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Milestone.php#L82-L87 |
CampaignChain/core | Entity/Milestone.php | Milestone.setMilestoneModule | public function setMilestoneModule(\CampaignChain\CoreBundle\Entity\MilestoneModule $milestoneModule = null)
{
$this->milestoneModule = $milestoneModule;
return $this;
} | php | public function setMilestoneModule(\CampaignChain\CoreBundle\Entity\MilestoneModule $milestoneModule = null)
{
$this->milestoneModule = $milestoneModule;
return $this;
} | [
"public",
"function",
"setMilestoneModule",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"MilestoneModule",
"$",
"milestoneModule",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"milestoneModule",
"=",
"$",
"milestoneModule",
";",
"return",
... | Set milestoneModule
@param \CampaignChain\CoreBundle\Entity\MilestoneModule $milestoneModule
@return Milestone | [
"Set",
"milestoneModule"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Milestone.php#L105-L110 |
jumilla/php-source-generator | sources/Php/ConfigGenerator.php | ConfigGenerator.generate | public function generate(array $config, $namespace = null)
{
$this->writeLine('<?php'.PHP_EOL);
if ($namespace) {
$this->writeLine("namespace $namespace;".PHP_EOL);
}
$this->indent = 0;
$this->writeLine('return [');
$this->generateArray($config);
$this->writeLine('];');
return $this->text;
} | php | public function generate(array $config, $namespace = null)
{
$this->writeLine('<?php'.PHP_EOL);
if ($namespace) {
$this->writeLine("namespace $namespace;".PHP_EOL);
}
$this->indent = 0;
$this->writeLine('return [');
$this->generateArray($config);
$this->writeLine('];');
return $this->text;
} | [
"public",
"function",
"generate",
"(",
"array",
"$",
"config",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"writeLine",
"(",
"'<?php'",
".",
"PHP_EOL",
")",
";",
"if",
"(",
"$",
"namespace",
")",
"{",
"$",
"this",
"->",
"writeLin... | Generate php source text.
@param array $config
@param string $namespace
@return string | [
"Generate",
"php",
"source",
"text",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/Php/ConfigGenerator.php#L40-L57 |
jumilla/php-source-generator | sources/Php/ConfigGenerator.php | ConfigGenerator.generateArray | private function generateArray(array $config)
{
++$this->indent;
foreach ($config as $key => $value) {
if (is_null($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, 'null'));
} else {
$this->writeLine(sprintf('%s,', 'null'));
}
} elseif (is_bool($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, $value ? 'true' : 'false'));
} else {
$this->writeLine(sprintf('%s,', $value ? 'true' : 'false'));
}
} elseif (is_string($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => '%s',", $key, $value));
} else {
$this->writeLine(sprintf("'%s',", $value));
}
} elseif (is_array($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => [", $key));
} else {
$this->writeLine('[');
}
$this->generateArray($value);
$this->writeLine('],');
} elseif ($value instanceof ClassName) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, (string) $value));
} else {
$this->writeLine(sprintf('%s,', (string) $value));
}
} else {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, $value));
} else {
$this->writeLine($value.',');
}
}
}
--$this->indent;
} | php | private function generateArray(array $config)
{
++$this->indent;
foreach ($config as $key => $value) {
if (is_null($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, 'null'));
} else {
$this->writeLine(sprintf('%s,', 'null'));
}
} elseif (is_bool($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, $value ? 'true' : 'false'));
} else {
$this->writeLine(sprintf('%s,', $value ? 'true' : 'false'));
}
} elseif (is_string($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => '%s',", $key, $value));
} else {
$this->writeLine(sprintf("'%s',", $value));
}
} elseif (is_array($value)) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => [", $key));
} else {
$this->writeLine('[');
}
$this->generateArray($value);
$this->writeLine('],');
} elseif ($value instanceof ClassName) {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, (string) $value));
} else {
$this->writeLine(sprintf('%s,', (string) $value));
}
} else {
if (is_string($key)) {
$this->writeLine(sprintf("'%s' => %s,", $key, $value));
} else {
$this->writeLine($value.',');
}
}
}
--$this->indent;
} | [
"private",
"function",
"generateArray",
"(",
"array",
"$",
"config",
")",
"{",
"++",
"$",
"this",
"->",
"indent",
";",
"foreach",
"(",
"$",
"config",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",... | Generate php array elements
@param array $config | [
"Generate",
"php",
"array",
"elements"
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/Php/ConfigGenerator.php#L64-L113 |
jumilla/php-source-generator | sources/Php/ConfigGenerator.php | ConfigGenerator.writeLine | private function writeLine($line)
{
$this->text .= str_repeat(' ', $this->indent * 4);
$this->text .= $line;
$this->text .= PHP_EOL;
} | php | private function writeLine($line)
{
$this->text .= str_repeat(' ', $this->indent * 4);
$this->text .= $line;
$this->text .= PHP_EOL;
} | [
"private",
"function",
"writeLine",
"(",
"$",
"line",
")",
"{",
"$",
"this",
"->",
"text",
".=",
"str_repeat",
"(",
"' '",
",",
"$",
"this",
"->",
"indent",
"*",
"4",
")",
";",
"$",
"this",
"->",
"text",
".=",
"$",
"line",
";",
"$",
"this",
"->",... | Write a source line.
@param string $line | [
"Write",
"a",
"source",
"line",
"."
] | train | https://github.com/jumilla/php-source-generator/blob/7982dc2dc91504d2119fc09b949c28dcc7c3b9d9/sources/Php/ConfigGenerator.php#L120-L125 |
CampaignChain/core | Entity/ActivityModule.php | ActivityModule.addChannelModule | public function addChannelModule(\CampaignChain\CoreBundle\Entity\ChannelModule $channelModule)
{
$this->channelModules[] = $channelModule;
return $this;
} | php | public function addChannelModule(\CampaignChain\CoreBundle\Entity\ChannelModule $channelModule)
{
$this->channelModules[] = $channelModule;
return $this;
} | [
"public",
"function",
"addChannelModule",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"ChannelModule",
"$",
"channelModule",
")",
"{",
"$",
"this",
"->",
"channelModules",
"[",
"]",
"=",
"$",
"channelModule",
";",
"return",
"$",
"this... | Add channels
@param \CampaignChain\CoreBundle\Entity\ChannelModule $channels
@return ActivityModule | [
"Add",
"channels"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/ActivityModule.php#L89-L94 |
CampaignChain/core | Entity/ActivityModule.php | ActivityModule.removeChannelModule | public function removeChannelModule(\CampaignChain\CoreBundle\Entity\ChannelModule $channelModule)
{
$this->channelModules->removeElement($channelModule);
} | php | public function removeChannelModule(\CampaignChain\CoreBundle\Entity\ChannelModule $channelModule)
{
$this->channelModules->removeElement($channelModule);
} | [
"public",
"function",
"removeChannelModule",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"ChannelModule",
"$",
"channelModule",
")",
"{",
"$",
"this",
"->",
"channelModules",
"->",
"removeElement",
"(",
"$",
"channelModule",
")",
";",
"... | Remove channels
@param \CampaignChain\CoreBundle\Entity\ChannelModule $channels | [
"Remove",
"channels"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/ActivityModule.php#L101-L104 |
jkphl/rdfa-lite-microdata | src/RdfaLiteMicrodata/Application/Parser/Parser.php | Parser.parse | public function parse($source)
{
$document = $this->documentFactory->createDocumentFromSource($source);
$context = clone $this->context;
$iterator = new DOMIterator($document->childNodes, $context, $this->elementProcessor);
// Iterate through all $node
foreach ($iterator->getRecursiveIterator() as $node) {
$node || true;
}
return $context->getChildren();
} | php | public function parse($source)
{
$document = $this->documentFactory->createDocumentFromSource($source);
$context = clone $this->context;
$iterator = new DOMIterator($document->childNodes, $context, $this->elementProcessor);
// Iterate through all $node
foreach ($iterator->getRecursiveIterator() as $node) {
$node || true;
}
return $context->getChildren();
} | [
"public",
"function",
"parse",
"(",
"$",
"source",
")",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"documentFactory",
"->",
"createDocumentFromSource",
"(",
"$",
"source",
")",
";",
"$",
"context",
"=",
"clone",
"$",
"this",
"->",
"context",
";",
"$",... | Parse a source
@param mixed $source Parsable source
@return ThingInterface[] Parsed source | [
"Parse",
"a",
"source"
] | train | https://github.com/jkphl/rdfa-lite-microdata/blob/12ea2dcc2bc9d3b78784530b08205c79b2dd7bd8/src/RdfaLiteMicrodata/Application/Parser/Parser.php#L94-L106 |
kgilden/php-digidoc | src/Signature.php | Signature.createFromSoap | public static function createFromSoap(SignatureInfo $info)
{
$signature = new static();
$signature->id = $info->Id;
$signature->seal();
return $signature;
} | php | public static function createFromSoap(SignatureInfo $info)
{
$signature = new static();
$signature->id = $info->Id;
$signature->seal();
return $signature;
} | [
"public",
"static",
"function",
"createFromSoap",
"(",
"SignatureInfo",
"$",
"info",
")",
"{",
"$",
"signature",
"=",
"new",
"static",
"(",
")",
";",
"$",
"signature",
"->",
"id",
"=",
"$",
"info",
"->",
"Id",
";",
"$",
"signature",
"->",
"seal",
"(",
... | Creates a new Signature object from its Soap counterpart.
@internal
@param SignatureInfo $info
@return Signature | [
"Creates",
"a",
"new",
"Signature",
"object",
"from",
"its",
"Soap",
"counterpart",
"."
] | train | https://github.com/kgilden/php-digidoc/blob/88112ba05688fc1d32c0ff948cb8e1f4d2f264d3/src/Signature.php#L74-L81 |
ionux/phactor | src/ASN1.php | ASN1.encodePEM | public function encodePEM($keypair)
{
$this->pemInitialDataCheck($keypair);
$ecpemstruct = array(
'sequence_beg' => '30',
'total_len' => '74',
'int_sec_beg' => '02',
'int_sec_len' => '01',
'int_sec_val' => '01',
'oct_sec_beg' => '04',
'oct_sec_len' => '20',
'oct_sec_val' => $keypair[0],
'a0_ele_beg' => 'a0',
'a0_ele_len' => '07',
'obj_id_beg' => '06',
'obj_id_len' => '05',
'obj_id_val' => '2b8104000a',
'a1_ele_beg' => 'a1',
'a1_ele_len' => '44',
'bit_str_beg' => '03',
'bit_str_len' => '42',
'bit_str_val' => '00' . $keypair[1],
);
$dec = trim(implode($ecpemstruct));
$this->pemDataLenCheck($dec);
return '-----BEGIN EC PRIVATE KEY-----' . "\r\n" . chunk_split(base64_encode($this->binConv($dec)), 64) . '-----END EC PRIVATE KEY-----';
} | php | public function encodePEM($keypair)
{
$this->pemInitialDataCheck($keypair);
$ecpemstruct = array(
'sequence_beg' => '30',
'total_len' => '74',
'int_sec_beg' => '02',
'int_sec_len' => '01',
'int_sec_val' => '01',
'oct_sec_beg' => '04',
'oct_sec_len' => '20',
'oct_sec_val' => $keypair[0],
'a0_ele_beg' => 'a0',
'a0_ele_len' => '07',
'obj_id_beg' => '06',
'obj_id_len' => '05',
'obj_id_val' => '2b8104000a',
'a1_ele_beg' => 'a1',
'a1_ele_len' => '44',
'bit_str_beg' => '03',
'bit_str_len' => '42',
'bit_str_val' => '00' . $keypair[1],
);
$dec = trim(implode($ecpemstruct));
$this->pemDataLenCheck($dec);
return '-----BEGIN EC PRIVATE KEY-----' . "\r\n" . chunk_split(base64_encode($this->binConv($dec)), 64) . '-----END EC PRIVATE KEY-----';
} | [
"public",
"function",
"encodePEM",
"(",
"$",
"keypair",
")",
"{",
"$",
"this",
"->",
"pemInitialDataCheck",
"(",
"$",
"keypair",
")",
";",
"$",
"ecpemstruct",
"=",
"array",
"(",
"'sequence_beg'",
"=>",
"'30'",
",",
"'total_len'",
"=>",
"'74'",
",",
"'int_s... | Encodes keypair data to PEM format.
@param array $keypair The keypair info.
@return string The data to decode. | [
"Encodes",
"keypair",
"data",
"to",
"PEM",
"format",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/ASN1.php#L43-L73 |
ionux/phactor | src/ASN1.php | ASN1.decodePEM | public function decodePEM($pem_data)
{
$pem_data = $this->pemDataClean($pem_data);
$decoded = bin2hex(base64_decode($pem_data));
$this->pemDataLenCheck($decoded);
$ecpemstruct = array(
'oct_sec_val' => substr($decoded, 14, 64),
'obj_id_val' => substr($decoded, 86, 10),
'bit_str_val' => substr($decoded, 106),
);
$this->pemOidCheck($ecpemstruct['obj_id_val']);
$private_key = $ecpemstruct['oct_sec_val'];
$public_key = '04' . $ecpemstruct['bit_str_val'];
$this->pemKeyLenCheck(array($private_key, $public_key));
return array(
'private_key' => $private_key,
'public_key' => $public_key
);
} | php | public function decodePEM($pem_data)
{
$pem_data = $this->pemDataClean($pem_data);
$decoded = bin2hex(base64_decode($pem_data));
$this->pemDataLenCheck($decoded);
$ecpemstruct = array(
'oct_sec_val' => substr($decoded, 14, 64),
'obj_id_val' => substr($decoded, 86, 10),
'bit_str_val' => substr($decoded, 106),
);
$this->pemOidCheck($ecpemstruct['obj_id_val']);
$private_key = $ecpemstruct['oct_sec_val'];
$public_key = '04' . $ecpemstruct['bit_str_val'];
$this->pemKeyLenCheck(array($private_key, $public_key));
return array(
'private_key' => $private_key,
'public_key' => $public_key
);
} | [
"public",
"function",
"decodePEM",
"(",
"$",
"pem_data",
")",
"{",
"$",
"pem_data",
"=",
"$",
"this",
"->",
"pemDataClean",
"(",
"$",
"pem_data",
")",
";",
"$",
"decoded",
"=",
"bin2hex",
"(",
"base64_decode",
"(",
"$",
"pem_data",
")",
")",
";",
"$",
... | Decodes PEM data to retrieve the keypair.
@param string $pem_data The data to decode.
@return array The keypair info. | [
"Decodes",
"PEM",
"data",
"to",
"retrieve",
"the",
"keypair",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/ASN1.php#L81-L105 |
ionux/phactor | src/ASN1.php | ASN1.pemInitialDataCheck | private function pemInitialDataCheck($keypair)
{
if (true === empty($keypair) || false === is_array($keypair) || strlen($keypair[0]) < 62 || strlen($keypair[1]) < 126) {
throw new \Exception('Invalid or corrupt secp256k1 keypair provided. Cannot encode the keys to PEM format. Value checked was "' . var_export($keypair, true) . '".');
}
} | php | private function pemInitialDataCheck($keypair)
{
if (true === empty($keypair) || false === is_array($keypair) || strlen($keypair[0]) < 62 || strlen($keypair[1]) < 126) {
throw new \Exception('Invalid or corrupt secp256k1 keypair provided. Cannot encode the keys to PEM format. Value checked was "' . var_export($keypair, true) . '".');
}
} | [
"private",
"function",
"pemInitialDataCheck",
"(",
"$",
"keypair",
")",
"{",
"if",
"(",
"true",
"===",
"empty",
"(",
"$",
"keypair",
")",
"||",
"false",
"===",
"is_array",
"(",
"$",
"keypair",
")",
"||",
"strlen",
"(",
"$",
"keypair",
"[",
"0",
"]",
... | Ensures the data we want to PEM encode is acceptable.
@param array $keypair The values to check.
@throws \Exception | [
"Ensures",
"the",
"data",
"we",
"want",
"to",
"PEM",
"encode",
"is",
"acceptable",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/ASN1.php#L113-L118 |
ionux/phactor | src/ASN1.php | ASN1.pemKeyLenCheck | private function pemKeyLenCheck($values)
{
if (!is_array($values) || strlen($values[0]) < 62 || strlen($values[1]) < 126) {
throw new \Exception('Invalid or corrupt secp256k1 key provided. Cannot decode the supplied PEM data. Key lengths too short. Values checked were "' . var_export($values[0], true) . '" and "' . var_export($values[1], true) . '".');
}
} | php | private function pemKeyLenCheck($values)
{
if (!is_array($values) || strlen($values[0]) < 62 || strlen($values[1]) < 126) {
throw new \Exception('Invalid or corrupt secp256k1 key provided. Cannot decode the supplied PEM data. Key lengths too short. Values checked were "' . var_export($values[0], true) . '" and "' . var_export($values[1], true) . '".');
}
} | [
"private",
"function",
"pemKeyLenCheck",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
"||",
"strlen",
"(",
"$",
"values",
"[",
"0",
"]",
")",
"<",
"62",
"||",
"strlen",
"(",
"$",
"values",
"[",
"1",
"]",
")",... | Ensures the decoded PEM key lengths are acceptable.
@param array $values The key values to check.
@throws \Exception | [
"Ensures",
"the",
"decoded",
"PEM",
"key",
"lengths",
"are",
"acceptable",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/ASN1.php#L139-L144 |
ionux/phactor | src/ASN1.php | ASN1.pemDataClean | private function pemDataClean($value)
{
$value = str_ireplace('-----BEGIN EC PRIVATE KEY-----', '', $value);
$value = str_ireplace('-----END EC PRIVATE KEY-----', '', $value);
$value = str_ireplace("\r", '', trim($value));
$value = str_ireplace("\n", '', trim($value));
$value = str_ireplace(' ', '', trim($value));
return $value;
} | php | private function pemDataClean($value)
{
$value = str_ireplace('-----BEGIN EC PRIVATE KEY-----', '', $value);
$value = str_ireplace('-----END EC PRIVATE KEY-----', '', $value);
$value = str_ireplace("\r", '', trim($value));
$value = str_ireplace("\n", '', trim($value));
$value = str_ireplace(' ', '', trim($value));
return $value;
} | [
"private",
"function",
"pemDataClean",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"str_ireplace",
"(",
"'-----BEGIN EC PRIVATE KEY-----'",
",",
"''",
",",
"$",
"value",
")",
";",
"$",
"value",
"=",
"str_ireplace",
"(",
"'-----END EC PRIVATE KEY-----'",
",",... | Cleans the PEM data of unwanted data.
@param string $value The value to clean.
@return string $value The cleaned value. | [
"Cleans",
"the",
"PEM",
"data",
"of",
"unwanted",
"data",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/ASN1.php#L165-L174 |
ionux/phactor | src/ASN1.php | ASN1.decodeOID | public function decodeOID($data)
{
$bin_data = array();
$index = 0;
$binary_string = '';
$oid = array();
// first two numbers are: (40*x)+y
// all next chars are 7-bit numbers
foreach ($data as $key => $value) {
$bin_data[$index] = bitConv($value);
$binary_string .= $bin_data[$index];
$index++;
}
$oid[0] = (int)($data[0] / 0x28);
$oid[1] = $data[0] % 0x28;
$elements = count($bin_data);
$temp_number = '00000000';
for ($x = 1; $x < $elements; $x++) {
$and_temp = $bin_data[$x] & '01111111';
$temp_number = bitAdd($temp_number, $and_temp);
if (substr($bin_data[$x], 0, 1) == '0') {
// This is a final value without
// a value preceeding it.
$oid[$x + 1] = decConv($temp_number);
$temp_number = '';
} else {
$temp_number = shiftLeft($temp_number, 7);
}
}
$oid_string = '';
foreach ($oid as $key => $value) {
$oid_string .= $value . ".";
}
$oid_string = substr($oid_string, 0, -1);
return $oid_string;
} | php | public function decodeOID($data)
{
$bin_data = array();
$index = 0;
$binary_string = '';
$oid = array();
// first two numbers are: (40*x)+y
// all next chars are 7-bit numbers
foreach ($data as $key => $value) {
$bin_data[$index] = bitConv($value);
$binary_string .= $bin_data[$index];
$index++;
}
$oid[0] = (int)($data[0] / 0x28);
$oid[1] = $data[0] % 0x28;
$elements = count($bin_data);
$temp_number = '00000000';
for ($x = 1; $x < $elements; $x++) {
$and_temp = $bin_data[$x] & '01111111';
$temp_number = bitAdd($temp_number, $and_temp);
if (substr($bin_data[$x], 0, 1) == '0') {
// This is a final value without
// a value preceeding it.
$oid[$x + 1] = decConv($temp_number);
$temp_number = '';
} else {
$temp_number = shiftLeft($temp_number, 7);
}
}
$oid_string = '';
foreach ($oid as $key => $value) {
$oid_string .= $value . ".";
}
$oid_string = substr($oid_string, 0, -1);
return $oid_string;
} | [
"public",
"function",
"decodeOID",
"(",
"$",
"data",
")",
"{",
"$",
"bin_data",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
"binary_string",
"=",
"''",
";",
"$",
"oid",
"=",
"array",
"(",
")",
";",
"// first two numbers are: (40*x)+y... | Decodes an OID hex value obtained from
a PEM file or other encoded key file.
@param string $data The hex OID string to decode.
@return string The decoded OID string. | [
"Decodes",
"an",
"OID",
"hex",
"value",
"obtained",
"from",
"a",
"PEM",
"file",
"or",
"other",
"encoded",
"key",
"file",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/ASN1.php#L183-L228 |
prooph/link-process-manager | src/Model/Task.php | Task.updateMetadata | public function updateMetadata(ProcessingMetadata $metadata)
{
$this->recordThat(TaskMetadataWasUpdated::record($this->id(), $metadata));
} | php | public function updateMetadata(ProcessingMetadata $metadata)
{
$this->recordThat(TaskMetadataWasUpdated::record($this->id(), $metadata));
} | [
"public",
"function",
"updateMetadata",
"(",
"ProcessingMetadata",
"$",
"metadata",
")",
"{",
"$",
"this",
"->",
"recordThat",
"(",
"TaskMetadataWasUpdated",
"::",
"record",
"(",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"metadata",
")",
")",
";",
"}"
] | Simply override existing metadata with the new one
@param ProcessingMetadata $metadata | [
"Simply",
"override",
"existing",
"metadata",
"with",
"the",
"new",
"one"
] | train | https://github.com/prooph/link-process-manager/blob/3d6c8bdc72e855786227747bf06bcf8221f7860a/src/Model/Task.php#L81-L84 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Primitive/Triangle.php | Triangle.point | public function point($int_x, $int_y)
{
if (count($this->arr_points) >= 3) {
throw new \RuntimeException('Triangle has only three points!');
}
return parent::point($int_x, $int_y);
} | php | public function point($int_x, $int_y)
{
if (count($this->arr_points) >= 3) {
throw new \RuntimeException('Triangle has only three points!');
}
return parent::point($int_x, $int_y);
} | [
"public",
"function",
"point",
"(",
"$",
"int_x",
",",
"$",
"int_y",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"arr_points",
")",
">=",
"3",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Triangle has only three points!'",
")",
";... | Set one point by giving its coordinates.
@param integer $int_x
@param integer $int_y
@throws \RuntimeException If you try to set 4th point.
@access public
@return void | [
"Set",
"one",
"point",
"by",
"giving",
"its",
"coordinates",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Primitive/Triangle.php#L44-L51 |
scaytrase/symfony-sms-interface | src/ScayTrase/SmsDeliveryBundle/Transport/OverrideRecipientTransport.php | OverrideRecipientTransport.send | public function send(ShortMessageInterface $message)
{
$message->setRecipient($this->recipient);
return $this->transport->send($message);
} | php | public function send(ShortMessageInterface $message)
{
$message->setRecipient($this->recipient);
return $this->transport->send($message);
} | [
"public",
"function",
"send",
"(",
"ShortMessageInterface",
"$",
"message",
")",
"{",
"$",
"message",
"->",
"setRecipient",
"(",
"$",
"this",
"->",
"recipient",
")",
";",
"return",
"$",
"this",
"->",
"transport",
"->",
"send",
"(",
"$",
"message",
")",
"... | @param ShortMessageInterface $message
@return boolean
@throws DeliveryFailedException | [
"@param",
"ShortMessageInterface",
"$message",
"@return",
"boolean"
] | train | https://github.com/scaytrase/symfony-sms-interface/blob/5645a47652e6511b51f8fcdfba747a167dad0e2c/src/ScayTrase/SmsDeliveryBundle/Transport/OverrideRecipientTransport.php#L39-L43 |
Nono1971/Doctrine-MetadataGrapher | lib/Onurb/Doctrine/ORMMetadataGrapher/YumlMetadataGrapher/ClassStore.php | ClassStore.getClassByName | public function getClassByName($className)
{
$classMap = $this->getClassMap($this->splitClassName($className)) . "[\"__class\"]";
$return = null;
eval(
"if (isset(\$this->indexedClasses$classMap)) {"
. " \$return = \$this->indexedClasses$classMap;"
. "}"
);
return $return;
} | php | public function getClassByName($className)
{
$classMap = $this->getClassMap($this->splitClassName($className)) . "[\"__class\"]";
$return = null;
eval(
"if (isset(\$this->indexedClasses$classMap)) {"
. " \$return = \$this->indexedClasses$classMap;"
. "}"
);
return $return;
} | [
"public",
"function",
"getClassByName",
"(",
"$",
"className",
")",
"{",
"$",
"classMap",
"=",
"$",
"this",
"->",
"getClassMap",
"(",
"$",
"this",
"->",
"splitClassName",
"(",
"$",
"className",
")",
")",
".",
"\"[\\\"__class\\\"]\"",
";",
"$",
"return",
"=... | Retrieve a class metadata instance by name from the given array
@param string $className
@return ClassMetadata|null | [
"Retrieve",
"a",
"class",
"metadata",
"instance",
"by",
"name",
"from",
"the",
"given",
"array"
] | train | https://github.com/Nono1971/Doctrine-MetadataGrapher/blob/414b95f81d36b6530b083b296c5eeb700679ab3b/lib/Onurb/Doctrine/ORMMetadataGrapher/YumlMetadataGrapher/ClassStore.php#L61-L73 |
Nono1971/Doctrine-MetadataGrapher | lib/Onurb/Doctrine/ORMMetadataGrapher/YumlMetadataGrapher/ClassStore.php | ClassStore.getParent | public function getParent(ClassMetadata $class)
{
$className = $class->getName();
if (!class_exists($className) || (!$parent = get_parent_class($className))) {
return null;
}
return $this->getClassByName($parent);
} | php | public function getParent(ClassMetadata $class)
{
$className = $class->getName();
if (!class_exists($className) || (!$parent = get_parent_class($className))) {
return null;
}
return $this->getClassByName($parent);
} | [
"public",
"function",
"getParent",
"(",
"ClassMetadata",
"$",
"class",
")",
"{",
"$",
"className",
"=",
"$",
"class",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
"||",
"(",
"!",
"$",
"parent",
"=",
"get... | Retrieve a class metadata's parent class metadata
@param ClassMetadata $class
@return ClassMetadata|null | [
"Retrieve",
"a",
"class",
"metadata",
"s",
"parent",
"class",
"metadata"
] | train | https://github.com/Nono1971/Doctrine-MetadataGrapher/blob/414b95f81d36b6530b083b296c5eeb700679ab3b/lib/Onurb/Doctrine/ORMMetadataGrapher/YumlMetadataGrapher/ClassStore.php#L82-L90 |
sulu/SuluAutomationBundle | EventSubscriber/PHPTaskEventSubscriber.php | PHPTaskEventSubscriber.pushRequest | public function pushRequest(TaskEvent $event)
{
$task = $this->taskRepository->findByTaskId($event->getTask()->getUuid());
if (!$task) {
// current task is not managed by this bundle
return;
}
$request = new Request(
[],
[],
['_task_id' => $event->getTask()->getUuid()],
[],
[],
['SERVER_NAME' => $task->getHost(), 'HTTPS' => $task->getScheme() === 'http' ? 'off' : 'on']
);
$this->requestStack->push($request);
} | php | public function pushRequest(TaskEvent $event)
{
$task = $this->taskRepository->findByTaskId($event->getTask()->getUuid());
if (!$task) {
// current task is not managed by this bundle
return;
}
$request = new Request(
[],
[],
['_task_id' => $event->getTask()->getUuid()],
[],
[],
['SERVER_NAME' => $task->getHost(), 'HTTPS' => $task->getScheme() === 'http' ? 'off' : 'on']
);
$this->requestStack->push($request);
} | [
"public",
"function",
"pushRequest",
"(",
"TaskEvent",
"$",
"event",
")",
"{",
"$",
"task",
"=",
"$",
"this",
"->",
"taskRepository",
"->",
"findByTaskId",
"(",
"$",
"event",
"->",
"getTask",
"(",
")",
"->",
"getUuid",
"(",
")",
")",
";",
"if",
"(",
... | Create and push new request to requests-stack.
@param TaskEvent $event | [
"Create",
"and",
"push",
"new",
"request",
"to",
"requests",
"-",
"stack",
"."
] | train | https://github.com/sulu/SuluAutomationBundle/blob/2cfc3a7122a96939d2f203f6fe54bcb74e2cfd46/EventSubscriber/PHPTaskEventSubscriber.php#L53-L72 |
sulu/SuluAutomationBundle | EventSubscriber/PHPTaskEventSubscriber.php | PHPTaskEventSubscriber.popRequest | public function popRequest(TaskEvent $event)
{
$request = $this->requestStack->getCurrentRequest();
if (!$request || $request->attributes->get('_task_id') !== $event->getTask()->getUuid()) {
// current request was not created for current task
return;
}
$this->requestStack->pop();
} | php | public function popRequest(TaskEvent $event)
{
$request = $this->requestStack->getCurrentRequest();
if (!$request || $request->attributes->get('_task_id') !== $event->getTask()->getUuid()) {
// current request was not created for current task
return;
}
$this->requestStack->pop();
} | [
"public",
"function",
"popRequest",
"(",
"TaskEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"if",
"(",
"!",
"$",
"request",
"||",
"$",
"request",
"->",
"attributes",
"->"... | Pop request from request stack.
@param TaskEvent $event | [
"Pop",
"request",
"from",
"request",
"stack",
"."
] | train | https://github.com/sulu/SuluAutomationBundle/blob/2cfc3a7122a96939d2f203f6fe54bcb74e2cfd46/EventSubscriber/PHPTaskEventSubscriber.php#L79-L89 |
kgilden/php-digidoc | src/X509/Asn1.php | Asn1.getValueForOid | public function getValueForOid($oid)
{
if (isset($this->baseAsn1->oids[$oid])) {
return $this->baseAsn1->oids[$oid];
}
throw new \RuntimeException(sprintf('Unknown oid "%s"', $oid));
} | php | public function getValueForOid($oid)
{
if (isset($this->baseAsn1->oids[$oid])) {
return $this->baseAsn1->oids[$oid];
}
throw new \RuntimeException(sprintf('Unknown oid "%s"', $oid));
} | [
"public",
"function",
"getValueForOid",
"(",
"$",
"oid",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"baseAsn1",
"->",
"oids",
"[",
"$",
"oid",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"baseAsn1",
"->",
"oids",
"[",
"$",
"oid",
... | @param string $oid
@return string
@throws \RuntimeException If the oid is unknown | [
"@param",
"string",
"$oid"
] | train | https://github.com/kgilden/php-digidoc/blob/88112ba05688fc1d32c0ff948cb8e1f4d2f264d3/src/X509/Asn1.php#L91-L98 |
joomla-framework/twitter-api | src/OAuth.php | OAuth.validateResponse | public function validateResponse($url, $response)
{
if (strpos($url, 'verify_credentials') === false && $response->code != 200)
{
$error = json_decode($response->body);
if (property_exists($error, 'error'))
{
throw new \DomainException($error->error);
}
$error = $error->errors;
throw new \DomainException($error[0]->message, $error[0]->code);
}
} | php | public function validateResponse($url, $response)
{
if (strpos($url, 'verify_credentials') === false && $response->code != 200)
{
$error = json_decode($response->body);
if (property_exists($error, 'error'))
{
throw new \DomainException($error->error);
}
$error = $error->errors;
throw new \DomainException($error[0]->message, $error[0]->code);
}
} | [
"public",
"function",
"validateResponse",
"(",
"$",
"url",
",",
"$",
"response",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"'verify_credentials'",
")",
"===",
"false",
"&&",
"$",
"response",
"->",
"code",
"!=",
"200",
")",
"{",
"$",
"error",... | Method to validate a response.
@param string $url The request URL.
@param \Joomla\Http\Response $response The response to validate.
@return void
@since 1.0
@throws \DomainException | [
"Method",
"to",
"validate",
"a",
"response",
"."
] | train | https://github.com/joomla-framework/twitter-api/blob/289719bbd67e83c7cfaf515b94b1d5497b1f0525/src/OAuth.php#L131-L146 |
scaytrase/symfony-sms-interface | src/ScayTrase/SmsDeliveryBundle/SmsDeliveryBundle.php | SmsDeliveryBundle.build | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new TransportCompilerPass());
$container->addCompilerPass(new SpoolCompilerPass());
} | php | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new TransportCompilerPass());
$container->addCompilerPass(new SpoolCompilerPass());
} | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"parent",
"::",
"build",
"(",
"$",
"container",
")",
";",
"$",
"container",
"->",
"addCompilerPass",
"(",
"new",
"TransportCompilerPass",
"(",
")",
")",
";",
"$",
"container"... | Builds the bundle.
It is only ever called once when the cache is empty.
This method can be overridden to register compilation passes,
other extensions, ...
@param ContainerBuilder $container A ContainerBuilder instance | [
"Builds",
"the",
"bundle",
"."
] | train | https://github.com/scaytrase/symfony-sms-interface/blob/5645a47652e6511b51f8fcdfba747a167dad0e2c/src/ScayTrase/SmsDeliveryBundle/SmsDeliveryBundle.php#L22-L27 |
CampaignChain/core | Entity/Job.php | Job.setStatus | public function setStatus($status)
{
if (!in_array($status, array(
self::STATUS_OPEN,
self::STATUS_RUNNING,
self::STATUS_CLOSED,
self::STATUS_ERROR,
))) {
throw new \InvalidArgumentException("Invalid status in ".get_class($this).".");
}
$this->status = $status;
return $this;
} | php | public function setStatus($status)
{
if (!in_array($status, array(
self::STATUS_OPEN,
self::STATUS_RUNNING,
self::STATUS_CLOSED,
self::STATUS_ERROR,
))) {
throw new \InvalidArgumentException("Invalid status in ".get_class($this).".");
}
$this->status = $status;
return $this;
} | [
"public",
"function",
"setStatus",
"(",
"$",
"status",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"status",
",",
"array",
"(",
"self",
"::",
"STATUS_OPEN",
",",
"self",
"::",
"STATUS_RUNNING",
",",
"self",
"::",
"STATUS_CLOSED",
",",
"self",
"::",
... | Set status
@param string $status
@return Job | [
"Set",
"status"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Job.php#L232-L246 |
CampaignChain/core | Entity/Job.php | Job.setScheduler | public function setScheduler(\CampaignChain\CoreBundle\Entity\Scheduler $scheduler = null)
{
$this->scheduler = $scheduler;
return $this;
} | php | public function setScheduler(\CampaignChain\CoreBundle\Entity\Scheduler $scheduler = null)
{
$this->scheduler = $scheduler;
return $this;
} | [
"public",
"function",
"setScheduler",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"Scheduler",
"$",
"scheduler",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"scheduler",
"=",
"$",
"scheduler",
";",
"return",
"$",
"this",
";",
"}"
] | Set scheduler
@param \CampaignChain\CoreBundle\Entity\Scheduler $scheduler
@return Job | [
"Set",
"scheduler"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Job.php#L264-L269 |
kgilden/php-digidoc | src/Encoder.php | Encoder.decode | public function decode($data)
{
$decoded = '';
$delimiters = "\n";
$token = strtok($data, $delimiters);
while (false !== $token) {
$decoded .= base64_decode($token);
$token = strtok($delimiters);
}
return $decoded;
} | php | public function decode($data)
{
$decoded = '';
$delimiters = "\n";
$token = strtok($data, $delimiters);
while (false !== $token) {
$decoded .= base64_decode($token);
$token = strtok($delimiters);
}
return $decoded;
} | [
"public",
"function",
"decode",
"(",
"$",
"data",
")",
"{",
"$",
"decoded",
"=",
"''",
";",
"$",
"delimiters",
"=",
"\"\\n\"",
";",
"$",
"token",
"=",
"strtok",
"(",
"$",
"data",
",",
"$",
"delimiters",
")",
";",
"while",
"(",
"false",
"!==",
"$",
... | Decodes a piece of data from base64. The encoded data may be either
a long string in base64 or delimited by newline characters.
@param string $data The encoded data
@return string | [
"Decodes",
"a",
"piece",
"of",
"data",
"from",
"base64",
".",
"The",
"encoded",
"data",
"may",
"be",
"either",
"a",
"long",
"string",
"in",
"base64",
"or",
"delimited",
"by",
"newline",
"characters",
"."
] | train | https://github.com/kgilden/php-digidoc/blob/88112ba05688fc1d32c0ff948cb8e1f4d2f264d3/src/Encoder.php#L51-L64 |
kgilden/php-digidoc | src/Encoder.php | Encoder.getFileContent | private function getFileContent($pathToFile)
{
$level = error_reporting(0);
$content = file_get_contents($pathToFile);
error_reporting($level);
if (false === $content) {
$error = error_get_last();
throw new RuntimeException($error['message']);
}
return $content;
} | php | private function getFileContent($pathToFile)
{
$level = error_reporting(0);
$content = file_get_contents($pathToFile);
error_reporting($level);
if (false === $content) {
$error = error_get_last();
throw new RuntimeException($error['message']);
}
return $content;
} | [
"private",
"function",
"getFileContent",
"(",
"$",
"pathToFile",
")",
"{",
"$",
"level",
"=",
"error_reporting",
"(",
"0",
")",
";",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"pathToFile",
")",
";",
"error_reporting",
"(",
"$",
"level",
")",
";",... | Gets the file content.
@todo Refactor this out to some other class
@param string $pathToFile
@return string | [
"Gets",
"the",
"file",
"content",
"."
] | train | https://github.com/kgilden/php-digidoc/blob/88112ba05688fc1d32c0ff948cb8e1f4d2f264d3/src/Encoder.php#L75-L87 |
CampaignChain/core | Entity/SchedulerReportOperation.php | SchedulerReportOperation.setOperation | public function setOperation(\CampaignChain\CoreBundle\Entity\Operation $operation = null)
{
$this->operation = $operation;
$this->setStartDate($this->operation->getStartDate());
return $this;
} | php | public function setOperation(\CampaignChain\CoreBundle\Entity\Operation $operation = null)
{
$this->operation = $operation;
$this->setStartDate($this->operation->getStartDate());
return $this;
} | [
"public",
"function",
"setOperation",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"Operation",
"$",
"operation",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"operation",
"=",
"$",
"operation",
";",
"$",
"this",
"->",
"setStartDate",
... | Set operation
@param \CampaignChain\CoreBundle\Entity\Operation $operation
@return Operation | [
"Set",
"operation"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/SchedulerReportOperation.php#L39-L46 |
sulu/SuluAutomationBundle | Admin/AutomationContentNavigationProvider.php | AutomationContentNavigationProvider.getNavigationItems | public function getNavigationItems(array $options = [])
{
if (!$this->securityChecker->hasPermission(AutomationAdmin::TASK_SECURITY_CONTEXT, PermissionTypes::VIEW)) {
return [];
}
$automation = new ContentNavigationItem('sulu_automation.automation');
$automation->setId('tab-automation');
$automation->setPosition($this->position);
$automation->setAction('automation');
$automation->setComponent('automation-tab@suluautomation');
$automation->setDisplay(['edit']);
$automation->setDisplayConditions(
array_map(function($displayCondition) {
return new DisplayCondition(
$displayCondition['property'],
$displayCondition['operator'],
$displayCondition['value']
);
}, $this->displayConditions)
);
$componentOptions = ['entityClass' => $this->entityClass];
if (array_key_exists('id', $options)) {
$locale = array_key_exists('locale', $options) ? $options['locale'] : null;
$componentOptions['notificationBadge'] = $this->taskRepository->countFutureTasks(
$this->entityClass,
$options['id'],
$locale
);
$automation->setNotificationBadge($componentOptions['notificationBadge']);
}
$automation->setComponentOptions($componentOptions);
return [$automation];
} | php | public function getNavigationItems(array $options = [])
{
if (!$this->securityChecker->hasPermission(AutomationAdmin::TASK_SECURITY_CONTEXT, PermissionTypes::VIEW)) {
return [];
}
$automation = new ContentNavigationItem('sulu_automation.automation');
$automation->setId('tab-automation');
$automation->setPosition($this->position);
$automation->setAction('automation');
$automation->setComponent('automation-tab@suluautomation');
$automation->setDisplay(['edit']);
$automation->setDisplayConditions(
array_map(function($displayCondition) {
return new DisplayCondition(
$displayCondition['property'],
$displayCondition['operator'],
$displayCondition['value']
);
}, $this->displayConditions)
);
$componentOptions = ['entityClass' => $this->entityClass];
if (array_key_exists('id', $options)) {
$locale = array_key_exists('locale', $options) ? $options['locale'] : null;
$componentOptions['notificationBadge'] = $this->taskRepository->countFutureTasks(
$this->entityClass,
$options['id'],
$locale
);
$automation->setNotificationBadge($componentOptions['notificationBadge']);
}
$automation->setComponentOptions($componentOptions);
return [$automation];
} | [
"public",
"function",
"getNavigationItems",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"securityChecker",
"->",
"hasPermission",
"(",
"AutomationAdmin",
"::",
"TASK_SECURITY_CONTEXT",
",",
"PermissionTypes",
"::",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sulu/SuluAutomationBundle/blob/2cfc3a7122a96939d2f203f6fe54bcb74e2cfd46/Admin/AutomationContentNavigationProvider.php#L75-L110 |
scaytrase/symfony-sms-interface | src/ScayTrase/SmsDeliveryBundle/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sms_delivery');
$disable_delivery = (new BooleanNodeDefinition('disable_delivery'));
$delivery_recipient = (new ScalarNodeDefinition('delivery_recipient'));
$transport = (new ScalarNodeDefinition('transport'));
$spool = (new ScalarNodeDefinition('spool'));
$rootNode
->children()
->append($spool->defaultValue('sms_delivery.spool.instant')->info('Sender message spool'))
->append($transport->defaultValue('sms_delivery.transport.dummy')->info('Sender transport service'))
->append($disable_delivery->defaultFalse()->info('Disables actual delivery for testing purposes'))
->append($delivery_recipient->defaultNull()->info('Recipient for messages for testing purposes'))
->end();
return $treeBuilder;
} | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sms_delivery');
$disable_delivery = (new BooleanNodeDefinition('disable_delivery'));
$delivery_recipient = (new ScalarNodeDefinition('delivery_recipient'));
$transport = (new ScalarNodeDefinition('transport'));
$spool = (new ScalarNodeDefinition('spool'));
$rootNode
->children()
->append($spool->defaultValue('sms_delivery.spool.instant')->info('Sender message spool'))
->append($transport->defaultValue('sms_delivery.transport.dummy')->info('Sender transport service'))
->append($disable_delivery->defaultFalse()->info('Disables actual delivery for testing purposes'))
->append($delivery_recipient->defaultNull()->info('Recipient for messages for testing purposes'))
->end();
return $treeBuilder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'sms_delivery'",
")",
";",
"$",
"disable_delivery",
"=",
"(",
"new",
"B... | {@inheritDoc} | [
"{"
] | train | https://github.com/scaytrase/symfony-sms-interface/blob/5645a47652e6511b51f8fcdfba747a167dad0e2c/src/ScayTrase/SmsDeliveryBundle/DependencyInjection/Configuration.php#L20-L39 |
vakata/image | src/driver/GD.php | GD.resize | public function resize(int $width = 0, int $height = 0)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
$iw = $this->info[0];
$ih = $this->info[1];
if (!$height || !$width) {
if (!$width) {
$width = $height / $ih * $iw;
}
if (!$height) {
$height = $width / $iw * $ih;
}
}
$di = imagecreatetruecolor($width, $height);
imagecopyresized($di, $this->data, 0, 0, 0, 0, $width, $height, $iw, $ih);
$this->data = $di;
} | php | public function resize(int $width = 0, int $height = 0)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
$iw = $this->info[0];
$ih = $this->info[1];
if (!$height || !$width) {
if (!$width) {
$width = $height / $ih * $iw;
}
if (!$height) {
$height = $width / $iw * $ih;
}
}
$di = imagecreatetruecolor($width, $height);
imagecopyresized($di, $this->data, 0, 0, 0, 0, $width, $height, $iw, $ih);
$this->data = $di;
} | [
"public",
"function",
"resize",
"(",
"int",
"$",
"width",
"=",
"0",
",",
"int",
"$",
"height",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"width",
"&&",
"!",
"$",
"height",
")",
"{",
"throw",
"new",
"ImageException",
"(",
"'You must supply at least one d... | Resize the image, if one dimension is skipped it will be automatically calculated.
@param int|integer $width the width of the resized image
@param int|integer $height the height of the resized image | [
"Resize",
"the",
"image",
"if",
"one",
"dimension",
"is",
"skipped",
"it",
"will",
"be",
"automatically",
"calculated",
"."
] | train | https://github.com/vakata/image/blob/1d074cc6e274b1b8fe97cf138efcd2c665699686/src/driver/GD.php#L25-L43 |
vakata/image | src/driver/GD.php | GD.crop | public function crop(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
$iw = $this->info[0];
$ih = $this->info[1];
if (!$height || !$width) {
if (!$width) {
$width = $height / $ih * $iw;
}
if (!$height) {
$height = $width / $iw * $ih;
}
}
$hasKeep = isset($keep['x']) && isset($keep['y']) && isset($keep['w']) && isset($keep['h']);
if ($hasKeep && (!(int)$keep['w'] || !(int)$keep['h'])) {
throw new ImageException('Invalid keep params');
}
if ($hasKeep) {
if ($keepEnlarge === false && $keep['w'] < $width && $keep['h'] < $height) {
$dw = ($width - $keep['w']) / 2;
$dh = ($height - $keep['h']) / 2;
$dw = min($keep['x'], $dw);
$nkx = $keep['x'] - $dw;
$ekx = $nkx + $keep['w'] + $dw * 2;
$nky = $keep['y'] - $dh;
$eky = $nky + $keep['h'] + $dh * 2;
if ($nkx < 0) {
$ekx += $nkx * -1;
$ekx = min($iw, $ekx);
$nkx = 0;
}
if ($ekx > $iw) {
$nkx = $nkx - ($ekx - $iw);
$nkx = max(0, $nkx);
$ekx = $iw;
}
if ($nky < 0) {
$eky += $nky * -1;
$eky = min($ih, $eky);
$nky = 0;
}
if ($eky > $ih) {
$nky = $nky - ($eky - $ih);
$nky = max(0, $nky);
$eky = $ih;
}
$keep = ['x'=>$nkx, 'y'=>$nky, 'w'=>$ekx - $nkx, 'h'=>$eky - $nky];
}
// get the higher coeficient
$coef = max($keep['w'] / $width, $keep['h'] / $height);
// calculate new width / height so that the keep zone will fit in the crop
$nw = $width * $coef;
$nh = $height * $coef;
$dx = ($nw - $keep['w']) / 2;
$dy = ($nh - $keep['h']) / 2;
$nx = $keep['x'] - $dx;
$ex = $nx + $nw;
$ny = $keep['y'] - $dy;
$ey = $ny + $nh;
if ($nx < 0) {
$ex += $nx * -1;
$ex = min($iw, $ex);
$nx = 0;
}
if ($ex > $iw) {
$nx = $nx - ($ex - $iw);
$nx = max(0, $nx);
$ex = $iw;
}
if ($ny < 0) {
$ey += $ny * -1;
$ey = min($ih, $ey);
$ny = 0;
}
if ($ey > $ih) {
$ny = $ny - ($ey - $ih);
$ny = max(0, $ny);
$ey = $ih;
}
$di = imagecreatetruecolor($ex - $nx, $ey - $ny);
imagecopyresampled($di, $this->data, 0, 0, $nx, $ny, $ex - $nx, $ey - $ny, $ex - $nx, $ey - $ny);
$this->data = $di;
$iw = $ex - $nx;
$ih = $ey - $ny;
}
$mr = max($width / $iw, $height / $ih);
$tm = imagecreatetruecolor($iw * $mr, $ih * $mr);
imagecopyresized($tm, $this->data, 0, 0, 0, 0, $iw * $mr, $ih * $mr, $iw, $ih);
imagedestroy($this->data);
$this->data = $tm;
$iw = $iw * $mr;
$ih = $ih * $mr;
$di = imagecreatetruecolor($width, $height);
imagecopyresampled($di, $this->data, 0, 0, ($iw-$width)/2, ($ih-$height)/2, $width, $height, $width, $height);
$this->data = $di;
} | php | public function crop(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
$iw = $this->info[0];
$ih = $this->info[1];
if (!$height || !$width) {
if (!$width) {
$width = $height / $ih * $iw;
}
if (!$height) {
$height = $width / $iw * $ih;
}
}
$hasKeep = isset($keep['x']) && isset($keep['y']) && isset($keep['w']) && isset($keep['h']);
if ($hasKeep && (!(int)$keep['w'] || !(int)$keep['h'])) {
throw new ImageException('Invalid keep params');
}
if ($hasKeep) {
if ($keepEnlarge === false && $keep['w'] < $width && $keep['h'] < $height) {
$dw = ($width - $keep['w']) / 2;
$dh = ($height - $keep['h']) / 2;
$dw = min($keep['x'], $dw);
$nkx = $keep['x'] - $dw;
$ekx = $nkx + $keep['w'] + $dw * 2;
$nky = $keep['y'] - $dh;
$eky = $nky + $keep['h'] + $dh * 2;
if ($nkx < 0) {
$ekx += $nkx * -1;
$ekx = min($iw, $ekx);
$nkx = 0;
}
if ($ekx > $iw) {
$nkx = $nkx - ($ekx - $iw);
$nkx = max(0, $nkx);
$ekx = $iw;
}
if ($nky < 0) {
$eky += $nky * -1;
$eky = min($ih, $eky);
$nky = 0;
}
if ($eky > $ih) {
$nky = $nky - ($eky - $ih);
$nky = max(0, $nky);
$eky = $ih;
}
$keep = ['x'=>$nkx, 'y'=>$nky, 'w'=>$ekx - $nkx, 'h'=>$eky - $nky];
}
// get the higher coeficient
$coef = max($keep['w'] / $width, $keep['h'] / $height);
// calculate new width / height so that the keep zone will fit in the crop
$nw = $width * $coef;
$nh = $height * $coef;
$dx = ($nw - $keep['w']) / 2;
$dy = ($nh - $keep['h']) / 2;
$nx = $keep['x'] - $dx;
$ex = $nx + $nw;
$ny = $keep['y'] - $dy;
$ey = $ny + $nh;
if ($nx < 0) {
$ex += $nx * -1;
$ex = min($iw, $ex);
$nx = 0;
}
if ($ex > $iw) {
$nx = $nx - ($ex - $iw);
$nx = max(0, $nx);
$ex = $iw;
}
if ($ny < 0) {
$ey += $ny * -1;
$ey = min($ih, $ey);
$ny = 0;
}
if ($ey > $ih) {
$ny = $ny - ($ey - $ih);
$ny = max(0, $ny);
$ey = $ih;
}
$di = imagecreatetruecolor($ex - $nx, $ey - $ny);
imagecopyresampled($di, $this->data, 0, 0, $nx, $ny, $ex - $nx, $ey - $ny, $ex - $nx, $ey - $ny);
$this->data = $di;
$iw = $ex - $nx;
$ih = $ey - $ny;
}
$mr = max($width / $iw, $height / $ih);
$tm = imagecreatetruecolor($iw * $mr, $ih * $mr);
imagecopyresized($tm, $this->data, 0, 0, 0, 0, $iw * $mr, $ih * $mr, $iw, $ih);
imagedestroy($this->data);
$this->data = $tm;
$iw = $iw * $mr;
$ih = $ih * $mr;
$di = imagecreatetruecolor($width, $height);
imagecopyresampled($di, $this->data, 0, 0, ($iw-$width)/2, ($ih-$height)/2, $width, $height, $width, $height);
$this->data = $di;
} | [
"public",
"function",
"crop",
"(",
"int",
"$",
"width",
"=",
"0",
",",
"int",
"$",
"height",
"=",
"0",
",",
"array",
"$",
"keep",
"=",
"[",
"]",
",",
"bool",
"$",
"keepEnlarge",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"width",
"&&",
"!",
... | Crop a thumbnail with hardcoded dimensions, if one dimension is skipped it will be automatically calculated.
@param int|integer $width the width of the thumbnail
@param int|integer $height the height of the thumbnail
@param array $keep optional array of x, y, w, h of the import part of the image
@param array $keepEnlarge should the keep zone be enlarged to fit the thumbnail - defaults to false | [
"Crop",
"a",
"thumbnail",
"with",
"hardcoded",
"dimensions",
"if",
"one",
"dimension",
"is",
"skipped",
"it",
"will",
"be",
"automatically",
"calculated",
"."
] | train | https://github.com/vakata/image/blob/1d074cc6e274b1b8fe97cf138efcd2c665699686/src/driver/GD.php#L51-L149 |
vakata/image | src/driver/GD.php | GD.rotate | public function rotate(float $degrees)
{
$degrees = 360 - $degrees; // match imagick
$this->data = imagerotate($this->data, $degrees, 0);
} | php | public function rotate(float $degrees)
{
$degrees = 360 - $degrees; // match imagick
$this->data = imagerotate($this->data, $degrees, 0);
} | [
"public",
"function",
"rotate",
"(",
"float",
"$",
"degrees",
")",
"{",
"$",
"degrees",
"=",
"360",
"-",
"$",
"degrees",
";",
"// match imagick",
"$",
"this",
"->",
"data",
"=",
"imagerotate",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"degrees",
",",
... | Rotate the image.
@param float $degrees clockwise angle to rotate | [
"Rotate",
"the",
"image",
"."
] | train | https://github.com/vakata/image/blob/1d074cc6e274b1b8fe97cf138efcd2c665699686/src/driver/GD.php#L154-L158 |
vakata/image | src/driver/GD.php | GD.getImage | public function getImage(string $format = null) : string
{
if (!$format) {
$format = explode('/', $this->info['mime'], 2)[1];
}
switch (strtolower($format)) {
case 'jpg':
case 'jpeg':
ob_start();
imagejpeg($this->data);
return ob_get_clean();
case 'bitmap':
case 'bmp':
ob_start();
imagewbmp($this->data);
return ob_get_clean();
case 'png':
ob_start();
imagepng($this->data);
return ob_get_clean();
case 'gif':
ob_start();
imagegif($this->data);
return ob_get_clean();
case 'webp':
ob_start();
imagewebp($this->data, null);
return ob_get_clean();
default:
throw new ImageException('Unsupported format');
}
} | php | public function getImage(string $format = null) : string
{
if (!$format) {
$format = explode('/', $this->info['mime'], 2)[1];
}
switch (strtolower($format)) {
case 'jpg':
case 'jpeg':
ob_start();
imagejpeg($this->data);
return ob_get_clean();
case 'bitmap':
case 'bmp':
ob_start();
imagewbmp($this->data);
return ob_get_clean();
case 'png':
ob_start();
imagepng($this->data);
return ob_get_clean();
case 'gif':
ob_start();
imagegif($this->data);
return ob_get_clean();
case 'webp':
ob_start();
imagewebp($this->data, null);
return ob_get_clean();
default:
throw new ImageException('Unsupported format');
}
} | [
"public",
"function",
"getImage",
"(",
"string",
"$",
"format",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"format",
")",
"{",
"$",
"format",
"=",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"info",
"[",
"'mime'",
"]",
",",
"2"... | Get the image in a specific format
@param string|null $format optional format to get the image in, if null the source image format is used
@return string binary string of the converted image | [
"Get",
"the",
"image",
"in",
"a",
"specific",
"format"
] | train | https://github.com/vakata/image/blob/1d074cc6e274b1b8fe97cf138efcd2c665699686/src/driver/GD.php#L171-L202 |
swoft-cloud/swoft-console | src/Input/Input.php | Input.read | public function read($question = null, $nl = false): string
{
fwrite($this->handle, $question . ($nl ? "\n" : ''));
return trim(fgets($this->handle));
} | php | public function read($question = null, $nl = false): string
{
fwrite($this->handle, $question . ($nl ? "\n" : ''));
return trim(fgets($this->handle));
} | [
"public",
"function",
"read",
"(",
"$",
"question",
"=",
"null",
",",
"$",
"nl",
"=",
"false",
")",
":",
"string",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"question",
".",
"(",
"$",
"nl",
"?",
"\"\\n\"",
":",
"''",
")",
")",
... | 读取用户的输入信息
@param null $question 信息
@param bool $nl 是否换行
@return string | [
"读取用户的输入信息"
] | train | https://github.com/swoft-cloud/swoft-console/blob/d7153f56505a9be420ebae9eb29f7e45bfb2982e/src/Input/Input.php#L99-L103 |
swoft-cloud/swoft-console | src/Input/Input.php | Input.getRequiredArg | public function getRequiredArg(string $name)
{
if ('' !== $this->get($name, '')) {
return $this->args[$name];
}
throw new \InvalidArgumentException(sprintf('The argument %s is required', $name));
} | php | public function getRequiredArg(string $name)
{
if ('' !== $this->get($name, '')) {
return $this->args[$name];
}
throw new \InvalidArgumentException(sprintf('The argument %s is required', $name));
} | [
"public",
"function",
"getRequiredArg",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"''",
"!==",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
",",
"''",
")",
")",
"{",
"return",
"$",
"this",
"->",
"args",
"[",
"$",
"name",
"]",
";",
"}",
"t... | 获取必要参数
@param string $name
@return mixed
@throws \InvalidArgumentException | [
"获取必要参数"
] | train | https://github.com/swoft-cloud/swoft-console/blob/d7153f56505a9be420ebae9eb29f7e45bfb2982e/src/Input/Input.php#L145-L152 |
swoft-cloud/swoft-console | src/Input/Input.php | Input.getOpt | public function getOpt(string $name, $default = null)
{
if (isset($name{1})) {
return $this->getLongOpt($name, $default);
}
return $this->getShortOpt($name, $default);
} | php | public function getOpt(string $name, $default = null)
{
if (isset($name{1})) {
return $this->getLongOpt($name, $default);
}
return $this->getShortOpt($name, $default);
} | [
"public",
"function",
"getOpt",
"(",
"string",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"name",
"{",
"1",
"}",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getLongOpt",
"(",
"$",
"name",
",",
"$",
"... | 获取选项
@param string $name 名称
@param null $default 默认值
@return mixed|null | [
"获取选项"
] | train | https://github.com/swoft-cloud/swoft-console/blob/d7153f56505a9be420ebae9eb29f7e45bfb2982e/src/Input/Input.php#L191-L198 |
swoft-cloud/swoft-console | src/Input/Input.php | Input.getRequiredOpt | public function getRequiredOpt(string $name)
{
$val = $this->getOpt($name);
if ($val === null) {
throw new \InvalidArgumentException(sprintf('The option %s is required)', $name));
}
return $val;
} | php | public function getRequiredOpt(string $name)
{
$val = $this->getOpt($name);
if ($val === null) {
throw new \InvalidArgumentException(sprintf('The option %s is required)', $name));
}
return $val;
} | [
"public",
"function",
"getRequiredOpt",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"val",
"=",
"$",
"this",
"->",
"getOpt",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"val",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
... | 获取必须选项
@param string $name
@return mixed|null
@throws \InvalidArgumentException | [
"获取必须选项"
] | train | https://github.com/swoft-cloud/swoft-console/blob/d7153f56505a9be420ebae9eb29f7e45bfb2982e/src/Input/Input.php#L207-L215 |
PhillippOhlandt/materializecss-laravel-pagination | src/Presenters/Pagination/Materialize.php | Materialize.render | public function render()
{
if (!$this->hasPages())
return '';
return sprintf(
'<div><ul class="pagination">%s %s %s</ul></div>',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
} | php | public function render()
{
if (!$this->hasPages())
return '';
return sprintf(
'<div><ul class="pagination">%s %s %s</ul></div>',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasPages",
"(",
")",
")",
"return",
"''",
";",
"return",
"sprintf",
"(",
"'<div><ul class=\"pagination\">%s %s %s</ul></div>'",
",",
"$",
"this",
"->",
"getPreviousButton",
"(",... | Convert the URL window into Materialize CSS HTML.
@return string | [
"Convert",
"the",
"URL",
"window",
"into",
"Materialize",
"CSS",
"HTML",
"."
] | train | https://github.com/PhillippOhlandt/materializecss-laravel-pagination/blob/a56d0c0f4c1a069f287d13dc1c88d60ab8efac9b/src/Presenters/Pagination/Materialize.php#L17-L28 |
PhillippOhlandt/materializecss-laravel-pagination | src/Presenters/Pagination/Materialize.php | Materialize.getDisabledTextWrapper | protected function getDisabledTextWrapper($text)
{
$hide = '';
if ($text == "«") {
$text = '<i class="material-icons">chevron_left</i>';
$hide = 'hide';
} elseif ($text == "»") {
$text = '<i class="material-icons">chevron_right</i>';
$hide = 'hide';
}
return '<li class="disabled ' . $hide . '">' . $text . '</li>';
} | php | protected function getDisabledTextWrapper($text)
{
$hide = '';
if ($text == "«") {
$text = '<i class="material-icons">chevron_left</i>';
$hide = 'hide';
} elseif ($text == "»") {
$text = '<i class="material-icons">chevron_right</i>';
$hide = 'hide';
}
return '<li class="disabled ' . $hide . '">' . $text . '</li>';
} | [
"protected",
"function",
"getDisabledTextWrapper",
"(",
"$",
"text",
")",
"{",
"$",
"hide",
"=",
"''",
";",
"if",
"(",
"$",
"text",
"==",
"\"«\"",
")",
"{",
"$",
"text",
"=",
"'<i class=\"material-icons\">chevron_left</i>'",
";",
"$",
"hide",
"=",
"'hi... | Get HTML wrapper for disabled text.
Hide disabled arrows.
@param string $text
@return string | [
"Get",
"HTML",
"wrapper",
"for",
"disabled",
"text",
".",
"Hide",
"disabled",
"arrows",
"."
] | train | https://github.com/PhillippOhlandt/materializecss-laravel-pagination/blob/a56d0c0f4c1a069f287d13dc1c88d60ab8efac9b/src/Presenters/Pagination/Materialize.php#L37-L50 |
PhillippOhlandt/materializecss-laravel-pagination | src/Presenters/Pagination/Materialize.php | Materialize.getActivePageWrapper | protected function getActivePageWrapper($text)
{
$color = '';
if ($this->color) {
$color = $this->color;
}
return '<li class="active ' . $color . '"><a>' . $text . '</a></li>';
} | php | protected function getActivePageWrapper($text)
{
$color = '';
if ($this->color) {
$color = $this->color;
}
return '<li class="active ' . $color . '"><a>' . $text . '</a></li>';
} | [
"protected",
"function",
"getActivePageWrapper",
"(",
"$",
"text",
")",
"{",
"$",
"color",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"color",
")",
"{",
"$",
"color",
"=",
"$",
"this",
"->",
"color",
";",
"}",
"return",
"'<li class=\"active '",
".",... | Get HTML wrapper for active text.
@param string $text
@return string | [
"Get",
"HTML",
"wrapper",
"for",
"active",
"text",
"."
] | train | https://github.com/PhillippOhlandt/materializecss-laravel-pagination/blob/a56d0c0f4c1a069f287d13dc1c88d60ab8efac9b/src/Presenters/Pagination/Materialize.php#L58-L67 |
civicrm/civicrm-setup | src/Setup/DrupalUtil.php | DrupalUtil.getDrupalSiteDir | public static function getDrupalSiteDir($cmsPath) {
static $siteDir = '';
if ($siteDir) {
return $siteDir;
}
$sites = CIVICRM_DIRECTORY_SEPARATOR . 'sites' . CIVICRM_DIRECTORY_SEPARATOR;
$modules = CIVICRM_DIRECTORY_SEPARATOR . 'modules' . CIVICRM_DIRECTORY_SEPARATOR;
preg_match("/" . preg_quote($sites, CIVICRM_DIRECTORY_SEPARATOR) .
"([\-a-zA-Z0-9_.]+)" .
preg_quote($modules, CIVICRM_DIRECTORY_SEPARATOR) . "/",
$_SERVER['SCRIPT_FILENAME'], $matches
);
$siteDir = isset($matches[1]) ? $matches[1] : 'default';
if (strtolower($siteDir) == 'all') {
// For this case - use drupal's way of finding out multi-site directory
$uri = explode(CIVICRM_DIRECTORY_SEPARATOR, $_SERVER['SCRIPT_FILENAME']);
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
for ($i = count($uri) - 1; $i > 0; $i--) {
for ($j = count($server); $j > 0; $j--) {
$dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
if (file_exists($cmsPath . CIVICRM_DIRECTORY_SEPARATOR .
'sites' . CIVICRM_DIRECTORY_SEPARATOR . $dir
)) {
$siteDir = $dir;
return $siteDir;
}
}
}
$siteDir = 'default';
}
return $siteDir;
} | php | public static function getDrupalSiteDir($cmsPath) {
static $siteDir = '';
if ($siteDir) {
return $siteDir;
}
$sites = CIVICRM_DIRECTORY_SEPARATOR . 'sites' . CIVICRM_DIRECTORY_SEPARATOR;
$modules = CIVICRM_DIRECTORY_SEPARATOR . 'modules' . CIVICRM_DIRECTORY_SEPARATOR;
preg_match("/" . preg_quote($sites, CIVICRM_DIRECTORY_SEPARATOR) .
"([\-a-zA-Z0-9_.]+)" .
preg_quote($modules, CIVICRM_DIRECTORY_SEPARATOR) . "/",
$_SERVER['SCRIPT_FILENAME'], $matches
);
$siteDir = isset($matches[1]) ? $matches[1] : 'default';
if (strtolower($siteDir) == 'all') {
// For this case - use drupal's way of finding out multi-site directory
$uri = explode(CIVICRM_DIRECTORY_SEPARATOR, $_SERVER['SCRIPT_FILENAME']);
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
for ($i = count($uri) - 1; $i > 0; $i--) {
for ($j = count($server); $j > 0; $j--) {
$dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
if (file_exists($cmsPath . CIVICRM_DIRECTORY_SEPARATOR .
'sites' . CIVICRM_DIRECTORY_SEPARATOR . $dir
)) {
$siteDir = $dir;
return $siteDir;
}
}
}
$siteDir = 'default';
}
return $siteDir;
} | [
"public",
"static",
"function",
"getDrupalSiteDir",
"(",
"$",
"cmsPath",
")",
"{",
"static",
"$",
"siteDir",
"=",
"''",
";",
"if",
"(",
"$",
"siteDir",
")",
"{",
"return",
"$",
"siteDir",
";",
"}",
"$",
"sites",
"=",
"CIVICRM_DIRECTORY_SEPARATOR",
".",
"... | @param $cmsPath
@return string | [
"@param",
"$cmsPath"
] | train | https://github.com/civicrm/civicrm-setup/blob/556b312faf78781c85c4fc4ae6c1c3b658da9e09/src/Setup/DrupalUtil.php#L11-L46 |
kgilden/php-digidoc | src/Ocsp/Response.php | Response.getResponseMapped | private function getResponseMapped()
{
$parser = new Asn1Parser();
$responseBasicDecoded = $parser->decodeBER(base64_decode($this->response));
return $parser->asn1map($responseBasicDecoded[0], $this->asn1->BasicOCSPResponse);
} | php | private function getResponseMapped()
{
$parser = new Asn1Parser();
$responseBasicDecoded = $parser->decodeBER(base64_decode($this->response));
return $parser->asn1map($responseBasicDecoded[0], $this->asn1->BasicOCSPResponse);
} | [
"private",
"function",
"getResponseMapped",
"(",
")",
"{",
"$",
"parser",
"=",
"new",
"Asn1Parser",
"(",
")",
";",
"$",
"responseBasicDecoded",
"=",
"$",
"parser",
"->",
"decodeBER",
"(",
"base64_decode",
"(",
"$",
"this",
"->",
"response",
")",
")",
";",
... | Decodes and maps the BasicOCSPResponse part of the response.
@return array | [
"Decodes",
"and",
"maps",
"the",
"BasicOCSPResponse",
"part",
"of",
"the",
"response",
"."
] | train | https://github.com/kgilden/php-digidoc/blob/88112ba05688fc1d32c0ff948cb8e1f4d2f264d3/src/Ocsp/Response.php#L169-L175 |
CampaignChain/core | Entity/Action.php | Action.setStatus | public function setStatus($status)
{
if (!in_array(
$status,
[
self::STATUS_OPEN,
self::STATUS_PAUSED,
self::STATUS_CLOSED,
self::STATUS_INTERACTION_REQUIRED,
self::STATUS_BACKGROUND_PROCESS,
]
)
) {
throw new \InvalidArgumentException('Invalid status in '.get_class($this).'.');
}
// If end date is in the past, status is automatically "closed" if status is not "paused".
if (
($status != self::STATUS_BACKGROUND_PROCESS && $status != self::STATUS_CLOSED && $status != self::STATUS_PAUSED && $this->endDate && $this->endDate < new \DateTime(
'now'
))
||
($status != self::STATUS_BACKGROUND_PROCESS && $status != self::STATUS_CLOSED && $status != self::STATUS_PAUSED && !$this->endDate && $this->startDate && $this->startDate < new \DateTime(
'now'
))
) {
// TODO: Warning that status is different from what has been provided.
$status = self::STATUS_CLOSED;
}
$this->status = $status;
return $this;
} | php | public function setStatus($status)
{
if (!in_array(
$status,
[
self::STATUS_OPEN,
self::STATUS_PAUSED,
self::STATUS_CLOSED,
self::STATUS_INTERACTION_REQUIRED,
self::STATUS_BACKGROUND_PROCESS,
]
)
) {
throw new \InvalidArgumentException('Invalid status in '.get_class($this).'.');
}
// If end date is in the past, status is automatically "closed" if status is not "paused".
if (
($status != self::STATUS_BACKGROUND_PROCESS && $status != self::STATUS_CLOSED && $status != self::STATUS_PAUSED && $this->endDate && $this->endDate < new \DateTime(
'now'
))
||
($status != self::STATUS_BACKGROUND_PROCESS && $status != self::STATUS_CLOSED && $status != self::STATUS_PAUSED && !$this->endDate && $this->startDate && $this->startDate < new \DateTime(
'now'
))
) {
// TODO: Warning that status is different from what has been provided.
$status = self::STATUS_CLOSED;
}
$this->status = $status;
return $this;
} | [
"public",
"function",
"setStatus",
"(",
"$",
"status",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"status",
",",
"[",
"self",
"::",
"STATUS_OPEN",
",",
"self",
"::",
"STATUS_PAUSED",
",",
"self",
"::",
"STATUS_CLOSED",
",",
"self",
"::",
"STATUS_INT... | Set status.
@param string $status
@return Action | [
"Set",
"status",
"."
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Action.php#L451-L484 |
CampaignChain/core | Entity/Action.php | Action.getType | public function getType()
{
$class = get_class($this);
if (strpos($class, 'CoreBundle\Entity\Operation') !== false) {
return self::TYPE_OPERATION;
}
if (strpos($class, 'CoreBundle\Entity\Activity') !== false) {
return self::TYPE_ACTIVITY;
}
if (strpos($class, 'CoreBundle\Entity\Milestone') !== false) {
return self::TYPE_MILESTONE;
}
if (strpos($class, 'CoreBundle\Entity\Campaign') !== false) {
return self::TYPE_CAMPAIGN;
}
return false;
} | php | public function getType()
{
$class = get_class($this);
if (strpos($class, 'CoreBundle\Entity\Operation') !== false) {
return self::TYPE_OPERATION;
}
if (strpos($class, 'CoreBundle\Entity\Activity') !== false) {
return self::TYPE_ACTIVITY;
}
if (strpos($class, 'CoreBundle\Entity\Milestone') !== false) {
return self::TYPE_MILESTONE;
}
if (strpos($class, 'CoreBundle\Entity\Campaign') !== false) {
return self::TYPE_CAMPAIGN;
}
return false;
} | [
"public",
"function",
"getType",
"(",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"class",
",",
"'CoreBundle\\Entity\\Operation'",
")",
"!==",
"false",
")",
"{",
"return",
"self",
"::",
"TYPE_OPERA... | Identifies the type of action.
@return string | [
"Identifies",
"the",
"type",
"of",
"action",
".",
"@return",
"string"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Entity/Action.php#L515-L533 |
sulu/SuluAutomationBundle | Serializer/TaskSerializerSubscriber.php | TaskSerializerSubscriber.onTaskSerialize | public function onTaskSerialize(ObjectEvent $event)
{
$object = $event->getObject();
if (!$object instanceof TaskInterface) {
return;
}
$handler = $this->handlerFactory->create($object->getHandlerClass());
if ($handler instanceof AutomationTaskHandlerInterface) {
$event->getVisitor()->addData('taskName', $handler->getConfiguration()->getTitle());
}
$executions = $this->taskExecutionRepository->findByTaskUuid($object->getTaskId());
if (0 < count($executions)) {
$event->getVisitor()->addData('status', $executions[0]->getStatus());
}
} | php | public function onTaskSerialize(ObjectEvent $event)
{
$object = $event->getObject();
if (!$object instanceof TaskInterface) {
return;
}
$handler = $this->handlerFactory->create($object->getHandlerClass());
if ($handler instanceof AutomationTaskHandlerInterface) {
$event->getVisitor()->addData('taskName', $handler->getConfiguration()->getTitle());
}
$executions = $this->taskExecutionRepository->findByTaskUuid($object->getTaskId());
if (0 < count($executions)) {
$event->getVisitor()->addData('status', $executions[0]->getStatus());
}
} | [
"public",
"function",
"onTaskSerialize",
"(",
"ObjectEvent",
"$",
"event",
")",
"{",
"$",
"object",
"=",
"$",
"event",
"->",
"getObject",
"(",
")",
";",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"TaskInterface",
")",
"{",
"return",
";",
"}",
"$",
"h... | Append task-name to task-serialization.
@param ObjectEvent $event | [
"Append",
"task",
"-",
"name",
"to",
"task",
"-",
"serialization",
"."
] | train | https://github.com/sulu/SuluAutomationBundle/blob/2cfc3a7122a96939d2f203f6fe54bcb74e2cfd46/Serializer/TaskSerializerSubscriber.php#L68-L84 |
CampaignChain/core | Controller/ThemeController.php | ThemeController.settingsAction | public function settingsAction(Request $request)
{
/** @var Theme $theme */
$theme = $this->getDoctrine()
->getRepository('CampaignChainCoreBundle:Theme')
->find(1);
$form = $this->createForm(ThemeType::class, $theme);
$form->handleRequest($request);
if ($form->isValid()) {
/** @var FileUploadService $fileUploadService */
$fileUploadService = $this->get('campaignchain.core.service.file_upload');
$path = Theme::STORAGE_PATH.'/logo.png';
/** @var UploadedFile $upload */
$upload = $theme->getLogo();
if($upload) {
$uploadContent = file_get_contents($upload->getRealPath());
$fileUploadService->deleteFile($path);
$fileUploadService->storeImage($path, $uploadContent);
}
$theme->setLogo($path);
$path = Theme::STORAGE_PATH.'/favicon.ico';
/** @var UploadedFile $upload */
$upload = $theme->getFavicon();
if($upload) {
$uploadContent = file_get_contents($upload->getRealPath());
$fileUploadService->deleteFile($path);
$fileUploadService->storeImage($path, $uploadContent);
}
$theme->setFavicon($path);
$this->getDoctrine()->getManager()->flush();
$this->addFlash(
'success',
'The theme settings were successfully changed!'
);
}
return $this->render('CampaignChainCoreBundle:Base:new.html.twig', array(
'form' => $form->createView(),
'page_title' => 'Theme Settings',
));
} | php | public function settingsAction(Request $request)
{
/** @var Theme $theme */
$theme = $this->getDoctrine()
->getRepository('CampaignChainCoreBundle:Theme')
->find(1);
$form = $this->createForm(ThemeType::class, $theme);
$form->handleRequest($request);
if ($form->isValid()) {
/** @var FileUploadService $fileUploadService */
$fileUploadService = $this->get('campaignchain.core.service.file_upload');
$path = Theme::STORAGE_PATH.'/logo.png';
/** @var UploadedFile $upload */
$upload = $theme->getLogo();
if($upload) {
$uploadContent = file_get_contents($upload->getRealPath());
$fileUploadService->deleteFile($path);
$fileUploadService->storeImage($path, $uploadContent);
}
$theme->setLogo($path);
$path = Theme::STORAGE_PATH.'/favicon.ico';
/** @var UploadedFile $upload */
$upload = $theme->getFavicon();
if($upload) {
$uploadContent = file_get_contents($upload->getRealPath());
$fileUploadService->deleteFile($path);
$fileUploadService->storeImage($path, $uploadContent);
}
$theme->setFavicon($path);
$this->getDoctrine()->getManager()->flush();
$this->addFlash(
'success',
'The theme settings were successfully changed!'
);
}
return $this->render('CampaignChainCoreBundle:Base:new.html.twig', array(
'form' => $form->createView(),
'page_title' => 'Theme Settings',
));
} | [
"public",
"function",
"settingsAction",
"(",
"Request",
"$",
"request",
")",
"{",
"/** @var Theme $theme */",
"$",
"theme",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'CampaignChainCoreBundle:Theme'",
")",
"->",
"find",
"(",
"1... | @param Request $request
@param User $userToEdit
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
@Security("has_role('ROLE_SUPER_ADMIN')") | [
"@param",
"Request",
"$request",
"@param",
"User",
"$userToEdit",
"@return",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"HttpFoundation",
"\\",
"RedirectResponse|",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"HttpFoundation",
"\\",
"Response"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Controller/ThemeController.php#L42-L89 |
notthatbad/silverstripe-rest-api | code/authenticators/AuthFactory.php | AuthFactory.generate_token | public static function generate_token($user) {
$generator = new \RandomGenerator();
$tokenString = $generator->randomToken();
$e = \PasswordEncryptor::create_for_algorithm('blowfish');
$salt = $e->salt($tokenString);
$token = sha1($e->encrypt($tokenString, $salt)) . substr(md5($user->Created.$user->LastEdited.$user->ID), 7);
return $token;
} | php | public static function generate_token($user) {
$generator = new \RandomGenerator();
$tokenString = $generator->randomToken();
$e = \PasswordEncryptor::create_for_algorithm('blowfish');
$salt = $e->salt($tokenString);
$token = sha1($e->encrypt($tokenString, $salt)) . substr(md5($user->Created.$user->LastEdited.$user->ID), 7);
return $token;
} | [
"public",
"static",
"function",
"generate_token",
"(",
"$",
"user",
")",
"{",
"$",
"generator",
"=",
"new",
"\\",
"RandomGenerator",
"(",
")",
";",
"$",
"tokenString",
"=",
"$",
"generator",
"->",
"randomToken",
"(",
")",
";",
"$",
"e",
"=",
"\\",
"Pas... | Generates an encrypted random token.
@param \Member $user
@throws \PasswordEncryptor_NotFoundException
@return string | [
"Generates",
"an",
"encrypted",
"random",
"token",
"."
] | train | https://github.com/notthatbad/silverstripe-rest-api/blob/aed8e9812a01d4ab1e7cdfe7c3e0161ca368e621/code/authenticators/AuthFactory.php#L26-L33 |
notthatbad/silverstripe-rest-api | code/authenticators/AuthFactory.php | AuthFactory.get_token | public static function get_token($request) {
// try to get the token from request object
$tokenStrFromHeader = $request->getHeader('Authorization');
$tokenStrFromVar = $request->requestVar('access_token');
if (!empty($tokenStrFromHeader)) {
// string must have format: type token
return explode(' ', $tokenStrFromHeader)[1];
} else if(!empty($tokenStrFromVar)) {
// try variables
return $tokenStrFromVar;
} else if(function_exists('getallheaders')) {
// get all headers from apache server
$headers = getallheaders();
if(isset($headers['Authorization'])) {
return explode(' ', $headers['Authorization'])[1];
}
}
throw new \Exception("Token can't be read or was not specified");
} | php | public static function get_token($request) {
// try to get the token from request object
$tokenStrFromHeader = $request->getHeader('Authorization');
$tokenStrFromVar = $request->requestVar('access_token');
if (!empty($tokenStrFromHeader)) {
// string must have format: type token
return explode(' ', $tokenStrFromHeader)[1];
} else if(!empty($tokenStrFromVar)) {
// try variables
return $tokenStrFromVar;
} else if(function_exists('getallheaders')) {
// get all headers from apache server
$headers = getallheaders();
if(isset($headers['Authorization'])) {
return explode(' ', $headers['Authorization'])[1];
}
}
throw new \Exception("Token can't be read or was not specified");
} | [
"public",
"static",
"function",
"get_token",
"(",
"$",
"request",
")",
"{",
"// try to get the token from request object",
"$",
"tokenStrFromHeader",
"=",
"$",
"request",
"->",
"getHeader",
"(",
"'Authorization'",
")",
";",
"$",
"tokenStrFromVar",
"=",
"$",
"request... | Returns the token from the request.
Silverstripe doesn't include Authorization header in its requests. We should check it, because we can use the
mechanism in the tests.
@param \SS_HTTPRequest $request
@return String the token
@throws \Exception | [
"Returns",
"the",
"token",
"from",
"the",
"request",
"."
] | train | https://github.com/notthatbad/silverstripe-rest-api/blob/aed8e9812a01d4ab1e7cdfe7c3e0161ca368e621/code/authenticators/AuthFactory.php#L44-L62 |
joomla-framework/twitter-api | src/Places.php | Places.createPlace | public function createPlace($lat, $long, $name, $geoToken, $within, $attribute = null, $callback = null)
{
// Check the rate limit for remaining hits
$this->checkRateLimit('geo', 'place');
$data['lat'] = $lat;
$data['long'] = $long;
$data['name'] = rawurlencode($name);
$data['token'] = $geoToken;
$data['contained_within'] = $within;
// Check if attribute is specified
if ($attribute)
{
$data['attribute:street_address'] = rawurlencode($attribute);
}
// Check if callback is specified
if ($callback)
{
$data['callback'] = $callback;
}
// Set the API path
$path = '/geo/place.json';
// Send the request.
return $this->sendRequest($path, 'POST', $data);
} | php | public function createPlace($lat, $long, $name, $geoToken, $within, $attribute = null, $callback = null)
{
// Check the rate limit for remaining hits
$this->checkRateLimit('geo', 'place');
$data['lat'] = $lat;
$data['long'] = $long;
$data['name'] = rawurlencode($name);
$data['token'] = $geoToken;
$data['contained_within'] = $within;
// Check if attribute is specified
if ($attribute)
{
$data['attribute:street_address'] = rawurlencode($attribute);
}
// Check if callback is specified
if ($callback)
{
$data['callback'] = $callback;
}
// Set the API path
$path = '/geo/place.json';
// Send the request.
return $this->sendRequest($path, 'POST', $data);
} | [
"public",
"function",
"createPlace",
"(",
"$",
"lat",
",",
"$",
"long",
",",
"$",
"name",
",",
"$",
"geoToken",
",",
"$",
"within",
",",
"$",
"attribute",
"=",
"null",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"// Check the rate limit for remaining hits... | Method to create a new place object at the given latitude and longitude.
@param float $lat The latitude to search around.
@param float $long The longitude to search around.
@param string $name The name a place is known as.
@param string $geoToken The token found in the response from geo/similar_places.
@param string $within This is the place_id which you would like to restrict the search results to.
@param string $attribute This parameter searches for places which have this given street address.
@param string $callback If supplied, the response will use the JSONP format with a callback of the given name.
@return array The decoded JSON response
@since 1.0 | [
"Method",
"to",
"create",
"a",
"new",
"place",
"object",
"at",
"the",
"given",
"latitude",
"and",
"longitude",
"."
] | train | https://github.com/joomla-framework/twitter-api/blob/289719bbd67e83c7cfaf515b94b1d5497b1f0525/src/Places.php#L261-L289 |
CampaignChain/core | Module/Kernel.php | Kernel.registerClasses | protected function registerClasses()
{
$campaignchainBundlesContent = file_get_contents($this->configFiles['bundles']);
$symfonyBundlesContent = file_get_contents($this->configFiles['kernel_symfony']);
$hasNewBundles = false;
$classes = $this->kernelConfig->getClasses();
if (!count($classes)) {
return;
}
foreach ($classes as $class) {
// Check if the bundle is already registered in the kernel.
if (
strpos($campaignchainBundlesContent, $class) === false &&
strpos($symfonyBundlesContent, $class) === false
) {
$hasNewBundles = true;
// Add the bundle class path to the CampaignChain bundles registry file.
$campaignchainContentBundle = "\$bundles[] = new ".$class."();";
$campaignchainBundlesContent .= "\xA".$campaignchainContentBundle;
}
}
if (!$hasNewBundles) {
return;
}
$fs = new Filesystem();
$fs->dumpFile($this->configFiles['bundles'], $campaignchainBundlesContent);
} | php | protected function registerClasses()
{
$campaignchainBundlesContent = file_get_contents($this->configFiles['bundles']);
$symfonyBundlesContent = file_get_contents($this->configFiles['kernel_symfony']);
$hasNewBundles = false;
$classes = $this->kernelConfig->getClasses();
if (!count($classes)) {
return;
}
foreach ($classes as $class) {
// Check if the bundle is already registered in the kernel.
if (
strpos($campaignchainBundlesContent, $class) === false &&
strpos($symfonyBundlesContent, $class) === false
) {
$hasNewBundles = true;
// Add the bundle class path to the CampaignChain bundles registry file.
$campaignchainContentBundle = "\$bundles[] = new ".$class."();";
$campaignchainBundlesContent .= "\xA".$campaignchainContentBundle;
}
}
if (!$hasNewBundles) {
return;
}
$fs = new Filesystem();
$fs->dumpFile($this->configFiles['bundles'], $campaignchainBundlesContent);
} | [
"protected",
"function",
"registerClasses",
"(",
")",
"{",
"$",
"campaignchainBundlesContent",
"=",
"file_get_contents",
"(",
"$",
"this",
"->",
"configFiles",
"[",
"'bundles'",
"]",
")",
";",
"$",
"symfonyBundlesContent",
"=",
"file_get_contents",
"(",
"$",
"this... | Register bundles | [
"Register",
"bundles"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Module/Kernel.php#L153-L188 |
CampaignChain/core | Module/Kernel.php | Kernel.registerConfigs | protected function registerConfigs()
{
$hasNewConfigs = false;
$yamlConfig = new YamlConfig('', $this->configFiles['config']);
$parameters = $yamlConfig->read();
$configs = $this->kernelConfig->getConfigs();
if (!count($configs)) {
return;
}
foreach ($configs as $config) {
// Check if the config is already being imported.
if (VariableUtil::recursiveArraySearch($config, $parameters['imports']) === false) {
$hasNewConfigs = true;
// Add the config to the imports
$parameters['imports'][]['resource'] = $config;
}
}
if (!$hasNewConfigs) {
return;
}
$yamlConfig = new YamlConfig('', $this->configFiles['config']);
$yamlConfig->write($parameters);
$yamlConfig->clean();
} | php | protected function registerConfigs()
{
$hasNewConfigs = false;
$yamlConfig = new YamlConfig('', $this->configFiles['config']);
$parameters = $yamlConfig->read();
$configs = $this->kernelConfig->getConfigs();
if (!count($configs)) {
return;
}
foreach ($configs as $config) {
// Check if the config is already being imported.
if (VariableUtil::recursiveArraySearch($config, $parameters['imports']) === false) {
$hasNewConfigs = true;
// Add the config to the imports
$parameters['imports'][]['resource'] = $config;
}
}
if (!$hasNewConfigs) {
return;
}
$yamlConfig = new YamlConfig('', $this->configFiles['config']);
$yamlConfig->write($parameters);
$yamlConfig->clean();
} | [
"protected",
"function",
"registerConfigs",
"(",
")",
"{",
"$",
"hasNewConfigs",
"=",
"false",
";",
"$",
"yamlConfig",
"=",
"new",
"YamlConfig",
"(",
"''",
",",
"$",
"this",
"->",
"configFiles",
"[",
"'config'",
"]",
")",
";",
"$",
"parameters",
"=",
"$"... | Register bundle's config.yml files | [
"Register",
"bundle",
"s",
"config",
".",
"yml",
"files"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Module/Kernel.php#L193-L223 |
CampaignChain/core | Module/Kernel.php | Kernel.registerSecurity | protected function registerSecurity()
{
/*
* Re-create the security.yml file to avoid duplicates in merged array
* that occur upon multiple parsing.
*/
$fs = new Filesystem();
if(!$fs->exists($this->configFiles['security'])){
$fs->copy(
$this->configFiles['security_dist'],
$this->configFiles['security'],
true
);
}
$yamlConfig = new YamlConfig('', $this->configFiles['security_dist']);
$appParameters = $yamlConfig->read();
// Read content of all security.yml files and merge the arrays.
$securityFiles = $this->kernelConfig->getSecurities();
if (!count($securityFiles)) {
return;
}
foreach ($securityFiles as $securityFile) {
$yamlConfig = new YamlConfig('', $securityFile);
$bundleParameters = $yamlConfig->read();
$appParameters = VariableUtil::arrayMerge($bundleParameters, $appParameters);
}
$yamlConfig = new YamlConfig('', $this->configFiles['security']);
$yamlConfig->write($appParameters, 5);
$yamlConfig->clean();
} | php | protected function registerSecurity()
{
/*
* Re-create the security.yml file to avoid duplicates in merged array
* that occur upon multiple parsing.
*/
$fs = new Filesystem();
if(!$fs->exists($this->configFiles['security'])){
$fs->copy(
$this->configFiles['security_dist'],
$this->configFiles['security'],
true
);
}
$yamlConfig = new YamlConfig('', $this->configFiles['security_dist']);
$appParameters = $yamlConfig->read();
// Read content of all security.yml files and merge the arrays.
$securityFiles = $this->kernelConfig->getSecurities();
if (!count($securityFiles)) {
return;
}
foreach ($securityFiles as $securityFile) {
$yamlConfig = new YamlConfig('', $securityFile);
$bundleParameters = $yamlConfig->read();
$appParameters = VariableUtil::arrayMerge($bundleParameters, $appParameters);
}
$yamlConfig = new YamlConfig('', $this->configFiles['security']);
$yamlConfig->write($appParameters, 5);
$yamlConfig->clean();
} | [
"protected",
"function",
"registerSecurity",
"(",
")",
"{",
"/*\n * Re-create the security.yml file to avoid duplicates in merged array\n * that occur upon multiple parsing.\n */",
"$",
"fs",
"=",
"new",
"Filesystem",
"(",
")",
";",
"if",
"(",
"!",
"$",
... | Register bundle's security.yml files | [
"Register",
"bundle",
"s",
"security",
".",
"yml",
"files"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Module/Kernel.php#L228-L261 |
CampaignChain/core | Module/Kernel.php | Kernel.registerRoutings | protected function registerRoutings()
{
$yamlConfig = new YamlConfig('', $this->configFiles['routing']);
$parameters = $yamlConfig->read();
$hasNewRoutings = false;
$routings = $this->kernelConfig->getRoutings();
if (!count($routings)) {
return false;
}
foreach ($routings as $routing) {
// Check if the routing is already defined.
if (isset($parameters[$routing['name']])) {
continue;
}
$hasNewRoutings = true;
// Add the config to the imports
$parameters[$routing['name']] = array(
'resource' => $routing['resource'],
'prefix' => $routing['prefix'],
);
}
if (!$hasNewRoutings) {
return;
}
$yamlConfig = new YamlConfig('', $this->configFiles['routing']);
$yamlConfig->write($parameters);
$yamlConfig->clean();
} | php | protected function registerRoutings()
{
$yamlConfig = new YamlConfig('', $this->configFiles['routing']);
$parameters = $yamlConfig->read();
$hasNewRoutings = false;
$routings = $this->kernelConfig->getRoutings();
if (!count($routings)) {
return false;
}
foreach ($routings as $routing) {
// Check if the routing is already defined.
if (isset($parameters[$routing['name']])) {
continue;
}
$hasNewRoutings = true;
// Add the config to the imports
$parameters[$routing['name']] = array(
'resource' => $routing['resource'],
'prefix' => $routing['prefix'],
);
}
if (!$hasNewRoutings) {
return;
}
$yamlConfig = new YamlConfig('', $this->configFiles['routing']);
$yamlConfig->write($parameters);
$yamlConfig->clean();
} | [
"protected",
"function",
"registerRoutings",
"(",
")",
"{",
"$",
"yamlConfig",
"=",
"new",
"YamlConfig",
"(",
"''",
",",
"$",
"this",
"->",
"configFiles",
"[",
"'routing'",
"]",
")",
";",
"$",
"parameters",
"=",
"$",
"yamlConfig",
"->",
"read",
"(",
")",... | Register bundle's routing.yml files | [
"Register",
"bundle",
"s",
"routing",
".",
"yml",
"files"
] | train | https://github.com/CampaignChain/core/blob/82526548a223ed49fcd65ed7c23638544499775f/Module/Kernel.php#L266-L301 |
moharrum/laravel-geoip-world-cities | src/Console/CreateCitiesMigrationCommand.php | CreateCitiesMigrationCommand.handle | public function handle()
{
$exists = false;
if (File::exists($this->publishedMigrationRealpath())) {
$exists = true;
if (!$this->confirm('The migration file already exists, overwrite it? [Yes|no]')) {
return $this->info('Okay, no changes made to the file.');
}
}
$inputFile = file_get_contents($this->localMigrationRealpath());
$outputFile = fopen($this->publishedMigrationRealpath(), 'w');
if ($inputFile && $outputFile) {
fwrite($outputFile, $inputFile);
fclose($outputFile);
} else {
File::delete($this->publishedMigrationRealpath());
return $this->error(
'There was an error creating the migration file, '
.'check write permissions for ' . base_path('database') . DIRECTORY_SEPARATOR . 'migrations'
.PHP_EOL
.PHP_EOL
.'If you think this is a bug, please submit a bug report '
.'at https://github.com/moharrum/laravel-geoip-world-cities/issues'
);
}
if(! $exists) {
$this->info('Okay, migration file created successfully.');
return;
}
$this->info('Okay, migration file overwritten successfully.');
} | php | public function handle()
{
$exists = false;
if (File::exists($this->publishedMigrationRealpath())) {
$exists = true;
if (!$this->confirm('The migration file already exists, overwrite it? [Yes|no]')) {
return $this->info('Okay, no changes made to the file.');
}
}
$inputFile = file_get_contents($this->localMigrationRealpath());
$outputFile = fopen($this->publishedMigrationRealpath(), 'w');
if ($inputFile && $outputFile) {
fwrite($outputFile, $inputFile);
fclose($outputFile);
} else {
File::delete($this->publishedMigrationRealpath());
return $this->error(
'There was an error creating the migration file, '
.'check write permissions for ' . base_path('database') . DIRECTORY_SEPARATOR . 'migrations'
.PHP_EOL
.PHP_EOL
.'If you think this is a bug, please submit a bug report '
.'at https://github.com/moharrum/laravel-geoip-world-cities/issues'
);
}
if(! $exists) {
$this->info('Okay, migration file created successfully.');
return;
}
$this->info('Okay, migration file overwritten successfully.');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"exists",
"=",
"false",
";",
"if",
"(",
"File",
"::",
"exists",
"(",
"$",
"this",
"->",
"publishedMigrationRealpath",
"(",
")",
")",
")",
"{",
"$",
"exists",
"=",
"true",
";",
"if",
"(",
"!",
"$",... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/moharrum/laravel-geoip-world-cities/blob/2a3e928d644da3348c3f203b4f41208209c5e97c/src/Console/CreateCitiesMigrationCommand.php#L64-L104 |
vinterskogen/laravel-uploaded-image | src/AdvancedUploadedImage.php | AdvancedUploadedImage.createFromBase | public static function createFromBase($uploadedImage)
{
$interventionImage = $uploadedImage->getInterventionImage();
$driver = $interventionImage->getDriver();
$core = $interventionImage->getCore();
$image = new self($uploadedImage, $driver, $core);
$image->mime = $interventionImage->mime();
$image->setFileInfoFromPath($uploadedImage->getRealPath());
return $image;
} | php | public static function createFromBase($uploadedImage)
{
$interventionImage = $uploadedImage->getInterventionImage();
$driver = $interventionImage->getDriver();
$core = $interventionImage->getCore();
$image = new self($uploadedImage, $driver, $core);
$image->mime = $interventionImage->mime();
$image->setFileInfoFromPath($uploadedImage->getRealPath());
return $image;
} | [
"public",
"static",
"function",
"createFromBase",
"(",
"$",
"uploadedImage",
")",
"{",
"$",
"interventionImage",
"=",
"$",
"uploadedImage",
"->",
"getInterventionImage",
"(",
")",
";",
"$",
"driver",
"=",
"$",
"interventionImage",
"->",
"getDriver",
"(",
")",
... | Create advanced uploaded image with given uploaded image instance.
@param \Vinterskogen\UploadedImage\UploadedImage $uploadedImage
@return \Vinterskogen\UploadedImage\AdvancedUploadedImage | [
"Create",
"advanced",
"uploaded",
"image",
"with",
"given",
"uploaded",
"image",
"instance",
"."
] | train | https://github.com/vinterskogen/laravel-uploaded-image/blob/1b2c06ce3386622ac9360cc7895c5e5db0211797/src/AdvancedUploadedImage.php#L167-L180 |
ionux/phactor | src/Number.php | Number.BaseCheck | public function BaseCheck($base)
{
switch ($base) {
case '256':
return $this->genBytes();
case '16':
return $this->hex_chars;
case '58':
return $this->b58_chars;
case '2':
return $this->bin_chars;
case '10':
return $this->dec_chars;
default:
throw new \Exception('Unknown base parameter passed to Number::BaseCheck() function. Value received was "' . var_export($base, true) . '".');
}
} | php | public function BaseCheck($base)
{
switch ($base) {
case '256':
return $this->genBytes();
case '16':
return $this->hex_chars;
case '58':
return $this->b58_chars;
case '2':
return $this->bin_chars;
case '10':
return $this->dec_chars;
default:
throw new \Exception('Unknown base parameter passed to Number::BaseCheck() function. Value received was "' . var_export($base, true) . '".');
}
} | [
"public",
"function",
"BaseCheck",
"(",
"$",
"base",
")",
"{",
"switch",
"(",
"$",
"base",
")",
"{",
"case",
"'256'",
":",
"return",
"$",
"this",
"->",
"genBytes",
"(",
")",
";",
"case",
"'16'",
":",
"return",
"$",
"this",
"->",
"hex_chars",
";",
"... | Returns the appropriate base digit string/array for the
requested base parameter.
@param string $base The base requested.
@return array|string The base character info.
@throws \Exception | [
"Returns",
"the",
"appropriate",
"base",
"digit",
"string",
"/",
"array",
"for",
"the",
"requested",
"base",
"parameter",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/Number.php#L72-L88 |
ionux/phactor | src/Number.php | Number.absValue | public function absValue($value)
{
/* Remove any negative signs. */
return ($value[0] == '-') ? substr($this->prepAndClean($value), 1) : $this->prepAndClean($value);
} | php | public function absValue($value)
{
/* Remove any negative signs. */
return ($value[0] == '-') ? substr($this->prepAndClean($value), 1) : $this->prepAndClean($value);
} | [
"public",
"function",
"absValue",
"(",
"$",
"value",
")",
"{",
"/* Remove any negative signs. */",
"return",
"(",
"$",
"value",
"[",
"0",
"]",
"==",
"'-'",
")",
"?",
"substr",
"(",
"$",
"this",
"->",
"prepAndClean",
"(",
"$",
"value",
")",
",",
"1",
")... | Returns the absolute value |$val| of the number.
@param string $value The value to be abs'd.
@return string The absolute value of the number. | [
"Returns",
"the",
"absolute",
"value",
"|$val|",
"of",
"the",
"number",
"."
] | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/Number.php#L164-L168 |
ionux/phactor | src/Number.php | Number.SecureRandomNumber | public function SecureRandomNumber()
{
$this->openSSLCheck();
$cstrong = false;
$secure_random_number = '';
while (strlen($secure_random_number) < 78) {
$secure_random_number = $secure_random_number . hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong)));
}
if ($secure_random_number === false || $cstrong === false) {
throw new \Exception('The Phactor math library could not generate a cryptographically-strong random number. Your OpenSSL extension might be old or broken. Please contact your web hosting provider with this error message.');
}
return $secure_random_number;
} | php | public function SecureRandomNumber()
{
$this->openSSLCheck();
$cstrong = false;
$secure_random_number = '';
while (strlen($secure_random_number) < 78) {
$secure_random_number = $secure_random_number . hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong)));
}
if ($secure_random_number === false || $cstrong === false) {
throw new \Exception('The Phactor math library could not generate a cryptographically-strong random number. Your OpenSSL extension might be old or broken. Please contact your web hosting provider with this error message.');
}
return $secure_random_number;
} | [
"public",
"function",
"SecureRandomNumber",
"(",
")",
"{",
"$",
"this",
"->",
"openSSLCheck",
"(",
")",
";",
"$",
"cstrong",
"=",
"false",
";",
"$",
"secure_random_number",
"=",
"''",
";",
"while",
"(",
"strlen",
"(",
"$",
"secure_random_number",
")",
"<",... | Generates a secure random number using the OpenSSL
openssl_random_pseudo_bytes extension, see:
http://php.net/manual/en/function.openssl-random-pseudo-bytes.php
@return string $secure_random_number Random data in hex form.
@throws \Exception | [
"Generates",
"a",
"secure",
"random",
"number",
"using",
"the",
"OpenSSL",
"openssl_random_pseudo_bytes",
"extension",
"see",
":",
"http",
":",
"//",
"php",
".",
"net",
"/",
"manual",
"/",
"en",
"/",
"function",
".",
"openssl",
"-",
"random",
"-",
"pseudo",
... | train | https://github.com/ionux/phactor/blob/667064d3930e043fd78abed9a2324aee52466fa5/src/Number.php#L178-L194 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row0 | protected function row0($rank2)
{
if ($rank2 == 0) {
$this->row9(0);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE / 4, 0)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE / 4)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 1) {
$this->row9(1);
$p = new Primitive\Polygon();
$p
->point(self::SIZE * (3/4), 0)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 4)
->point(0, self::SIZE)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 2) {
$this->row9(2);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, self::SIZE * (3/4))
->point(self::SIZE, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 3) {
$this->row9(3);
$p = new Primitive\Polygon();
$p
->point(0, self::SIZE * (3/4))
->point(self::SIZE, 0)
->point(self::SIZE / 4, self::SIZE)
->point(0, self::SIZE)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 4) {
$this->row9(8);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE / 4, 0)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE / 4)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 5) {
$this->row9(9);
$p = new Primitive\Polygon();
$p
->point(self::SIZE * (3/4), 0)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 4)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 6) {
$this->row9(10);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, self::SIZE * (3/4))
->point(self::SIZE, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 7) {
$this->row9(11);
$p = new Primitive\Polygon();
$p
->point(0, self::SIZE * (3/4))
->point(self::SIZE, 0)
->point(self::SIZE / 4, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 8) {
$this->row1(8);
$this->row2(9);
}
if ($rank2 == 9) {
$this->row1(9);
$this->row2(8);
}
if ($rank2 == 10) {
$this->row1(10);
$this->row2(9);
$this->get(5)->color($this->bg());
$this->get(6)->color($this->bg());
}
if ($rank2 == 11) {
$this->row1(11);
$this->row2(8);
$this->get(5)->color($this->bg());
$this->get(6)->color($this->bg());
}
if ($rank2 == 12) {
$this->row8(11);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
if ($rank2 == 13) {
$this->row8(12);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
if ($rank2 == 14) {
$this->row8(13);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
if ($rank2 == 15) {
$this->row8(14);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
} | php | protected function row0($rank2)
{
if ($rank2 == 0) {
$this->row9(0);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE / 4, 0)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE / 4)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 1) {
$this->row9(1);
$p = new Primitive\Polygon();
$p
->point(self::SIZE * (3/4), 0)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 4)
->point(0, self::SIZE)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 2) {
$this->row9(2);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, self::SIZE * (3/4))
->point(self::SIZE, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 3) {
$this->row9(3);
$p = new Primitive\Polygon();
$p
->point(0, self::SIZE * (3/4))
->point(self::SIZE, 0)
->point(self::SIZE / 4, self::SIZE)
->point(0, self::SIZE)
->color($this->bg());
$this->add($p);
}
if ($rank2 == 4) {
$this->row9(8);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE / 4, 0)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE / 4)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 5) {
$this->row9(9);
$p = new Primitive\Polygon();
$p
->point(self::SIZE * (3/4), 0)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 4)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 6) {
$this->row9(10);
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, self::SIZE * (3/4))
->point(self::SIZE, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 7) {
$this->row9(11);
$p = new Primitive\Polygon();
$p
->point(0, self::SIZE * (3/4))
->point(self::SIZE, 0)
->point(self::SIZE / 4, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 8) {
$this->row1(8);
$this->row2(9);
}
if ($rank2 == 9) {
$this->row1(9);
$this->row2(8);
}
if ($rank2 == 10) {
$this->row1(10);
$this->row2(9);
$this->get(5)->color($this->bg());
$this->get(6)->color($this->bg());
}
if ($rank2 == 11) {
$this->row1(11);
$this->row2(8);
$this->get(5)->color($this->bg());
$this->get(6)->color($this->bg());
}
if ($rank2 == 12) {
$this->row8(11);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
if ($rank2 == 13) {
$this->row8(12);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
if ($rank2 == 14) {
$this->row8(13);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
if ($rank2 == 15) {
$this->row8(14);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
} | [
"protected",
"function",
"row0",
"(",
"$",
"rank2",
")",
"{",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"row9",
"(",
"0",
")",
";",
"$",
"p",
"=",
"new",
"Primitive",
"\\",
"Polygon",
"(",
")",
";",
"$",
"p",
"->",
"poi... | Selects one of the 16 units using various shapes.
@param integer $rank2 Column index
@access protected
@return void | [
"Selects",
"one",
"of",
"the",
"16",
"units",
"using",
"various",
"shapes",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L145-L312 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row1 | protected function row1($rank2)
{
// As void, so, square take all place and take background color.
if ($rank2 == 0) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->bg());
$this->add($c);
}
// As plain square
if ($rank2 == 1) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
}
// Mid sized suare TL
if ($rank2 == 2) {
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized suare TR
if ($rank2 == 3) {
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized suare BR
if ($rank2 == 4) {
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized suare BL
if ($rank2 == 5) {
$c = new Primitive\Square();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized squares TL + BR
if ($rank2 == 6) {
$this->row1(2);
$this->row1(4);
}
// Mid sized squares TR + BL
if ($rank2 == 7) {
$this->row1(3);
$this->row1(5);
}
// Little small square diagonal TL BR
if ($rank2 == 8) {
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point((int) ((3 / 4) * Unit::SIZE), (int) ((3 / 4) * Unit::SIZE));
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// Little small square diagonal BL TR
if ($rank2 == 9) {
$c = new Primitive\Square();
$c->point(0, (3 / 4) * Unit::SIZE);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point((3 / 4) * Unit::SIZE, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// same as 8 but in reversed colors
if ($rank2 == 10) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point((int) ((3 / 4) * Unit::SIZE), (int) ((3 / 4) * Unit::SIZE));
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
}
// same as 9 but in reversed colors
if ($rank2 == 11) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, (3 / 4) * Unit::SIZE);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point((3 / 4) * Unit::SIZE, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare TL reversed colors
if ($rank2 == 12) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare TR reversed colors
if ($rank2 == 13) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare BR
if ($rank2 == 14) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare BL
if ($rank2 == 15) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
} | php | protected function row1($rank2)
{
// As void, so, square take all place and take background color.
if ($rank2 == 0) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->bg());
$this->add($c);
}
// As plain square
if ($rank2 == 1) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
}
// Mid sized suare TL
if ($rank2 == 2) {
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized suare TR
if ($rank2 == 3) {
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized suare BR
if ($rank2 == 4) {
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized suare BL
if ($rank2 == 5) {
$c = new Primitive\Square();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Mid sized squares TL + BR
if ($rank2 == 6) {
$this->row1(2);
$this->row1(4);
}
// Mid sized squares TR + BL
if ($rank2 == 7) {
$this->row1(3);
$this->row1(5);
}
// Little small square diagonal TL BR
if ($rank2 == 8) {
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point((int) ((3 / 4) * Unit::SIZE), (int) ((3 / 4) * Unit::SIZE));
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// Little small square diagonal BL TR
if ($rank2 == 9) {
$c = new Primitive\Square();
$c->point(0, (3 / 4) * Unit::SIZE);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point((3 / 4) * Unit::SIZE, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// same as 8 but in reversed colors
if ($rank2 == 10) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point((int) ((3 / 4) * Unit::SIZE), (int) ((3 / 4) * Unit::SIZE));
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
}
// same as 9 but in reversed colors
if ($rank2 == 11) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, (3 / 4) * Unit::SIZE);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 4, Unit::SIZE / 2);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 4);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
$c = new Primitive\Square();
$c->point((3 / 4) * Unit::SIZE, 0);
$c->size(Unit::SIZE / 4);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare TL reversed colors
if ($rank2 == 12) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare TR reversed colors
if ($rank2 == 13) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, 0);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare BR
if ($rank2 == 14) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
// Mid sized suare BL
if ($rank2 == 15) {
$c = new Primitive\Square();
$c->point(0, 0)->size(Unit::SIZE)->color($this->fg());
$this->add($c);
$c = new Primitive\Square();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2);
$c->color($this->bg());
$this->add($c);
}
} | [
"protected",
"function",
"row1",
"(",
"$",
"rank2",
")",
"{",
"// As void, so, square take all place and take background color.",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"c",
"=",
"new",
"Primitive",
"\\",
"Square",
"(",
")",
";",
"$",
"c",
"->",
... | Select one of the 16 shapes with squares.
@param integer $rank2 Column index
@access protected
@return void | [
"Select",
"one",
"of",
"the",
"16",
"shapes",
"with",
"squares",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L321-L538 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row2 | protected function row2($rank2)
{
// Big triangle TL
if ($rank2 == 0) {
$c = new Primitive\Triangle();
$c->point(0, 0);
$c->point(Unit::SIZE, 0);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big triangle TR
if ($rank2 == 1) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, 0);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(0, 0);
$c->color($this->fg());
$this->add($c);
}
// Big triangle BR
if ($rank2 == 2) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, 0);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big triangle BL
if ($rank2 == 3) {
$c = new Primitive\Triangle();
$c->point(0, 0);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// triangle TL
if ($rank2 == 4) {
$c = new Primitive\Triangle();
$c->point(0, 0);
$c->point(Unit::SIZE / 2, 0);
$c->point(0, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// triangle TR
if ($rank2 == 5) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE / 2, 0);
$c->point(Unit::SIZE, Unit::SIZE / 2);
$c->point(Unit::SIZE, 0);
$c->color($this->fg());
$this->add($c);
}
// triangle BR
if ($rank2 == 6) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, Unit::SIZE / 2);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// triangle BL
if ($rank2 == 7) {
$c = new Primitive\Triangle();
$c->point(0, Unit::SIZE / 2);
$c->point(Unit::SIZE / 2, Unit::SIZE);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// 2 triangles TL BR
if ($rank2 == 8) {
$this->row2(4);
$this->row2(6);
}
// 2 triangles TR BL
if ($rank2 == 9) {
$this->row2(5);
$this->row2(7);
}
// 2 triangles TL TR
if ($rank2 == 10) {
$this->row2(4);
$this->row2(5);
}
// 2 triangles BL BR
if ($rank2 == 11) {
$this->row2(6);
$this->row2(7);
}
// 2 triangles TL BL
if ($rank2 == 12) {
$this->row2(4);
$this->row2(7);
}
// 2 triangles TR BR
if ($rank2 == 13) {
$this->row2(5);
$this->row2(6);
}
// 2 triangles CENTER TOP and BOTTOM
if ($rank2 == 14) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE / 4, 0);
$c->point(Unit::SIZE * (3/4), 0);
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Triangle();
$c->point(Unit::SIZE / 4, Unit::SIZE);
$c->point(Unit::SIZE * (3/4), Unit::SIZE);
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// 2 triangles CENTER LEFT and RIGHT
if ($rank2 == 15) {
$c = new Primitive\Triangle();
$c->point(0, Unit::SIZE / 4);
$c->point(0, Unit::SIZE * (3/4));
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, Unit::SIZE / 4);
$c->point(Unit::SIZE, Unit::SIZE * (3/4));
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
} | php | protected function row2($rank2)
{
// Big triangle TL
if ($rank2 == 0) {
$c = new Primitive\Triangle();
$c->point(0, 0);
$c->point(Unit::SIZE, 0);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big triangle TR
if ($rank2 == 1) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, 0);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(0, 0);
$c->color($this->fg());
$this->add($c);
}
// Big triangle BR
if ($rank2 == 2) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, 0);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big triangle BL
if ($rank2 == 3) {
$c = new Primitive\Triangle();
$c->point(0, 0);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// triangle TL
if ($rank2 == 4) {
$c = new Primitive\Triangle();
$c->point(0, 0);
$c->point(Unit::SIZE / 2, 0);
$c->point(0, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// triangle TR
if ($rank2 == 5) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE / 2, 0);
$c->point(Unit::SIZE, Unit::SIZE / 2);
$c->point(Unit::SIZE, 0);
$c->color($this->fg());
$this->add($c);
}
// triangle BR
if ($rank2 == 6) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, Unit::SIZE / 2);
$c->point(Unit::SIZE, Unit::SIZE);
$c->point(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// triangle BL
if ($rank2 == 7) {
$c = new Primitive\Triangle();
$c->point(0, Unit::SIZE / 2);
$c->point(Unit::SIZE / 2, Unit::SIZE);
$c->point(0, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// 2 triangles TL BR
if ($rank2 == 8) {
$this->row2(4);
$this->row2(6);
}
// 2 triangles TR BL
if ($rank2 == 9) {
$this->row2(5);
$this->row2(7);
}
// 2 triangles TL TR
if ($rank2 == 10) {
$this->row2(4);
$this->row2(5);
}
// 2 triangles BL BR
if ($rank2 == 11) {
$this->row2(6);
$this->row2(7);
}
// 2 triangles TL BL
if ($rank2 == 12) {
$this->row2(4);
$this->row2(7);
}
// 2 triangles TR BR
if ($rank2 == 13) {
$this->row2(5);
$this->row2(6);
}
// 2 triangles CENTER TOP and BOTTOM
if ($rank2 == 14) {
$c = new Primitive\Triangle();
$c->point(Unit::SIZE / 4, 0);
$c->point(Unit::SIZE * (3/4), 0);
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Triangle();
$c->point(Unit::SIZE / 4, Unit::SIZE);
$c->point(Unit::SIZE * (3/4), Unit::SIZE);
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// 2 triangles CENTER LEFT and RIGHT
if ($rank2 == 15) {
$c = new Primitive\Triangle();
$c->point(0, Unit::SIZE / 4);
$c->point(0, Unit::SIZE * (3/4));
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Triangle();
$c->point(Unit::SIZE, Unit::SIZE / 4);
$c->point(Unit::SIZE, Unit::SIZE * (3/4));
$c->point(Unit::SIZE / 2, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
} | [
"protected",
"function",
"row2",
"(",
"$",
"rank2",
")",
"{",
"// Big triangle TL",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"c",
"=",
"new",
"Primitive",
"\\",
"Triangle",
"(",
")",
";",
"$",
"c",
"->",
"point",
"(",
"0",
",",
"0",
")"... | Selects one of the 16 shapes with triangles.
@param integer $rank2 Column index
@access protected
@return void | [
"Selects",
"one",
"of",
"the",
"16",
"shapes",
"with",
"triangles",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L547-L685 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row3 | public function row3($rank2)
{
// Big rectangle TOP
if ($rank2 == 0) {
$c = new Primitive\Rectangle();
$c->point(0, 0);
$c->size(Unit::SIZE, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle BOTTOM
if ($rank2 == 1) {
$c = new Primitive\Rectangle();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle LEFT
if ($rank2 == 2) {
$c = new Primitive\Rectangle();
$c->point(0, 0);
$c->size(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle RIGHT
if ($rank2 == 3) {
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, 0);
$c->size(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle MIDDLE
if ($rank2 == 4) {
$c = new Primitive\Rectangle();
$c->point(0, Unit::SIZE / 4);
$c->size(Unit::SIZE, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle MIDDLE HORIZONTALY
if ($rank2 == 5) {
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 4, 0);
$c->size(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Long rectangle DIAGONAL BL TR
if ($rank2 == 6) {
$c = new Primitive\Polygon();
$c->point((int) (Unit::SIZE * (3/4)), 0);
$c->point(Unit::SIZE, (int) (Unit::SIZE * (1/4)));
$c->point((int) (Unit::SIZE * (1/4)), Unit::SIZE);
$c->point(0, (int) (Unit::SIZE * (3/4)));
$c->color($this->fg());
$this->add($c);
}
// Long rectangle DIAGONAL TL BR
if ($rank2 == 7) {
$c = new Primitive\Polygon();
$c->point((int) (Unit::SIZE * (1/4)), 0);
$c->point(Unit::SIZE, (int) (Unit::SIZE * (3/4)));
$c->point((int) (Unit::SIZE * (3/4)), Unit::SIZE);
$c->point(0, (int) (Unit::SIZE * (1/4)));
$c->color($this->fg());
$this->add($c);
}
// medium BL
if ($rank2 == 8) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 2, self::SIZE / 4);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE / 4, self::SIZE);
$c->point(0, self::SIZE * (3/4));
$c->color($this->fg());
$this->add($c);
}
// medium TL
if ($rank2 == 9) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 4, 0);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE / 2, self::SIZE * (3/4));
$c->point(0, self::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// vertical grill of small rectangles
if ($rank2 == 10) {
$c = new Primitive\Rectangle();
$c
->point(0, self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 4, 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE * (3/4), 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
}
// vertical grill of small rectangles, other position
if ($rank2 == 11) {
$c = new Primitive\Rectangle();
$c
->point(0, 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 4, self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE * (3/4), self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
}
// horizontal grill of small rectngles
if ($rank2 == 12) {
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, 0)
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(0, self::SIZE / 4)
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, self::SIZE / 2)
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(0, self::SIZE * (3/4))
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
}
// horizontal grill of small rectngles, other position
if ($rank2 == 13) {
$c = new Primitive\Rectangle();
$c->point(0, 0)->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, Unit::SIZE / 4);
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, Unit::SIZE * (3/4));
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// small TL
if ($rank2 == 14) {
$c = new Primitive\Rectangle();
$c->point(0, 0)->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// small BR
if ($rank2 == 15) {
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, Unit::SIZE * (3/4));
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
} | php | public function row3($rank2)
{
// Big rectangle TOP
if ($rank2 == 0) {
$c = new Primitive\Rectangle();
$c->point(0, 0);
$c->size(Unit::SIZE, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle BOTTOM
if ($rank2 == 1) {
$c = new Primitive\Rectangle();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle LEFT
if ($rank2 == 2) {
$c = new Primitive\Rectangle();
$c->point(0, 0);
$c->size(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle RIGHT
if ($rank2 == 3) {
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, 0);
$c->size(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle MIDDLE
if ($rank2 == 4) {
$c = new Primitive\Rectangle();
$c->point(0, Unit::SIZE / 4);
$c->size(Unit::SIZE, Unit::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// Big rectangle MIDDLE HORIZONTALY
if ($rank2 == 5) {
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 4, 0);
$c->size(Unit::SIZE / 2, Unit::SIZE);
$c->color($this->fg());
$this->add($c);
}
// Long rectangle DIAGONAL BL TR
if ($rank2 == 6) {
$c = new Primitive\Polygon();
$c->point((int) (Unit::SIZE * (3/4)), 0);
$c->point(Unit::SIZE, (int) (Unit::SIZE * (1/4)));
$c->point((int) (Unit::SIZE * (1/4)), Unit::SIZE);
$c->point(0, (int) (Unit::SIZE * (3/4)));
$c->color($this->fg());
$this->add($c);
}
// Long rectangle DIAGONAL TL BR
if ($rank2 == 7) {
$c = new Primitive\Polygon();
$c->point((int) (Unit::SIZE * (1/4)), 0);
$c->point(Unit::SIZE, (int) (Unit::SIZE * (3/4)));
$c->point((int) (Unit::SIZE * (3/4)), Unit::SIZE);
$c->point(0, (int) (Unit::SIZE * (1/4)));
$c->color($this->fg());
$this->add($c);
}
// medium BL
if ($rank2 == 8) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 2, self::SIZE / 4);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE / 4, self::SIZE);
$c->point(0, self::SIZE * (3/4));
$c->color($this->fg());
$this->add($c);
}
// medium TL
if ($rank2 == 9) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 4, 0);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE / 2, self::SIZE * (3/4));
$c->point(0, self::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// vertical grill of small rectangles
if ($rank2 == 10) {
$c = new Primitive\Rectangle();
$c
->point(0, self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 4, 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE * (3/4), 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
}
// vertical grill of small rectangles, other position
if ($rank2 == 11) {
$c = new Primitive\Rectangle();
$c
->point(0, 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 4, self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, 0)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE * (3/4), self::SIZE / 2)
->size(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($c);
}
// horizontal grill of small rectngles
if ($rank2 == 12) {
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, 0)
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(0, self::SIZE / 4)
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(self::SIZE / 2, self::SIZE / 2)
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c
->point(0, self::SIZE * (3/4))
->size(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($c);
}
// horizontal grill of small rectngles, other position
if ($rank2 == 13) {
$c = new Primitive\Rectangle();
$c->point(0, 0)->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, Unit::SIZE / 4);
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c->point(0, Unit::SIZE / 2);
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, Unit::SIZE * (3/4));
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// small TL
if ($rank2 == 14) {
$c = new Primitive\Rectangle();
$c->point(0, 0)->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// small BR
if ($rank2 == 15) {
$c = new Primitive\Rectangle();
$c->point(Unit::SIZE / 2, Unit::SIZE * (3/4));
$c->size(Unit::SIZE / 2, Unit::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
} | [
"public",
"function",
"row3",
"(",
"$",
"rank2",
")",
"{",
"// Big rectangle TOP",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"c",
"=",
"new",
"Primitive",
"\\",
"Rectangle",
"(",
")",
";",
"$",
"c",
"->",
"point",
"(",
"0",
",",
"0",
")"... | Selects one of the 16 units using rectangles
@param integer $rank2 Column index
@access public
@return void | [
"Selects",
"one",
"of",
"the",
"16",
"units",
"using",
"rectangles"
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L694-L928 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row4 | protected function row4($rank2)
{
// Mid sizes TL
if ($rank2 == 0) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
// Mid sizes TR
if ($rank2 == 1) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
// Mid sizes BR
if ($rank2 == 2) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
// Mid sizes BL
if ($rank2 == 3) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 4) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 5) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 6) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 7) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 8) {
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 2);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 9) {
$this->row1(1);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 2);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 10) {
$this->row4(8);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 4);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 11) {
$this->row4(9);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 12) {
$this->row4(10);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 8);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 13) {
$this->row4(11);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 14) {
$this->row4(0);
$this->row4(2);
}
if ($rank2 == 15) {
$this->row4(1);
$this->row4(3);
}
} | php | protected function row4($rank2)
{
// Mid sizes TL
if ($rank2 == 0) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
// Mid sizes TR
if ($rank2 == 1) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
// Mid sizes BR
if ($rank2 == 2) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
// Mid sizes BL
if ($rank2 == 3) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 4) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 5) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 6) {
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 7) {
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
$el = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 8) {
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 2);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 9) {
$this->row1(1);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 2);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 10) {
$this->row4(8);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 4);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 11) {
$this->row4(9);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 4);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 12) {
$this->row4(10);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 8);
$el->color($this->fg());
$this->add($el);
}
if ($rank2 == 13) {
$this->row4(11);
$el = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$el->radius(self::SIZE / 8);
$el->color($this->bg());
$this->add($el);
}
if ($rank2 == 14) {
$this->row4(0);
$this->row4(2);
}
if ($rank2 == 15) {
$this->row4(1);
$this->row4(3);
}
} | [
"protected",
"function",
"row4",
"(",
"$",
"rank2",
")",
"{",
"// Mid sizes TL",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"el",
"=",
"new",
"Primitive",
"\\",
"Ellipse",
"(",
"self",
"::",
"SIZE",
"/",
"4",
",",
"self",
"::",
"SIZE",
"/",... | Select one of the 16 units with circles
@param integer $rank2 Column index
@return void | [
"Select",
"one",
"of",
"the",
"16",
"units",
"with",
"circles"
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L936-L1056 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row5 | public function row5($rank2)
{
// "squared" arrow TL
if ($rank2 == 0) {
$c = new Primitive\Polygon();
$c->point(0, 0);
$c->point(self::SIZE / 2, 0);
$c->point(self::SIZE / 2, self::SIZE / 4);
$c->point(self::SIZE * (3/4), self::SIZE * (3/4));
$c->point(self::SIZE / 4, self::SIZE / 2);
$c->point(0, self::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// "squared" arrow TR
if ($rank2 == 1) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 2, 0);
$c->point(self::SIZE, 0);
$c->point(self::SIZE, self::SIZE / 2);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE / 4, self::SIZE * (3/4));
$c->point(self::SIZE / 2, self::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// "squared" arrow BR
if ($rank2 == 2) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 4, self::SIZE / 4);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE, self::SIZE / 2);
$c->point(self::SIZE, self::SIZE);
$c->point(self::SIZE / 2, self::SIZE);
$c->point(self::SIZE / 2, self::SIZE * (3/4));
$c->color($this->fg());
$this->add($c);
}
// "squared" arrow BL
if ($rank2 == 3) {
$c = new Primitive\Polygon();
$c->point(0, self::SIZE / 2);
$c->point(self::SIZE / 4, self::SIZE / 2);
$c->point(self::SIZE *(3/4), self::SIZE / 4);
$c->point(self::SIZE / 2, self::SIZE * (3/4));
$c->point(self::SIZE / 2, self::SIZE);
$c->point(0, self::SIZE);
$c->color($this->fg());
$this->add($c);
}
// same as row5 for 0
if ($rank2 == 4) {
$this->row1(1);
$this->row5(0);
$this->last()->color($this->bg());
}
// same as row5 for 1
if ($rank2 == 5) {
$this->row1(1);
$this->row5(1);
$this->last()->color($this->bg());
}
// same as row5 for 2
if ($rank2 == 6) {
$this->row1(1);
$this->row5(2);
$this->last()->color($this->bg());
}
// same as row5 for 3
if ($rank2 == 7) {
$this->row1(1);
$this->row5(3);
$this->last()->color($this->bg());
}
// 4 sides shape TL
if ($rank2 == 8) {
$c = new Primitive\Polygon();
$c->point(0, 0);
$c->point(self::SIZE / 2, 0);
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->point(0, self::SIZE * (3/4));
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 9) {
$this->row1(1);
$this->row5(8);
$this->last()->color($this->bg());
}
// 4 sides shape TR
if ($rank2 == 10) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 4, 0);
$c->point(self::SIZE, 0);
$c->point(self::SIZE, self::SIZE / 2);
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 11) {
$this->row1(1);
$this->row5(10);
$this->last()->color($this->bg());
}
// 4 sides shape BR
if ($rank2 == 12) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->point(self::SIZE, self::SIZE / 4);
$c->point(self::SIZE, self::SIZE);
$c->point(self::SIZE / 2, self::SIZE);
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 13) {
$this->row1(1);
$this->row5(12);
$this->last()->color($this->bg());
}
// 4 sides shape BL
if ($rank2 == 14) {
$c = new Primitive\Polygon();
$c->point(0, self::SIZE / 2);
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->point(self::SIZE * (3/4), self::SIZE);
$c->point(0, self::SIZE);
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 15) {
$this->row1(1);
$this->row5(14);
$this->last()->color($this->bg());
}
} | php | public function row5($rank2)
{
// "squared" arrow TL
if ($rank2 == 0) {
$c = new Primitive\Polygon();
$c->point(0, 0);
$c->point(self::SIZE / 2, 0);
$c->point(self::SIZE / 2, self::SIZE / 4);
$c->point(self::SIZE * (3/4), self::SIZE * (3/4));
$c->point(self::SIZE / 4, self::SIZE / 2);
$c->point(0, self::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// "squared" arrow TR
if ($rank2 == 1) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 2, 0);
$c->point(self::SIZE, 0);
$c->point(self::SIZE, self::SIZE / 2);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE / 4, self::SIZE * (3/4));
$c->point(self::SIZE / 2, self::SIZE / 4);
$c->color($this->fg());
$this->add($c);
}
// "squared" arrow BR
if ($rank2 == 2) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 4, self::SIZE / 4);
$c->point(self::SIZE * (3/4), self::SIZE / 2);
$c->point(self::SIZE, self::SIZE / 2);
$c->point(self::SIZE, self::SIZE);
$c->point(self::SIZE / 2, self::SIZE);
$c->point(self::SIZE / 2, self::SIZE * (3/4));
$c->color($this->fg());
$this->add($c);
}
// "squared" arrow BL
if ($rank2 == 3) {
$c = new Primitive\Polygon();
$c->point(0, self::SIZE / 2);
$c->point(self::SIZE / 4, self::SIZE / 2);
$c->point(self::SIZE *(3/4), self::SIZE / 4);
$c->point(self::SIZE / 2, self::SIZE * (3/4));
$c->point(self::SIZE / 2, self::SIZE);
$c->point(0, self::SIZE);
$c->color($this->fg());
$this->add($c);
}
// same as row5 for 0
if ($rank2 == 4) {
$this->row1(1);
$this->row5(0);
$this->last()->color($this->bg());
}
// same as row5 for 1
if ($rank2 == 5) {
$this->row1(1);
$this->row5(1);
$this->last()->color($this->bg());
}
// same as row5 for 2
if ($rank2 == 6) {
$this->row1(1);
$this->row5(2);
$this->last()->color($this->bg());
}
// same as row5 for 3
if ($rank2 == 7) {
$this->row1(1);
$this->row5(3);
$this->last()->color($this->bg());
}
// 4 sides shape TL
if ($rank2 == 8) {
$c = new Primitive\Polygon();
$c->point(0, 0);
$c->point(self::SIZE / 2, 0);
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->point(0, self::SIZE * (3/4));
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 9) {
$this->row1(1);
$this->row5(8);
$this->last()->color($this->bg());
}
// 4 sides shape TR
if ($rank2 == 10) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 4, 0);
$c->point(self::SIZE, 0);
$c->point(self::SIZE, self::SIZE / 2);
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 11) {
$this->row1(1);
$this->row5(10);
$this->last()->color($this->bg());
}
// 4 sides shape BR
if ($rank2 == 12) {
$c = new Primitive\Polygon();
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->point(self::SIZE, self::SIZE / 4);
$c->point(self::SIZE, self::SIZE);
$c->point(self::SIZE / 2, self::SIZE);
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 13) {
$this->row1(1);
$this->row5(12);
$this->last()->color($this->bg());
}
// 4 sides shape BL
if ($rank2 == 14) {
$c = new Primitive\Polygon();
$c->point(0, self::SIZE / 2);
$c->point(self::SIZE / 2, self::SIZE / 2);
$c->point(self::SIZE * (3/4), self::SIZE);
$c->point(0, self::SIZE);
$c->color($this->fg());
$this->add($c);
}
// same as previous, in reversed colors
if ($rank2 == 15) {
$this->row1(1);
$this->row5(14);
$this->last()->color($this->bg());
}
} | [
"public",
"function",
"row5",
"(",
"$",
"rank2",
")",
"{",
"// \"squared\" arrow TL",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"c",
"=",
"new",
"Primitive",
"\\",
"Polygon",
"(",
")",
";",
"$",
"c",
"->",
"point",
"(",
"0",
",",
"0",
")... | Select one of 16 units containing various polygons shapes.
@param integer $rank2 Column index
@access public
@return void | [
"Select",
"one",
"of",
"16",
"units",
"containing",
"various",
"polygons",
"shapes",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L1065-L1203 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row6 | public function row6($rank2)
{
// Big long triangle LEFT
if ($rank2 == 0) {
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, self::SIZE);
$t->point(0 , self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// Big long triangle TOP
if ($rank2 == 1) {
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE, 0);
$t->point(0 , self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
}
// Big long triangle RIGHT
if ($rank2 == 2) {
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE, 0);
$t->point(self::SIZE , self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// Big long triangle BOTTOM
if ($rank2 == 3) {
$t = new Primitive\Triangle();
$t->point(self::SIZE, self::SIZE / 2);
$t->point(self::SIZE, self::SIZE);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// Same as 0, reversed colors
if ($rank2 == 4) {
$this->row1(1);
$this->row6(0);
$this->last()->color($this->bg());
}
// Same as 1, reversed colors
if ($rank2 == 5) {
$this->row1(1);
$this->row6(1);
$this->last()->color($this->bg());
}
// Same as 2, reversed colors
if ($rank2 == 6) {
$this->row1(1);
$this->row6(2);
$this->last()->color($this->bg());
}
// Same as 3, reversed colors
if ($rank2 == 7) {
$this->row1(1);
$this->row6(3);
$this->last()->color($this->bg());
}
// 2 long triangles LEFT
if ($rank2 == 8) {
$this->row6(0);
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE, self::SIZE);
$t->point(self::SIZE / 2, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 long triangles TOP
if ($rank2 == 9) {
$this->row6(1);
$t = new Primitive\Triangle();
$t->point(0, self::SIZE / 2);
$t->point(self::SIZE, self::SIZE / 2);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 long triangles RIGHT
if ($rank2 == 10) {
$this->row6(2);
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE / 2, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 long triangles BOTTOM
if ($rank2 == 11) {
$this->row6(3);
$t = new Primitive\Triangle();
$t->point(0, self::SIZE / 2);
$t->point(self::SIZE, 0);
$t->point(self::SIZE, self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
}
// 2 long crossed triangles
if ($rank2 == 12) {
$t = new Primitive\Triangle();
$t->point(0, self::SIZE / 2);
$t->point(self::SIZE, 0);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE, self::SIZE / 2);
$t->point(self::SIZE, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 big flat triangles
if ($rank2 == 13) {
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, self::SIZE / 2);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE, self::SIZE / 2);
$t->point(self::SIZE / 2, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 4 triangle in cross
if ($rank2 == 14) {
//TL
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, self::SIZE / 4);
$t->point(self::SIZE / 4, self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
//TR
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, self::SIZE / 4);
$t->point(self::SIZE, 0);
$t->point(self::SIZE *(3/4), self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
//BR
$t = new Primitive\Triangle();
$t->point(self::SIZE * (3/4), self::SIZE / 2);
$t->point(self::SIZE, self::SIZE);
$t->point(self::SIZE / 2, self::SIZE * (3/4));
$t->color($this->fg());
$this->add($t);
//BL
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, self::SIZE * (3/4));
$t->point(0, self::SIZE);
$t->point(self::SIZE / 4, self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
}
// Same as previous, but reversed
if ($rank2 == 15) {
$this->row1(1);
$this->row6(14);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->bg());
$this->get(3)->color($this->bg());
$this->get(4)->color($this->bg());
}
} | php | public function row6($rank2)
{
// Big long triangle LEFT
if ($rank2 == 0) {
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, self::SIZE);
$t->point(0 , self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// Big long triangle TOP
if ($rank2 == 1) {
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE, 0);
$t->point(0 , self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
}
// Big long triangle RIGHT
if ($rank2 == 2) {
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE, 0);
$t->point(self::SIZE , self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// Big long triangle BOTTOM
if ($rank2 == 3) {
$t = new Primitive\Triangle();
$t->point(self::SIZE, self::SIZE / 2);
$t->point(self::SIZE, self::SIZE);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// Same as 0, reversed colors
if ($rank2 == 4) {
$this->row1(1);
$this->row6(0);
$this->last()->color($this->bg());
}
// Same as 1, reversed colors
if ($rank2 == 5) {
$this->row1(1);
$this->row6(1);
$this->last()->color($this->bg());
}
// Same as 2, reversed colors
if ($rank2 == 6) {
$this->row1(1);
$this->row6(2);
$this->last()->color($this->bg());
}
// Same as 3, reversed colors
if ($rank2 == 7) {
$this->row1(1);
$this->row6(3);
$this->last()->color($this->bg());
}
// 2 long triangles LEFT
if ($rank2 == 8) {
$this->row6(0);
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE, self::SIZE);
$t->point(self::SIZE / 2, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 long triangles TOP
if ($rank2 == 9) {
$this->row6(1);
$t = new Primitive\Triangle();
$t->point(0, self::SIZE / 2);
$t->point(self::SIZE, self::SIZE / 2);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 long triangles RIGHT
if ($rank2 == 10) {
$this->row6(2);
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE / 2, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 long triangles BOTTOM
if ($rank2 == 11) {
$this->row6(3);
$t = new Primitive\Triangle();
$t->point(0, self::SIZE / 2);
$t->point(self::SIZE, 0);
$t->point(self::SIZE, self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
}
// 2 long crossed triangles
if ($rank2 == 12) {
$t = new Primitive\Triangle();
$t->point(0, self::SIZE / 2);
$t->point(self::SIZE, 0);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE, self::SIZE / 2);
$t->point(self::SIZE, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 2 big flat triangles
if ($rank2 == 13) {
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, self::SIZE / 2);
$t->point(0, self::SIZE);
$t->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, 0);
$t->point(self::SIZE, self::SIZE / 2);
$t->point(self::SIZE / 2, self::SIZE);
$t->color($this->fg());
$this->add($t);
}
// 4 triangle in cross
if ($rank2 == 14) {
//TL
$t = new Primitive\Triangle();
$t->point(0, 0);
$t->point(self::SIZE / 2, self::SIZE / 4);
$t->point(self::SIZE / 4, self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
//TR
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, self::SIZE / 4);
$t->point(self::SIZE, 0);
$t->point(self::SIZE *(3/4), self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
//BR
$t = new Primitive\Triangle();
$t->point(self::SIZE * (3/4), self::SIZE / 2);
$t->point(self::SIZE, self::SIZE);
$t->point(self::SIZE / 2, self::SIZE * (3/4));
$t->color($this->fg());
$this->add($t);
//BL
$t = new Primitive\Triangle();
$t->point(self::SIZE / 2, self::SIZE * (3/4));
$t->point(0, self::SIZE);
$t->point(self::SIZE / 4, self::SIZE / 2);
$t->color($this->fg());
$this->add($t);
}
// Same as previous, but reversed
if ($rank2 == 15) {
$this->row1(1);
$this->row6(14);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->bg());
$this->get(3)->color($this->bg());
$this->get(4)->color($this->bg());
}
} | [
"public",
"function",
"row6",
"(",
"$",
"rank2",
")",
"{",
"// Big long triangle LEFT",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"t",
"=",
"new",
"Primitive",
"\\",
"Triangle",
"(",
")",
";",
"$",
"t",
"->",
"point",
"(",
"0",
",",
"0",
... | Selects one unit from 16 with various triangle shapes.
@param integer $rank2 Column index
@access public
@return void | [
"Selects",
"one",
"unit",
"from",
"16",
"with",
"various",
"triangle",
"shapes",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L1212-L1385 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row7 | public function row7($rank2)
{
// Circle inside other TOP
if ($rank2 == 0) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 4);
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous bu reversed
if ($rank2 == 1) {
$this->row1(1);
$this->row7(0);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
// Circle inside other RIGHT
if ($rank2 == 2) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 2);
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous but reversed
if ($rank2 == 3) {
$this->row1(1);
$this->row7(2);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
// Circle inside other BOTTOM
if ($rank2 == 4) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE /2, self::SIZE * (3/4));
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous but reversed
if ($rank2 == 5) {
$this->row1(1);
$this->row7(4);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
// Circle inside other LEFT
if ($rank2 == 6) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 2);
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous but reversed
if ($rank2 == 7) {
$this->row1(1);
$this->row7(6);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
if ($rank2 == 8) {
// Moyen central
$c = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite TL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite TR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite BR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite BL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
}
// same as previous but with central as negative
if ($rank2 == 9) {
$this->row7(8);
$this->add($this->get(0)->color($this->bg()));
}
// same as 8, but satellites in negative
if ($rank2 == 10) {
$this->row7(8);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->bg());
$this->get(3)->color($this->bg());
$this->get(4)->color($this->bg());
}
// Same as 8 with inside additionnal circles
if ($rank2 == 11) {
$this->row7(8);
// small at center
$c = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite TL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite TR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite BR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite BL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
}
if ($rank2 == 12) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(0, self::SIZE / 2)->size(self::SIZE, self::SIZE / 2);
$s->color($this->bg());
$this->add($s);
}
if ($rank2 == 13) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(0, 0)->size(self::SIZE, self::SIZE / 2);
$s->color($this->bg());
$this->add($s);
}
if ($rank2 == 14) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(0, 0)->size(self::SIZE / 2, self::SIZE);
$s->color($this->bg());
$this->add($s);
}
if ($rank2 == 15) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(self::SIZE / 2, 0)->size(self::SIZE / 2, self::SIZE);
$s->color($this->bg());
$this->add($s);
}
} | php | public function row7($rank2)
{
// Circle inside other TOP
if ($rank2 == 0) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 4);
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous bu reversed
if ($rank2 == 1) {
$this->row1(1);
$this->row7(0);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
// Circle inside other RIGHT
if ($rank2 == 2) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 2);
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous but reversed
if ($rank2 == 3) {
$this->row1(1);
$this->row7(2);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
// Circle inside other BOTTOM
if ($rank2 == 4) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE /2, self::SIZE * (3/4));
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous but reversed
if ($rank2 == 5) {
$this->row1(1);
$this->row7(4);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
// Circle inside other LEFT
if ($rank2 == 6) {
$this->row4(8);
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 2);
$c->radius(self::SIZE / 4)->color($this->bg());
$this->add($c);
}
// Same as previous but reversed
if ($rank2 == 7) {
$this->row1(1);
$this->row7(6);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->fg());
}
if ($rank2 == 8) {
// Moyen central
$c = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite TL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite TR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite BR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
//satellite BL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$c->radius(self::SIZE / 4)->color($this->fg());
$this->add($c);
}
// same as previous but with central as negative
if ($rank2 == 9) {
$this->row7(8);
$this->add($this->get(0)->color($this->bg()));
}
// same as 8, but satellites in negative
if ($rank2 == 10) {
$this->row7(8);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->bg());
$this->get(3)->color($this->bg());
$this->get(4)->color($this->bg());
}
// Same as 8 with inside additionnal circles
if ($rank2 == 11) {
$this->row7(8);
// small at center
$c = new Primitive\Ellipse(self::SIZE / 2, self::SIZE / 2);
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite TL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE / 4);
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite TR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE / 4);
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite BR
$c = new Primitive\Ellipse(self::SIZE * (3/4), self::SIZE * (3/4));
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
//satellite BL
$c = new Primitive\Ellipse(self::SIZE / 4, self::SIZE * (3/4));
$c->radius(self::SIZE / 8)->color($this->bg());
$this->add($c);
}
if ($rank2 == 12) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(0, self::SIZE / 2)->size(self::SIZE, self::SIZE / 2);
$s->color($this->bg());
$this->add($s);
}
if ($rank2 == 13) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(0, 0)->size(self::SIZE, self::SIZE / 2);
$s->color($this->bg());
$this->add($s);
}
if ($rank2 == 14) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(0, 0)->size(self::SIZE / 2, self::SIZE);
$s->color($this->bg());
$this->add($s);
}
if ($rank2 == 15) {
$this->row4(8);
$s = new Primitive\Rectangle();
$s->point(self::SIZE / 2, 0)->size(self::SIZE / 2, self::SIZE);
$s->color($this->bg());
$this->add($s);
}
} | [
"public",
"function",
"row7",
"(",
"$",
"rank2",
")",
"{",
"// Circle inside other TOP",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"row4",
"(",
"8",
")",
";",
"$",
"c",
"=",
"new",
"Primitive",
"\\",
"Ellipse",
"(",
"self",
"... | Select one unit from 16 containing circle shapes.
@param integer $rank2 Column index
@access public
@return void | [
"Select",
"one",
"unit",
"from",
"16",
"containing",
"circle",
"shapes",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L1394-L1539 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row8 | public function row8($rank2)
{
// big diamond
if ($rank2 == 0) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, 0)
->point(self::SIZE, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE)
->point(0, self::SIZE / 2)
->color($this->fg());
$this->add($d);
}
// small TL
if ($rank2 == 1) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 4, 0)
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE / 4, self::SIZE / 2)
->point(0, self::SIZE / 4)
->color($this->fg());
$this->add($d);
}
// small TR
if ($rank2 == 2) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE * (3/4), 0)
->point(self::SIZE, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($d);
}
// small BR
if ($rank2 == 3) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE * (3/4))
->point(self::SIZE * (3/4), self::SIZE)
->point(self::SIZE / 2, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// small BL
if ($rank2 == 4) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 4, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE)
->point(0, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// Small CENTER
if ($rank2 == 5) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($d);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE * (3/8))
->point(self::SIZE * (5/8), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (5/8))
->point(self::SIZE * (3/8), self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
// reversed small TL
if ($rank2 == 6) {
$this->row1(1);
$this->row8(1);
$this->last()->color($this->bg());
}
// reversed small TR
if ($rank2 == 7) {
$this->row1(1);
$this->row8(2);
$this->last()->color($this->bg());
}
// reversed small BR
if ($rank2 == 8) {
$this->row1(1);
$this->row8(3);
$this->last()->color($this->bg());
}
// reversed small BL
if ($rank2 == 9) {
$this->row1(1);
$this->row8(4);
$this->last()->color($this->bg());
}
// Big and center reversed
if ($rank2 == 10) {
$this->row8(0);
$this->row13(0);
$this->last()->color($this->bg());
}
// Long VERTICAL CENTER
if ($rank2 == 11) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, 0)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($d);
}
// Long HORIZONTAL CENTER
if ($rank2 == 12) {
$d = new Primitive\Diamond();
$d
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// Long DIAGONAL TL BR
if ($rank2 == 13) {
$d = new Primitive\Diamond();
$d
->point(0, 0)
->point(self::SIZE * (3/4), self::SIZE / 4)
->point(self::SIZE, self::SIZE)
->point(self::SIZE / 4, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// Long DIAGONAL TR BL
if ($rank2 == 14) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 4, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE *(3/4), self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($d);
}
// 4 littles
if ($rank2 == 15) {
$this->row8(1);
$this->row8(2);
$this->row8(3);
$this->row8(4);
}
} | php | public function row8($rank2)
{
// big diamond
if ($rank2 == 0) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, 0)
->point(self::SIZE, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE)
->point(0, self::SIZE / 2)
->color($this->fg());
$this->add($d);
}
// small TL
if ($rank2 == 1) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 4, 0)
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE / 4, self::SIZE / 2)
->point(0, self::SIZE / 4)
->color($this->fg());
$this->add($d);
}
// small TR
if ($rank2 == 2) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE * (3/4), 0)
->point(self::SIZE, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE / 4)
->color($this->fg());
$this->add($d);
}
// small BR
if ($rank2 == 3) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE * (3/4))
->point(self::SIZE * (3/4), self::SIZE)
->point(self::SIZE / 2, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// small BL
if ($rank2 == 4) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 4, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE)
->point(0, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// Small CENTER
if ($rank2 == 5) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($d);
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, self::SIZE * (3/8))
->point(self::SIZE * (5/8), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (5/8))
->point(self::SIZE * (3/8), self::SIZE / 2)
->color($this->bg());
$this->add($d);
}
// reversed small TL
if ($rank2 == 6) {
$this->row1(1);
$this->row8(1);
$this->last()->color($this->bg());
}
// reversed small TR
if ($rank2 == 7) {
$this->row1(1);
$this->row8(2);
$this->last()->color($this->bg());
}
// reversed small BR
if ($rank2 == 8) {
$this->row1(1);
$this->row8(3);
$this->last()->color($this->bg());
}
// reversed small BL
if ($rank2 == 9) {
$this->row1(1);
$this->row8(4);
$this->last()->color($this->bg());
}
// Big and center reversed
if ($rank2 == 10) {
$this->row8(0);
$this->row13(0);
$this->last()->color($this->bg());
}
// Long VERTICAL CENTER
if ($rank2 == 11) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 2, 0)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($d);
}
// Long HORIZONTAL CENTER
if ($rank2 == 12) {
$d = new Primitive\Diamond();
$d
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// Long DIAGONAL TL BR
if ($rank2 == 13) {
$d = new Primitive\Diamond();
$d
->point(0, 0)
->point(self::SIZE * (3/4), self::SIZE / 4)
->point(self::SIZE, self::SIZE)
->point(self::SIZE / 4, self::SIZE * (3/4))
->color($this->fg());
$this->add($d);
}
// Long DIAGONAL TR BL
if ($rank2 == 14) {
$d = new Primitive\Diamond();
$d
->point(self::SIZE / 4, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE *(3/4), self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($d);
}
// 4 littles
if ($rank2 == 15) {
$this->row8(1);
$this->row8(2);
$this->row8(3);
$this->row8(4);
}
} | [
"public",
"function",
"row8",
"(",
"$",
"rank2",
")",
"{",
"// big diamond",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"d",
"=",
"new",
"Primitive",
"\\",
"Diamond",
"(",
")",
";",
"$",
"d",
"->",
"point",
"(",
"self",
"::",
"SIZE",
"/",... | Various diamond shapes
@param integer $rank2 Column index
@access public
@return void | [
"Various",
"diamond",
"shapes"
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L1548-L1732 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.row10 | public function row10($rank2)
{
if ($rank2 == 0) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE / 2, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 1) {
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 2) {
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, 0)
->point(self::SIZE, self::SIZE / 2)
->point(0, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 3) {
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 4) {
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 5) {
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE / 2, self::SIZE * (3/4))
->color($this->fg());
$this->add($p);
}
if ($rank2 == 6) {
$p = new Primitive\Polygon();
$p
->point(0, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 4, self::SIZE / 2)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 7) {
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 2)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 8) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 9) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 10) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 11) {
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, 0)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE * (3/4), self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE * (3/4))
->color($this->bg());
$this->add($t);
}
if ($rank2 == 12) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE, self::SIZE / 2)
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 4, self::SIZE / 4)
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE / 4, self::SIZE * (3/4))
->color($this->bg());
$this->add($t);
}
if ($rank2 == 13) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 4, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 4)
->point(self::SIZE / 2, self::SIZE / 2)
->color($this->bg());
$this->add($t);
}
if ($rank2 == 14) {
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE * (3/4), self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE * (3/4))
->point(self::SIZE / 2, self::SIZE / 2)
->color($this->bg());
$this->add($t);
}
if ($rank2 == 15) {
$this->row1(1);
$this->row6(12);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->bg());
}
} | php | public function row10($rank2)
{
if ($rank2 == 0) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE / 2, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 1) {
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 2) {
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, 0)
->point(self::SIZE, self::SIZE / 2)
->point(0, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 3) {
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 4) {
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(0, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 5) {
$p = new Primitive\Polygon();
$p
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE / 2, self::SIZE * (3/4))
->color($this->fg());
$this->add($p);
}
if ($rank2 == 6) {
$p = new Primitive\Polygon();
$p
->point(0, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE / 4, self::SIZE / 2)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($p);
}
if ($rank2 == 7) {
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 2)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 8) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE)
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 9) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE / 2, self::SIZE * (3/4))
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 10) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE / 2, 0)
->point(self::SIZE / 4, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 4)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE / 2)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE * (3/4), self::SIZE / 2)
->point(self::SIZE, self::SIZE)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
}
if ($rank2 == 11) {
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, 0)
->point(self::SIZE, self::SIZE)
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE * (3/4), self::SIZE * (3/4))
->point(self::SIZE / 4, self::SIZE * (3/4))
->color($this->bg());
$this->add($t);
}
if ($rank2 == 12) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE, self::SIZE / 2)
->point(0, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 4, self::SIZE / 4)
->point(self::SIZE / 2, self::SIZE / 2)
->point(self::SIZE / 4, self::SIZE * (3/4))
->color($this->bg());
$this->add($t);
}
if ($rank2 == 13) {
$t = new Primitive\Triangle();
$t
->point(0, 0)
->point(self::SIZE, 0)
->point(self::SIZE / 2, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE / 4, self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE / 4)
->point(self::SIZE / 2, self::SIZE / 2)
->color($this->bg());
$this->add($t);
}
if ($rank2 == 14) {
$t = new Primitive\Triangle();
$t
->point(0, self::SIZE / 2)
->point(self::SIZE, 0)
->point(self::SIZE, self::SIZE)
->color($this->fg());
$this->add($t);
$t = new Primitive\Triangle();
$t
->point(self::SIZE * (3/4), self::SIZE / 4)
->point(self::SIZE * (3/4), self::SIZE * (3/4))
->point(self::SIZE / 2, self::SIZE / 2)
->color($this->bg());
$this->add($t);
}
if ($rank2 == 15) {
$this->row1(1);
$this->row6(12);
$this->get(1)->color($this->bg());
$this->get(2)->color($this->bg());
}
} | [
"public",
"function",
"row10",
"(",
"$",
"rank2",
")",
"{",
"if",
"(",
"$",
"rank2",
"==",
"0",
")",
"{",
"$",
"t",
"=",
"new",
"Primitive",
"\\",
"Triangle",
"(",
")",
";",
"$",
"t",
"->",
"point",
"(",
"0",
",",
"0",
")",
"->",
"point",
"("... | Select one unit of triangle shapes.
@param integer $rank2 Column index
@access public
@return void | [
"Select",
"one",
"unit",
"of",
"triangle",
"shapes",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L1907-L2209 |
malenkiki/aleavatar | src/Malenki/Aleavatar/Unit.php | Unit.generate | public function generate($rank1, $rank2)
{
$str_method_name = 'row' . $rank1;
if (method_exists($this,$str_method_name)) {
$this->$str_method_name($rank2);
} else {
throw new \RuntimeException('Not implemented yet!');
}
return $this;
} | php | public function generate($rank1, $rank2)
{
$str_method_name = 'row' . $rank1;
if (method_exists($this,$str_method_name)) {
$this->$str_method_name($rank2);
} else {
throw new \RuntimeException('Not implemented yet!');
}
return $this;
} | [
"public",
"function",
"generate",
"(",
"$",
"rank1",
",",
"$",
"rank2",
")",
"{",
"$",
"str_method_name",
"=",
"'row'",
".",
"$",
"rank1",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"str_method_name",
")",
")",
"{",
"$",
"this",
"->... | Generates unit part by giving row index and column index to
choose the shapes to populate with.
Parameters are both integers from 0 to 15 inclusive.
@uses Unit::row0 Various shapes DONE
@uses Unit::row1 Square shapes DONE
@uses Unit::row2 Triangle shapes DONE
@uses Unit::row3 Rectangle shapes DONE
@uses Unit::row4 Circle shapes DONE
@uses Unit::row5 Polygon shapes DONE
@uses Unit::row6 Triangle shapes part 2 DONE
@uses Unit::row7 Circle shapes part 2 DONE
@uses Unit::row8 Diamond shapes 1 DONE
@uses Unit::row9 Polygon shapes part 2 DONE
@uses Unit::row10 Triangle shapes part 3 DONE
@uses Unit::row11 Polygon shapes part 3 DONE
@uses Unit::row12 Polygon shapes part 4 DONE
@uses Unit::row13 Mixed shapes part 1
@uses Unit::row14 Mixed shapes part 2
@uses Unit::row15 Mixed shapes part 3
@param integer $rank1
@param inteer $rank2
@access public
@return Unit | [
"Generates",
"unit",
"part",
"by",
"giving",
"row",
"index",
"and",
"column",
"index",
"to",
"choose",
"the",
"shapes",
"to",
"populate",
"with",
"."
] | train | https://github.com/malenkiki/aleavatar/blob/91affa83f8580c8e6da62c77ce34b1c4451784bf/src/Malenki/Aleavatar/Unit.php#L2931-L2941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.