id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14,500 | jasny/router | src/Router/Middleware/ErrorPage.php | ErrorPage.getErrorRoute | protected function getErrorRoute(ServerRequestInterface $request, ResponseInterface $response)
{
if (
interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface
) {
$request = $request->withoutGlobalEnvironme... | php | protected function getErrorRoute(ServerRequestInterface $request, ResponseInterface $response)
{
if (
interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface
) {
$request = $request->withoutGlobalEnvironme... | [
"protected",
"function",
"getErrorRoute",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"interface_exists",
"(",
"'Jasny\\HttpMessage\\GlobalEnvironmentInterface'",
")",
"&&",
"$",
"request",
"instanceof",
... | Get the route to the error page
@param ServerRequestInterface $request
@param ResponseInterface $response
@return Router\Route | [
"Get",
"the",
"route",
"to",
"the",
"error",
"page"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Middleware/ErrorPage.php#L84-L101 |
14,501 | jasny/router | src/Router/Middleware/ErrorPage.php | ErrorPage.routeToErrorPage | protected function routeToErrorPage(ServerRequestInterface $request, ResponseInterface $response)
{
$errorRoute = $this->getErrorRoute($request, $response);
if (!isset($errorRoute)) {
return $response;
}
$runner = $this->router->getRunner();
... | php | protected function routeToErrorPage(ServerRequestInterface $request, ResponseInterface $response)
{
$errorRoute = $this->getErrorRoute($request, $response);
if (!isset($errorRoute)) {
return $response;
}
$runner = $this->router->getRunner();
... | [
"protected",
"function",
"routeToErrorPage",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"errorRoute",
"=",
"$",
"this",
"->",
"getErrorRoute",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"i... | Route to the error page
@param ServerRequestInterface $request
@param ResponseInterface $response
@return ResponseInterface | [
"Route",
"to",
"the",
"error",
"page"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Middleware/ErrorPage.php#L110-L121 |
14,502 | paulzi/multicurl | MultiCurlQueue.php | MultiCurlQueue.processNext | protected function processNext()
{
foreach ($this->_status as $i => $status) {
if ($status === false && ($request = array_shift($this->_queue)) !== null) {
$this->_status[$i] = $request;
$this->_retries[$i] = 0;
$this->add($request);
}... | php | protected function processNext()
{
foreach ($this->_status as $i => $status) {
if ($status === false && ($request = array_shift($this->_queue)) !== null) {
$this->_status[$i] = $request;
$this->_retries[$i] = 0;
$this->add($request);
}... | [
"protected",
"function",
"processNext",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_status",
"as",
"$",
"i",
"=>",
"$",
"status",
")",
"{",
"if",
"(",
"$",
"status",
"===",
"false",
"&&",
"(",
"$",
"request",
"=",
"array_shift",
"(",
"$",
"... | Execute free threads | [
"Execute",
"free",
"threads"
] | 2e326d868add238bb2820f3271e235bfed12e5cb | https://github.com/paulzi/multicurl/blob/2e326d868add238bb2820f3271e235bfed12e5cb/MultiCurlQueue.php#L58-L67 |
14,503 | BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.addHeader | public function addHeader($add, $dca)
{
$catId = $add['id'];
unset($add['id']); //delete the helper
$sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
,count(id) AS numbers
FROM `tl_banner`
WHERE `pid`=?
... | php | public function addHeader($add, $dca)
{
$catId = $add['id'];
unset($add['id']); //delete the helper
$sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
,count(id) AS numbers
FROM `tl_banner`
WHERE `pid`=?
... | [
"public",
"function",
"addHeader",
"(",
"$",
"add",
",",
"$",
"dca",
")",
"{",
"$",
"catId",
"=",
"$",
"add",
"[",
"'id'",
"]",
";",
"unset",
"(",
"$",
"add",
"[",
"'id'",
"]",
")",
";",
"//delete the helper",
"$",
"sql",
"=",
"'SELECT CAST(`banner_p... | Add Header Rows, call from header_callback | [
"Add",
"Header",
"Rows",
"call",
"from",
"header_callback"
] | 3ffac36837923194ab0ebaf308c0b23a3684b005 | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L57-L92 |
14,504 | BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.listBanner | public function listBanner($row)
{
switch ($row['banner_type'])
{
case self::BANNER_TYPE_INTERN :
return $this->listBannerInternal($row);
break;
case self::BANNER_TYPE_EXTERN :
return $this->listBannerExternal($row);
... | php | public function listBanner($row)
{
switch ($row['banner_type'])
{
case self::BANNER_TYPE_INTERN :
return $this->listBannerInternal($row);
break;
case self::BANNER_TYPE_EXTERN :
return $this->listBannerExternal($row);
... | [
"public",
"function",
"listBanner",
"(",
"$",
"row",
")",
"{",
"switch",
"(",
"$",
"row",
"[",
"'banner_type'",
"]",
")",
"{",
"case",
"self",
"::",
"BANNER_TYPE_INTERN",
":",
"return",
"$",
"this",
"->",
"listBannerInternal",
"(",
"$",
"row",
")",
";",
... | List banner record
@param object $row | [
"List",
"banner",
"record"
] | 3ffac36837923194ab0ebaf308c0b23a3684b005 | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L99-L116 |
14,505 | BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.getBannerImageSizes | public function getBannerImageSizes()
{
$sizes = array();
$imageSize = $this->Database
->prepare("SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name")
->execute(\Input::get('id'));
while ($imageSize->next())
{
... | php | public function getBannerImageSizes()
{
$sizes = array();
$imageSize = $this->Database
->prepare("SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name")
->execute(\Input::get('id'));
while ($imageSize->next())
{
... | [
"public",
"function",
"getBannerImageSizes",
"(",
")",
"{",
"$",
"sizes",
"=",
"array",
"(",
")",
";",
"$",
"imageSize",
"=",
"$",
"this",
"->",
"Database",
"->",
"prepare",
"(",
"\"SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name\"",
")",
"->",
... | Return all image sizes as array
@return array
@deprecated | [
"Return",
"all",
"image",
"sizes",
"as",
"array"
] | 3ffac36837923194ab0ebaf308c0b23a3684b005 | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L670-L682 |
14,506 | refinery29/piston | src/Piston.php | Piston.group | public function group($prefix, callable $group)
{
$group = new RouteGroup($prefix, $group, $this);
$this->groups[] = $group;
return $group;
} | php | public function group($prefix, callable $group)
{
$group = new RouteGroup($prefix, $group, $this);
$this->groups[] = $group;
return $group;
} | [
"public",
"function",
"group",
"(",
"$",
"prefix",
",",
"callable",
"$",
"group",
")",
"{",
"$",
"group",
"=",
"new",
"RouteGroup",
"(",
"$",
"prefix",
",",
"$",
"group",
",",
"$",
"this",
")",
";",
"$",
"this",
"->",
"groups",
"[",
"]",
"=",
"$"... | Add a group of routes to the collection.
@param string $prefix
@param callable $group
@return RouteGroup | [
"Add",
"a",
"group",
"of",
"routes",
"to",
"the",
"collection",
"."
] | 75c402e814136577fa9a02479e8803aca664c865 | https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/Piston.php#L86-L93 |
14,507 | dpi/ak | src/AvatarServiceDiscovery.php | AvatarServiceDiscovery.discoverClasses | protected function discoverClasses(array $namespaces) : array {
$classes = [];
foreach ($namespaces as $namespace => $namespace_directories) {
$namespace_directories = array_filter($namespace_directories, function ($dir) {
return is_dir($dir);
});
foreach ($namespace_directories as $n... | php | protected function discoverClasses(array $namespaces) : array {
$classes = [];
foreach ($namespaces as $namespace => $namespace_directories) {
$namespace_directories = array_filter($namespace_directories, function ($dir) {
return is_dir($dir);
});
foreach ($namespace_directories as $n... | [
"protected",
"function",
"discoverClasses",
"(",
"array",
"$",
"namespaces",
")",
":",
"array",
"{",
"$",
"classes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"namespaces",
"as",
"$",
"namespace",
"=>",
"$",
"namespace_directories",
")",
"{",
"$",
"namespac... | Discover files that look like avatar service classes.
@param array $namespaces
An array of namespaces where keys are namespaces and values are
directories.
@return string[]
An array of classes. | [
"Discover",
"files",
"that",
"look",
"like",
"avatar",
"service",
"classes",
"."
] | cc61b172a827498cf6284191d51ce04d0f7c0f97 | https://github.com/dpi/ak/blob/cc61b172a827498cf6284191d51ce04d0f7c0f97/src/AvatarServiceDiscovery.php#L86-L113 |
14,508 | dpi/ak | src/AvatarServiceDiscovery.php | AvatarServiceDiscovery.discoverAnnotations | protected function discoverAnnotations(array $classes) : array {
AnnotationRegistry::reset();
AnnotationRegistry::registerLoader('class_exists');
$reader = $this->createReader();
$annotations = [];
foreach ($classes as $class) {
$reflection = new \ReflectionClass($class);
if (!$reflect... | php | protected function discoverAnnotations(array $classes) : array {
AnnotationRegistry::reset();
AnnotationRegistry::registerLoader('class_exists');
$reader = $this->createReader();
$annotations = [];
foreach ($classes as $class) {
$reflection = new \ReflectionClass($class);
if (!$reflect... | [
"protected",
"function",
"discoverAnnotations",
"(",
"array",
"$",
"classes",
")",
":",
"array",
"{",
"AnnotationRegistry",
"::",
"reset",
"(",
")",
";",
"AnnotationRegistry",
"::",
"registerLoader",
"(",
"'class_exists'",
")",
";",
"$",
"reader",
"=",
"$",
"t... | Discovers and caches annotations.
@param string[] $classes
An array of classes.
@return \dpi\ak\Annotation\AvatarService[]
An array of avatar services keyed by class name. | [
"Discovers",
"and",
"caches",
"annotations",
"."
] | cc61b172a827498cf6284191d51ce04d0f7c0f97 | https://github.com/dpi/ak/blob/cc61b172a827498cf6284191d51ce04d0f7c0f97/src/AvatarServiceDiscovery.php#L131-L154 |
14,509 | it-blaster/color-picker-type-bundle | DependencyInjection/FenrizbesColorPickerTypeExtension.php | FenrizbesColorPickerTypeExtension.registerResources | protected function registerResources(ContainerBuilder $container)
{
$templatingEngines = $container->getParameter('templating.engines');
if (in_array('twig', $templatingEngines)) {
$container->setParameter('twig.form.resources', array_merge(
array('FenrizbesColorPickerTy... | php | protected function registerResources(ContainerBuilder $container)
{
$templatingEngines = $container->getParameter('templating.engines');
if (in_array('twig', $templatingEngines)) {
$container->setParameter('twig.form.resources', array_merge(
array('FenrizbesColorPickerTy... | [
"protected",
"function",
"registerResources",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"templatingEngines",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'templating.engines'",
")",
";",
"if",
"(",
"in_array",
"(",
"'twig'",
",",
"$",
"temp... | Registers form templates
@param ContainerBuilder $container | [
"Registers",
"form",
"templates"
] | 507dba21e7ac32174090f08e7192673f3752b311 | https://github.com/it-blaster/color-picker-type-bundle/blob/507dba21e7ac32174090f08e7192673f3752b311/DependencyInjection/FenrizbesColorPickerTypeExtension.php#L36-L46 |
14,510 | leongkui/silex-php-redis | src/SilexPhpRedis/RedisClientProvider.php | RedisClientProvider.getClientInitializer | protected function getClientInitializer(Application $app, $prefix)
{
return $app->protect(function ($args) use ($app, $prefix) {
$extract = function ($bag, $key) use ($app, $prefix) {
$default = "default_$key";
if ($bag instanceof Application) {
... | php | protected function getClientInitializer(Application $app, $prefix)
{
return $app->protect(function ($args) use ($app, $prefix) {
$extract = function ($bag, $key) use ($app, $prefix) {
$default = "default_$key";
if ($bag instanceof Application) {
... | [
"protected",
"function",
"getClientInitializer",
"(",
"Application",
"$",
"app",
",",
"$",
"prefix",
")",
"{",
"return",
"$",
"app",
"->",
"protect",
"(",
"function",
"(",
"$",
"args",
")",
"use",
"(",
"$",
"app",
",",
"$",
"prefix",
")",
"{",
"$",
"... | Returns an anonymous function used by the service provider initialize
lazily new instances of Redis\Client.
@param Application $app
@param string $prefix
@return \Closure | [
"Returns",
"an",
"anonymous",
"function",
"used",
"by",
"the",
"service",
"provider",
"initialize",
"lazily",
"new",
"instances",
"of",
"Redis",
"\\",
"Client",
"."
] | 65fb4f52077fc75a9e134db7888683f07dd3583d | https://github.com/leongkui/silex-php-redis/blob/65fb4f52077fc75a9e134db7888683f07dd3583d/src/SilexPhpRedis/RedisClientProvider.php#L43-L68 |
14,511 | RinkAttendant6/JsonI18n | src/Resource.php | Resource.fromJson | public static function fromJson(string $json): self
{
$input = json_decode($json, true);
$data = reset($input);
$locale = key($input);
return new self($locale, $data);
} | php | public static function fromJson(string $json): self
{
$input = json_decode($json, true);
$data = reset($input);
$locale = key($input);
return new self($locale, $data);
} | [
"public",
"static",
"function",
"fromJson",
"(",
"string",
"$",
"json",
")",
":",
"self",
"{",
"$",
"input",
"=",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"$",
"data",
"=",
"reset",
"(",
"$",
"input",
")",
";",
"$",
"locale",
"=",
... | Factory method to create a translation resource from a JSON string
@param string $json
@return \self | [
"Factory",
"method",
"to",
"create",
"a",
"translation",
"resource",
"from",
"a",
"JSON",
"string"
] | 882cbd43d273f771a384eb09d205d327033aaae3 | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L43-L50 |
14,512 | RinkAttendant6/JsonI18n | src/Resource.php | Resource.setLocale | private function setLocale(string $locale)
{
$arr = \Locale::parseLocale($locale);
if ($arr === false) {
throw new \InvalidArgumentException('Invalid locale');
}
$this->locale = $arr;
} | php | private function setLocale(string $locale)
{
$arr = \Locale::parseLocale($locale);
if ($arr === false) {
throw new \InvalidArgumentException('Invalid locale');
}
$this->locale = $arr;
} | [
"private",
"function",
"setLocale",
"(",
"string",
"$",
"locale",
")",
"{",
"$",
"arr",
"=",
"\\",
"Locale",
"::",
"parseLocale",
"(",
"$",
"locale",
")",
";",
"if",
"(",
"$",
"arr",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcep... | Sets the locale of the resource
@param string $locale The locale
@throws \InvalidArgumentException When provided with an invalid locale | [
"Sets",
"the",
"locale",
"of",
"the",
"resource"
] | 882cbd43d273f771a384eb09d205d327033aaae3 | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L57-L66 |
14,513 | RinkAttendant6/JsonI18n | src/Resource.php | Resource.addData | public function addData(array $data, bool $overwrite = true): void
{
if ($overwrite) {
$this->data = array_merge($this->data, $data);
} else {
$this->data = array_merge($data, $this->data);
}
} | php | public function addData(array $data, bool $overwrite = true): void
{
if ($overwrite) {
$this->data = array_merge($this->data, $data);
} else {
$this->data = array_merge($data, $this->data);
}
} | [
"public",
"function",
"addData",
"(",
"array",
"$",
"data",
",",
"bool",
"$",
"overwrite",
"=",
"true",
")",
":",
"void",
"{",
"if",
"(",
"$",
"overwrite",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
","... | Adds translation values to the resource
@param array $data Values to add
@param boolean $overwrite Whether the new array should overwrite already existing values | [
"Adds",
"translation",
"values",
"to",
"the",
"resource"
] | 882cbd43d273f771a384eb09d205d327033aaae3 | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L91-L98 |
14,514 | RinkAttendant6/JsonI18n | src/Resource.php | Resource.merge | public function merge(self $resource, bool $overwrite = true): void
{
if ($this->getLocale() !== $resource->getLocale()) {
trigger_error('Attempting to merge resources of different locale', \E_USER_NOTICE);
}
$this->addData($resource->data, (bool) $overwrite);
} | php | public function merge(self $resource, bool $overwrite = true): void
{
if ($this->getLocale() !== $resource->getLocale()) {
trigger_error('Attempting to merge resources of different locale', \E_USER_NOTICE);
}
$this->addData($resource->data, (bool) $overwrite);
} | [
"public",
"function",
"merge",
"(",
"self",
"$",
"resource",
",",
"bool",
"$",
"overwrite",
"=",
"true",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"getLocale",
"(",
")",
"!==",
"$",
"resource",
"->",
"getLocale",
"(",
")",
")",
"{",
"tri... | Merges a resource into the current resource
@param self $resource
@param boolean $overwrite Whether the new resource should overwrite already existing values | [
"Merges",
"a",
"resource",
"into",
"the",
"current",
"resource"
] | 882cbd43d273f771a384eb09d205d327033aaae3 | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L114-L121 |
14,515 | RinkAttendant6/JsonI18n | src/Resource.php | Resource.jsonSerialize | public function jsonSerialize(): string
{
$output = array($this->getLocale() => $this->data);
return json_encode($output, JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG);
} | php | public function jsonSerialize(): string
{
$output = array($this->getLocale() => $this->data);
return json_encode($output, JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG);
} | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"string",
"{",
"$",
"output",
"=",
"array",
"(",
"$",
"this",
"->",
"getLocale",
"(",
")",
"=>",
"$",
"this",
"->",
"data",
")",
";",
"return",
"json_encode",
"(",
"$",
"output",
",",
"JSON_HEX_AMP"... | Serializes the resource into a JSON object
@return string | [
"Serializes",
"the",
"resource",
"into",
"a",
"JSON",
"object"
] | 882cbd43d273f771a384eb09d205d327033aaae3 | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L165-L169 |
14,516 | comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Cache/RouterCache.php | RouterCache.dump | public function dump($data, $ttl=null) {
return $this->getCache()
->setNamespace(self::CACHE_NAMESPACE)
->set(self::CACHE_NAME, $data, $ttl === null ? self::DEFAULTTTL : intval($ttl));
} | php | public function dump($data, $ttl=null) {
return $this->getCache()
->setNamespace(self::CACHE_NAMESPACE)
->set(self::CACHE_NAME, $data, $ttl === null ? self::DEFAULTTTL : intval($ttl));
} | [
"public",
"function",
"dump",
"(",
"$",
"data",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getCache",
"(",
")",
"->",
"setNamespace",
"(",
"self",
"::",
"CACHE_NAMESPACE",
")",
"->",
"set",
"(",
"self",
"::",
"CACHE_NAME",
... | Store the routing table in cache
@return array $data
@return int $ttl
@return bool | [
"Store",
"the",
"routing",
"table",
"in",
"cache"
] | 5093297dcb7441a8d8f79cbb2429c93232e16d1c | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Cache/RouterCache.php#L59-L65 |
14,517 | braincrafted/arrayquery | src/Braincrafted/ArrayQuery/SelectEvaluation.php | SelectEvaluation.evaluate | public function evaluate($value, $filters)
{
if (false === is_array($filters)) {
$filters = [ $filters ];
}
foreach ($filters as $filter) {
$value = $this->evaluateFilter($value, $filter);
}
return $value;
} | php | public function evaluate($value, $filters)
{
if (false === is_array($filters)) {
$filters = [ $filters ];
}
foreach ($filters as $filter) {
$value = $this->evaluateFilter($value, $filter);
}
return $value;
} | [
"public",
"function",
"evaluate",
"(",
"$",
"value",
",",
"$",
"filters",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"filters",
"=",
"[",
"$",
"filters",
"]",
";",
"}",
"foreach",
"(",
"$",
"filters",
... | Evaluates the given value with the given filters.
@param mixed $value The value.
@param array $filters The list of filters to apply.
@return mixed The evaluated value.
@throws Braincrafted\ArrayQuery\Exception\UnkownFilterException if a filter does not exist. | [
"Evaluates",
"the",
"given",
"value",
"with",
"the",
"given",
"filters",
"."
] | 8b0c44ee76cea796589422f52e2f7130676b9bd1 | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/SelectEvaluation.php#L53-L64 |
14,518 | codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.controllers | public function controllers(array $controllers)
{
$group = new Group;
foreach ($controllers as $controller)
$group->set($this->controller($controller));
return $group;
} | php | public function controllers(array $controllers)
{
$group = new Group;
foreach ($controllers as $controller)
$group->set($this->controller($controller));
return $group;
} | [
"public",
"function",
"controllers",
"(",
"array",
"$",
"controllers",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"controllers",
"as",
"$",
"controller",
")",
"$",
"group",
"->",
"set",
"(",
"$",
"this",
"->",
"controller",
... | Maps several controllers at same time.
@param string[] $controllers Controllers name.
@throws \ReflectionException
@return Group | [
"Maps",
"several",
"controllers",
"at",
"same",
"time",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L82-L88 |
14,519 | activecollab/databasestructure | src/Builder/StructureSql.php | StructureSql.appendToStructureSql | public function appendToStructureSql($statement, $comment = '')
{
if ($structure_sql_path = $this->getStructureSqlPath()) {
$current_content = file_get_contents($structure_sql_path);
if ($current_content) {
$current_content .= "\n\n\n\n";
}
i... | php | public function appendToStructureSql($statement, $comment = '')
{
if ($structure_sql_path = $this->getStructureSqlPath()) {
$current_content = file_get_contents($structure_sql_path);
if ($current_content) {
$current_content .= "\n\n\n\n";
}
i... | [
"public",
"function",
"appendToStructureSql",
"(",
"$",
"statement",
",",
"$",
"comment",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"structure_sql_path",
"=",
"$",
"this",
"->",
"getStructureSqlPath",
"(",
")",
")",
"{",
"$",
"current_content",
"=",
"file_get_con... | Append statement to SQL file.
@param string $statement
@param string $comment | [
"Append",
"statement",
"to",
"SQL",
"file",
"."
] | 4b2353c4422186bcfce63b3212da3e70e63eb5df | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/StructureSql.php#L32-L47 |
14,520 | codeburnerframework/router | src/Collector.php | Collector.match | public function match(array $methods, $pattern, $action)
{
$group = new Group;
foreach ($methods as $method)
$group->set($this->set($method, $pattern, $action));
return $group;
} | php | public function match(array $methods, $pattern, $action)
{
$group = new Group;
foreach ($methods as $method)
$group->set($this->set($method, $pattern, $action));
return $group;
} | [
"public",
"function",
"match",
"(",
"array",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"$",
"group",
"->",
"set",
"(",
"$",
... | Insert a route into several http methods.
@param string[] $methods
@param string $pattern
@param callable $action
@return Group | [
"Insert",
"a",
"route",
"into",
"several",
"http",
"methods",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L143-L149 |
14,521 | codeburnerframework/router | src/Collector.php | Collector.any | public function any($pattern, $action)
{
return $this->match(explode(" ", self::HTTP_METHODS), $pattern, $action);
} | php | public function any($pattern, $action)
{
return $this->match(explode(" ", self::HTTP_METHODS), $pattern, $action);
} | [
"public",
"function",
"any",
"(",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"match",
"(",
"explode",
"(",
"\" \"",
",",
"self",
"::",
"HTTP_METHODS",
")",
",",
"$",
"pattern",
",",
"$",
"action",
")",
";",
"}"
] | Insert a route into every http method supported.
@param string $pattern
@param callable $action
@return Group | [
"Insert",
"a",
"route",
"into",
"every",
"http",
"method",
"supported",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L160-L163 |
14,522 | codeburnerframework/router | src/Collector.php | Collector.except | public function except($methods, $pattern, $action)
{
return $this->match(array_diff(explode(" ", self::HTTP_METHODS), (array) $methods), $pattern, $action);
} | php | public function except($methods, $pattern, $action)
{
return $this->match(array_diff(explode(" ", self::HTTP_METHODS), (array) $methods), $pattern, $action);
} | [
"public",
"function",
"except",
"(",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"match",
"(",
"array_diff",
"(",
"explode",
"(",
"\" \"",
",",
"self",
"::",
"HTTP_METHODS",
")",
",",
"(",
"array",
... | Insert a route into every http method supported but the given ones.
@param string $methods
@param string $pattern
@param callable $action
@return Group | [
"Insert",
"a",
"route",
"into",
"every",
"http",
"method",
"supported",
"but",
"the",
"given",
"ones",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L175-L178 |
14,523 | codeburnerframework/router | src/Collector.php | Collector.group | public function group(array $routes)
{
$group = new Group;
foreach ($routes as $route)
$group->set($route);
return $group;
} | php | public function group(array $routes)
{
$group = new Group;
foreach ($routes as $route)
$group->set($route);
return $group;
} | [
"public",
"function",
"group",
"(",
"array",
"$",
"routes",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"route",
")",
"$",
"group",
"->",
"set",
"(",
"$",
"route",
")",
";",
"return",
"$",
"group",
... | Group all given routes.
@param Route[] $routes
@return Group | [
"Group",
"all",
"given",
"routes",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L187-L193 |
14,524 | codeburnerframework/router | src/Collector.php | Collector.forget | public function forget($method, $pattern)
{
if (strpos($pattern, "{") === false) {
unset($this->statics[$method][$pattern]);
} else unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]);
} | php | public function forget($method, $pattern)
{
if (strpos($pattern, "{") === false) {
unset($this->statics[$method][$pattern]);
} else unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]);
} | [
"public",
"function",
"forget",
"(",
"$",
"method",
",",
"$",
"pattern",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"pattern",
",",
"\"{\"",
")",
"===",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"statics",
"[",
"$",
"method",
"]",
"[",
"$... | Remove a route from collector.
@param string $method
@param string $pattern | [
"Remove",
"a",
"route",
"from",
"collector",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L202-L207 |
14,525 | codeburnerframework/router | src/Collector.php | Collector.getValidMethod | protected function getValidMethod($method)
{
$method = strtolower($method);
if (strpos(self::HTTP_METHODS, $method) === false) {
throw new MethodNotSupportedException($method);
}
return $method;
} | php | protected function getValidMethod($method)
{
$method = strtolower($method);
if (strpos(self::HTTP_METHODS, $method) === false) {
throw new MethodNotSupportedException($method);
}
return $method;
} | [
"protected",
"function",
"getValidMethod",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"if",
"(",
"strpos",
"(",
"self",
"::",
"HTTP_METHODS",
",",
"$",
"method",
")",
"===",
"false",
")",
"{",
"throw",... | Determine if the http method is valid.
@param string $method
@throws MethodNotSupportedException
@return string | [
"Determine",
"if",
"the",
"http",
"method",
"is",
"valid",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L270-L279 |
14,526 | axelitus/php-base | src/Traverser.php | Traverser.traverse | final public function traverse(array &$arr)
{
if (!$this->isReady()) {
throw new \RuntimeException("The traverser is not ready, no valid item callback has been set.");
}
return static::run($arr, $this->itemCallback, $this->resultCallback);
} | php | final public function traverse(array &$arr)
{
if (!$this->isReady()) {
throw new \RuntimeException("The traverser is not ready, no valid item callback has been set.");
}
return static::run($arr, $this->itemCallback, $this->resultCallback);
} | [
"final",
"public",
"function",
"traverse",
"(",
"array",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isReady",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"The traverser is not ready, no valid item callback has been se... | Runs the given array through the Traverser's callbacks.
@param array $arr The array to traverse.
@return array Returns the resulting array. | [
"Runs",
"the",
"given",
"array",
"through",
"the",
"Traverser",
"s",
"callbacks",
"."
] | c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075 | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Traverser.php#L132-L139 |
14,527 | axelitus/php-base | src/Traverser.php | Traverser.run | public static function run(array &$arr, callable $itemCallback, callable $resultCallback = null)
{
$result = [];
foreach ($arr as $key => &$value) {
// Run the callback and store the result in a variable so that we allow the key to be modified by the
// callback. Also pass th... | php | public static function run(array &$arr, callable $itemCallback, callable $resultCallback = null)
{
$result = [];
foreach ($arr as $key => &$value) {
// Run the callback and store the result in a variable so that we allow the key to be modified by the
// callback. Also pass th... | [
"public",
"static",
"function",
"run",
"(",
"array",
"&",
"$",
"arr",
",",
"callable",
"$",
"itemCallback",
",",
"callable",
"$",
"resultCallback",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key"... | Runs the traverser across the given array and executes the item callback into every item of the array.
The traverser also has a result callback to allow for 'macro' result processing.
@param array $arr The array to traverse.
@param callable $itemCallback The item callback to operate into every item.
C... | [
"Runs",
"the",
"traverser",
"across",
"the",
"given",
"array",
"and",
"executes",
"the",
"item",
"callback",
"into",
"every",
"item",
"of",
"the",
"array",
"."
] | c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075 | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Traverser.php#L156-L174 |
14,528 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.getValidProductPriceForItem | private function getValidProductPriceForItem($item, $currency)
{
$product = $item->getCalcProduct();
$specialPriceValue = null;
$bulkPriceValue = null;
//get special price
$specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
if ($spec... | php | private function getValidProductPriceForItem($item, $currency)
{
$product = $item->getCalcProduct();
$specialPriceValue = null;
$bulkPriceValue = null;
//get special price
$specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
if ($spec... | [
"private",
"function",
"getValidProductPriceForItem",
"(",
"$",
"item",
",",
"$",
"currency",
")",
"{",
"$",
"product",
"=",
"$",
"item",
"->",
"getCalcProduct",
"(",
")",
";",
"$",
"specialPriceValue",
"=",
"null",
";",
"$",
"bulkPriceValue",
"=",
"null",
... | Returns the valid product price for item
@param object $item
@param string $currency
@return int | [
"Returns",
"the",
"valid",
"product",
"price",
"for",
"item"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L41-L77 |
14,529 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.calculate | public function calculate($item, $currency = null, $useProductsPrice = true)
{
$currency = $this->getCurrency($currency);
// validate item
$this->validateItem($item);
if ($useProductsPrice) {
$priceValue = $this->getValidProductPriceForItem($item, $currency);
} ... | php | public function calculate($item, $currency = null, $useProductsPrice = true)
{
$currency = $this->getCurrency($currency);
// validate item
$this->validateItem($item);
if ($useProductsPrice) {
$priceValue = $this->getValidProductPriceForItem($item, $currency);
} ... | [
"public",
"function",
"calculate",
"(",
"$",
"item",
",",
"$",
"currency",
"=",
"null",
",",
"$",
"useProductsPrice",
"=",
"true",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"getCurrency",
"(",
"$",
"currency",
")",
";",
"// validate item",
"$",
... | Calculates the overall total price of an item
@param CalculableBulkPriceItemInterface $item
@param string|null $currency
@param bool|null $useProductsPrice
@return int
@throws PriceCalculationException | [
"Calculates",
"the",
"overall",
"total",
"price",
"of",
"an",
"item"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L89-L116 |
14,530 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.validateItem | protected function validateItem($item)
{
// validate not null
$this->validateNotNull('quantity', $item->getCalcQuantity());
// validate discount
$discountPercent = $item->getCalcDiscount();
if ($discountPercent < 0 || $discountPercent > 100) {
throw new PriceCalc... | php | protected function validateItem($item)
{
// validate not null
$this->validateNotNull('quantity', $item->getCalcQuantity());
// validate discount
$discountPercent = $item->getCalcDiscount();
if ($discountPercent < 0 || $discountPercent > 100) {
throw new PriceCalc... | [
"protected",
"function",
"validateItem",
"(",
"$",
"item",
")",
"{",
"// validate not null",
"$",
"this",
"->",
"validateNotNull",
"(",
"'quantity'",
",",
"$",
"item",
"->",
"getCalcQuantity",
"(",
")",
")",
";",
"// validate discount",
"$",
"discountPercent",
"... | Validate item values
@param $item
@throws PriceCalculationException | [
"Validate",
"item",
"values"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L139-L149 |
14,531 | discophp/framework | core/twig/tag/CacheNode.php | CacheNode.duration | private function duration($time){
if(is_numeric($time)){
return $time;
}//if
return (new \DateTime($time))->getTimestamp() - (new \DateTime('now'))->getTimestamp();
} | php | private function duration($time){
if(is_numeric($time)){
return $time;
}//if
return (new \DateTime($time))->getTimestamp() - (new \DateTime('now'))->getTimestamp();
} | [
"private",
"function",
"duration",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"time",
")",
")",
"{",
"return",
"$",
"time",
";",
"}",
"//if",
"return",
"(",
"new",
"\\",
"DateTime",
"(",
"$",
"time",
")",
")",
"->",
"getTimestam... | Convert a potential string date like `+30 days` to seconds.
@param int|string
@return int | [
"Convert",
"a",
"potential",
"string",
"date",
"like",
"+",
"30",
"days",
"to",
"seconds",
"."
] | 40ff3ea5225810534195494dc6c21083da4d1356 | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/twig/tag/CacheNode.php#L115-L120 |
14,532 | baleen/cli | src/BaseCommand.php | BaseCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var MessageInterface $message */
$message = $this->getContainer()->get($this->serviceAlias);
if (get_class($message) !== $this->serviceClass) {
throw new InvalidArgumentException(sprintf(
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var MessageInterface $message */
$message = $this->getContainer()->get($this->serviceAlias);
if (get_class($message) !== $this->serviceClass) {
throw new InvalidArgumentException(sprintf(
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var MessageInterface $message */",
"$",
"message",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"$",
"this",
... | Executes the current command by retrieving its associated Message from the Container, setting the Input and
Output according to what was received as parameters, and finally passing that Message to the CommandBus for
handling.
@param InputInterface $input An InputInterface instance
@param OutputInterface $output An Out... | [
"Executes",
"the",
"current",
"command",
"by",
"retrieving",
"its",
"associated",
"Message",
"from",
"the",
"Container",
"setting",
"the",
"Input",
"and",
"Output",
"according",
"to",
"what",
"was",
"received",
"as",
"parameters",
"and",
"finally",
"passing",
"t... | 2ecbc7179c5800c9075fd93204ef25da375536ed | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/BaseCommand.php#L124-L141 |
14,533 | TypistTech/wp-option-store | src/OptionStore.php | OptionStore.getBoolean | public function getBoolean(string $optionName): bool
{
return in_array(
$this->get($optionName),
self::TRUE_VALUES,
true
);
} | php | public function getBoolean(string $optionName): bool
{
return in_array(
$this->get($optionName),
self::TRUE_VALUES,
true
);
} | [
"public",
"function",
"getBoolean",
"(",
"string",
"$",
"optionName",
")",
":",
"bool",
"{",
"return",
"in_array",
"(",
"$",
"this",
"->",
"get",
"(",
"$",
"optionName",
")",
",",
"self",
"::",
"TRUE_VALUES",
",",
"true",
")",
";",
"}"
] | Cast an option value into boolean.
@param string $optionName Name of option to retrieve.
@return bool | [
"Cast",
"an",
"option",
"value",
"into",
"boolean",
"."
] | 115ff7cb4b5f566c89c1294fe2b68c82d62cccc2 | https://github.com/TypistTech/wp-option-store/blob/115ff7cb4b5f566c89c1294fe2b68c82d62cccc2/src/OptionStore.php#L67-L74 |
14,534 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator.php | Calculator.convert | protected function convert($num)
{
if ($num instanceof NumericTypeInterface) {
return $num;
}
if (is_numeric($num)) {
return $this->calcEngine->convertNumeric($num);
}
$type = (is_object($num) ? get_class($num) : gettype($num));
throw new \Bad... | php | protected function convert($num)
{
if ($num instanceof NumericTypeInterface) {
return $num;
}
if (is_numeric($num)) {
return $this->calcEngine->convertNumeric($num);
}
$type = (is_object($num) ? get_class($num) : gettype($num));
throw new \Bad... | [
"protected",
"function",
"convert",
"(",
"$",
"num",
")",
"{",
"if",
"(",
"$",
"num",
"instanceof",
"NumericTypeInterface",
")",
"{",
"return",
"$",
"num",
";",
"}",
"if",
"(",
"is_numeric",
"(",
"$",
"num",
")",
")",
"{",
"return",
"$",
"this",
"->"... | Convert into Strong Numeric Type
@param int|float|NumericTypeInterface $num operand
@return \Chippyash\Type\Number\IntType | [
"Convert",
"into",
"Strong",
"Numeric",
"Type"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L277-L288 |
14,535 | verschoof/bunq-api | src/Resource/CardResource.php | CardResource.getCard | public function getCard($userId, $cardId)
{
$card = $this->client->get($this->getResourceEndpoint($userId) . '/' . (int)$cardId);
return $card['Response'][0];
} | php | public function getCard($userId, $cardId)
{
$card = $this->client->get($this->getResourceEndpoint($userId) . '/' . (int)$cardId);
return $card['Response'][0];
} | [
"public",
"function",
"getCard",
"(",
"$",
"userId",
",",
"$",
"cardId",
")",
"{",
"$",
"card",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"this",
"->",
"getResourceEndpoint",
"(",
"$",
"userId",
")",
".",
"'/'",
".",
"(",
"int",
")",... | Gets a user its card information.
@param integer $userId
@param integer $cardId
@return array | [
"Gets",
"a",
"user",
"its",
"card",
"information",
"."
] | df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Resource/CardResource.php#L42-L47 |
14,536 | blast-project/CoreBundle | src/Doctrine/ORM/CascadingRelationChecker.php | CascadingRelationChecker.beforeEntityDelete | public function beforeEntityDelete($entity, &$idx)
{
$this->undeleteReasons = [];
$entityMetadata = $this->em->getClassMetadata(get_class($entity));
$associations = $entityMetadata->getAssociationMappings();
foreach ($associations as $association) {
if (in_array('remov... | php | public function beforeEntityDelete($entity, &$idx)
{
$this->undeleteReasons = [];
$entityMetadata = $this->em->getClassMetadata(get_class($entity));
$associations = $entityMetadata->getAssociationMappings();
foreach ($associations as $association) {
if (in_array('remov... | [
"public",
"function",
"beforeEntityDelete",
"(",
"$",
"entity",
",",
"&",
"$",
"idx",
")",
"{",
"$",
"this",
"->",
"undeleteReasons",
"=",
"[",
"]",
";",
"$",
"entityMetadata",
"=",
"$",
"this",
"->",
"em",
"->",
"getClassMetadata",
"(",
"get_class",
"("... | Hande entity relations before trying to remove it.
@param mixed $entity a Doctrine entity object
@param array $idx list of entity ids to be removed
@return | [
"Hande",
"entity",
"relations",
"before",
"trying",
"to",
"remove",
"it",
"."
] | 7a0832758ca14e5bc5d65515532c1220df3930ae | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Doctrine/ORM/CascadingRelationChecker.php#L40-L70 |
14,537 | jenky/laravel-api-helper | src/Handler.php | Handler.getSupportedParams | protected function getSupportedParams($method)
{
$columns = [];
if ($this->isEloquentBuilder()) {
$model = $this->getHandler()->getModel();
$columns = in_array(ApiHelper::class, class_uses($model))
? $model->$method()
: $model->getFillable();
... | php | protected function getSupportedParams($method)
{
$columns = [];
if ($this->isEloquentBuilder()) {
$model = $this->getHandler()->getModel();
$columns = in_array(ApiHelper::class, class_uses($model))
? $model->$method()
: $model->getFillable();
... | [
"protected",
"function",
"getSupportedParams",
"(",
"$",
"method",
")",
"{",
"$",
"columns",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"isEloquentBuilder",
"(",
")",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getHandler",
"(",
")",
"->"... | Get supported params.
@param string $method
@return array | [
"Get",
"supported",
"params",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L126-L138 |
14,538 | jenky/laravel-api-helper | src/Handler.php | Handler.parse | protected function parse()
{
$this->parseParam('sort');
$this->parseParam('fields');
$this->parseParam('limit');
if ($this->isEloquentBuilder()) {
$this->parseParam('with');
}
$this->parseFilter();
} | php | protected function parse()
{
$this->parseParam('sort');
$this->parseParam('fields');
$this->parseParam('limit');
if ($this->isEloquentBuilder()) {
$this->parseParam('with');
}
$this->parseFilter();
} | [
"protected",
"function",
"parse",
"(",
")",
"{",
"$",
"this",
"->",
"parseParam",
"(",
"'sort'",
")",
";",
"$",
"this",
"->",
"parseParam",
"(",
"'fields'",
")",
";",
"$",
"this",
"->",
"parseParam",
"(",
"'limit'",
")",
";",
"if",
"(",
"$",
"this",
... | Parse the data from the request.
@return void | [
"Parse",
"the",
"data",
"from",
"the",
"request",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L175-L184 |
14,539 | jenky/laravel-api-helper | src/Handler.php | Handler.parseParam | protected function parseParam($param)
{
$method = 'parse'.ucfirst($param);
if (method_exists($this, $method)) {
if ($params = $this->input($param)) {
return $this->$method($params);
}
}
} | php | protected function parseParam($param)
{
$method = 'parse'.ucfirst($param);
if (method_exists($this, $method)) {
if ($params = $this->input($param)) {
return $this->$method($params);
}
}
} | [
"protected",
"function",
"parseParam",
"(",
"$",
"param",
")",
"{",
"$",
"method",
"=",
"'parse'",
".",
"ucfirst",
"(",
"$",
"param",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
"if",
"(",
"$",
"params... | Parse the special param.
@param string $param
@return void | [
"Parse",
"the",
"special",
"param",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L192-L201 |
14,540 | jenky/laravel-api-helper | src/Handler.php | Handler.parseSort | protected function parseSort($params)
{
foreach (explode(',', $params) as $sort) {
// Check if ascending or descending(-) sort
if (preg_match('/^-.+/', $sort)) {
$direction = 'desc';
} else {
$direction = 'asc';
}
$... | php | protected function parseSort($params)
{
foreach (explode(',', $params) as $sort) {
// Check if ascending or descending(-) sort
if (preg_match('/^-.+/', $sort)) {
$direction = 'desc';
} else {
$direction = 'asc';
}
$... | [
"protected",
"function",
"parseSort",
"(",
"$",
"params",
")",
"{",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"params",
")",
"as",
"$",
"sort",
")",
"{",
"// Check if ascending or descending(-) sort",
"if",
"(",
"preg_match",
"(",
"'/^-.+/'",
",",
"$"... | Parse the sort parameter.
@param string $params
@return void | [
"Parse",
"the",
"sort",
"parameter",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L209-L231 |
14,541 | jenky/laravel-api-helper | src/Handler.php | Handler.parseFields | protected function parseFields($params)
{
foreach (explode(',', $params) as $field) {
// Only add the fields that are on the base resource
if (! Str::contains($field, '.')) {
$this->fields[] = trim($field);
} else {
$this->additionalFields[... | php | protected function parseFields($params)
{
foreach (explode(',', $params) as $field) {
// Only add the fields that are on the base resource
if (! Str::contains($field, '.')) {
$this->fields[] = trim($field);
} else {
$this->additionalFields[... | [
"protected",
"function",
"parseFields",
"(",
"$",
"params",
")",
"{",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"params",
")",
"as",
"$",
"field",
")",
"{",
"// Only add the fields that are on the base resource",
"if",
"(",
"!",
"Str",
"::",
"contains",... | Parse the fields parameter.
@param string $params
@return void | [
"Parse",
"the",
"fields",
"parameter",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L239-L249 |
14,542 | jenky/laravel-api-helper | src/Handler.php | Handler.parseWith | protected function parseWith($params)
{
$with = explode(',', $params);
$withable = $this->getSupportedParams('getApiWithable');
$with = in_array('*', $withable) ? $with : array_only($with, $withable);
foreach ($this->additionalSorts as $sort => $direction) {
$parts = ex... | php | protected function parseWith($params)
{
$with = explode(',', $params);
$withable = $this->getSupportedParams('getApiWithable');
$with = in_array('*', $withable) ? $with : array_only($with, $withable);
foreach ($this->additionalSorts as $sort => $direction) {
$parts = ex... | [
"protected",
"function",
"parseWith",
"(",
"$",
"params",
")",
"{",
"$",
"with",
"=",
"explode",
"(",
"','",
",",
"$",
"params",
")",
";",
"$",
"withable",
"=",
"$",
"this",
"->",
"getSupportedParams",
"(",
"'getApiWithable'",
")",
";",
"$",
"with",
"=... | Parse the with parameter.
@param string $params
@return void | [
"Parse",
"the",
"with",
"parameter",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L268-L296 |
14,543 | jenky/laravel-api-helper | src/Handler.php | Handler.parseFilter | protected function parseFilter()
{
if (! $params = $this->getParams()) {
return;
}
foreach ($params as $key => $value) {
if ($this->isEloquentBuilder() && Str::contains($key, '~')) {
$this->filterRelation($key, $value);
} else {
... | php | protected function parseFilter()
{
if (! $params = $this->getParams()) {
return;
}
foreach ($params as $key => $value) {
if ($this->isEloquentBuilder() && Str::contains($key, '~')) {
$this->filterRelation($key, $value);
} else {
... | [
"protected",
"function",
"parseFilter",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"params",
"=",
"$",
"this",
"->",
"getParams",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if"... | Parse all the paramenters for query builder.
@return void | [
"Parse",
"all",
"the",
"paramenters",
"for",
"query",
"builder",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L303-L316 |
14,544 | jenky/laravel-api-helper | src/Handler.php | Handler.formatParam | protected function formatParam($key, $value)
{
$supportedFixes = [
'lt' => '<',
'gt' => '>',
'lte' => '<=',
'gte' => '>=',
'lk' => 'LIKE',
'not-lk' => 'NOT LIKE',
'in' => 'IN',
'not-in' => '... | php | protected function formatParam($key, $value)
{
$supportedFixes = [
'lt' => '<',
'gt' => '>',
'lte' => '<=',
'gte' => '>=',
'lk' => 'LIKE',
'not-lk' => 'NOT LIKE',
'in' => 'IN',
'not-in' => '... | [
"protected",
"function",
"formatParam",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"supportedFixes",
"=",
"[",
"'lt'",
"=>",
"'<'",
",",
"'gt'",
"=>",
"'>'",
",",
"'lte'",
"=>",
"'<='",
",",
"'gte'",
"=>",
"'>='",
",",
"'lk'",
"=>",
"'LIKE'",... | Format the paramenter for query builder.
@param string $key
@param string $value
@return array | [
"Format",
"the",
"paramenter",
"for",
"query",
"builder",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L325-L367 |
14,545 | jenky/laravel-api-helper | src/Handler.php | Handler.filter | protected function filter($key, $value)
{
extract($this->formatParam($key, $value));
if (! $this->canFilter($column)) {
return;
}
if ($comparator == 'IN') {
$values = explode(',', $value);
$this->getHandler()->whereIn($column, $values);
}... | php | protected function filter($key, $value)
{
extract($this->formatParam($key, $value));
if (! $this->canFilter($column)) {
return;
}
if ($comparator == 'IN') {
$values = explode(',', $value);
$this->getHandler()->whereIn($column, $values);
}... | [
"protected",
"function",
"filter",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"formatParam",
"(",
"$",
"key",
",",
"$",
"value",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"canFilter",
"(",
"$",
"colum... | Apply the filter to query builder.
@param string $key
@param string $value
@return void | [
"Apply",
"the",
"filter",
"to",
"query",
"builder",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L376-L418 |
14,546 | jenky/laravel-api-helper | src/Handler.php | Handler.filterRelation | protected function filterRelation($key, $value)
{
$key = str_replace('~', '.', $key);
$parts = explode('.', $key);
$realKey = array_pop($parts);
$relation = implode('.', $parts);
if (! in_array($relation, array_keys($this->with))) {
return;
}
ex... | php | protected function filterRelation($key, $value)
{
$key = str_replace('~', '.', $key);
$parts = explode('.', $key);
$realKey = array_pop($parts);
$relation = implode('.', $parts);
if (! in_array($relation, array_keys($this->with))) {
return;
}
ex... | [
"protected",
"function",
"filterRelation",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"str_replace",
"(",
"'~'",
",",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
... | Apply the filter to relationship query builder.
@param string $key
@param string $value
@return void | [
"Apply",
"the",
"filter",
"to",
"relationship",
"query",
"builder",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L427-L481 |
14,547 | jenky/laravel-api-helper | src/Handler.php | Handler.getParams | protected function getParams()
{
$reserved = [
$this->config('prefix', '').'sort',
$this->config('prefix', '').'fields',
$this->config('prefix', '').'limit',
$this->config('prefix', '').'with',
$this->config('prefix', '').'page',
];
... | php | protected function getParams()
{
$reserved = [
$this->config('prefix', '').'sort',
$this->config('prefix', '').'fields',
$this->config('prefix', '').'limit',
$this->config('prefix', '').'with',
$this->config('prefix', '').'page',
];
... | [
"protected",
"function",
"getParams",
"(",
")",
"{",
"$",
"reserved",
"=",
"[",
"$",
"this",
"->",
"config",
"(",
"'prefix'",
",",
"''",
")",
".",
"'sort'",
",",
"$",
"this",
"->",
"config",
"(",
"'prefix'",
",",
"''",
")",
".",
"'fields'",
",",
"$... | Get the params from the request.
@return array | [
"Get",
"the",
"params",
"from",
"the",
"request",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L530-L541 |
14,548 | jenky/laravel-api-helper | src/Handler.php | Handler.getHandler | protected function getHandler()
{
if ($this->builder) {
return $this->builder;
}
if ($this->query) {
return $this->query;
}
throw new InvalidArgumentException('Missing query builder');
} | php | protected function getHandler()
{
if ($this->builder) {
return $this->builder;
}
if ($this->query) {
return $this->query;
}
throw new InvalidArgumentException('Missing query builder');
} | [
"protected",
"function",
"getHandler",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"builder",
")",
"{",
"return",
"$",
"this",
"->",
"builder",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"query",
";",
... | Get the handler.
@throws \InvalidArgumentException
@return \Illuminate\Database\Query\Builder | \Illuminate\Database\Eloquent\Builder | [
"Get",
"the",
"handler",
"."
] | 9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367 | https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L665-L676 |
14,549 | eloquent/liberator | src/LiberatorClass.php | LiberatorClass.liberatorPropertyReflector | protected function liberatorPropertyReflector($property)
{
$classReflector = $this->liberatorReflector();
while ($classReflector) {
if ($classReflector->hasProperty($property)) {
$propertyReflector = $classReflector->getProperty($property);
$propertyRefle... | php | protected function liberatorPropertyReflector($property)
{
$classReflector = $this->liberatorReflector();
while ($classReflector) {
if ($classReflector->hasProperty($property)) {
$propertyReflector = $classReflector->getProperty($property);
$propertyRefle... | [
"protected",
"function",
"liberatorPropertyReflector",
"(",
"$",
"property",
")",
"{",
"$",
"classReflector",
"=",
"$",
"this",
"->",
"liberatorReflector",
"(",
")",
";",
"while",
"(",
"$",
"classReflector",
")",
"{",
"if",
"(",
"$",
"classReflector",
"->",
... | Get a property reflector.
@param string $property The property name.
@return ReflectionProperty|null The property reflector, or null if no such property exists. | [
"Get",
"a",
"property",
"reflector",
"."
] | d90c159e0067f7f3e376c8e4b1b72d502f7aa0aa | https://github.com/eloquent/liberator/blob/d90c159e0067f7f3e376c8e4b1b72d502f7aa0aa/src/LiberatorClass.php#L198-L214 |
14,550 | ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Aop/Advice/ExceptionLoggingAdvice.php | ExceptionLoggingAdvice.interceptMethodCall | public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {
try {
return $jointPoint->proceed();
} catch (Exception $e) {
$methodName = $jointPoint->getMethodName();
$partialTrace = array();
$trace = $e->getTrace();
$depth =... | php | public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {
try {
return $jointPoint->proceed();
} catch (Exception $e) {
$methodName = $jointPoint->getMethodName();
$partialTrace = array();
$trace = $e->getTrace();
$depth =... | [
"public",
"function",
"interceptMethodCall",
"(",
"ProceedingJoinPointInterface",
"$",
"jointPoint",
")",
"{",
"try",
"{",
"return",
"$",
"jointPoint",
"->",
"proceed",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"methodName",
"="... | In this implementation we log each exception and rethrow.
@param ProceedingJoinPointInterface $jointPoint
@throws \Exception
@return mixed | [
"In",
"this",
"implementation",
"we",
"log",
"each",
"exception",
"and",
"rethrow",
"."
] | ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480 | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Aop/Advice/ExceptionLoggingAdvice.php#L54-L79 |
14,551 | nicoSWD/put.io-api-v2 | src/PutIO/Engines/JSON/JSON.php | Services_JSON.Services_JSON | function Services_JSON($use = 0)
{
$this->use = $use;
$this->_mb_strlen = function_exists('mb_strlen');
$this->_mb_convert_encoding = function_exists('mb_convert_encoding');
$this->_mb_substr = function_exists('mb_substr');
} | php | function Services_JSON($use = 0)
{
$this->use = $use;
$this->_mb_strlen = function_exists('mb_strlen');
$this->_mb_convert_encoding = function_exists('mb_convert_encoding');
$this->_mb_substr = function_exists('mb_substr');
} | [
"function",
"Services_JSON",
"(",
"$",
"use",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"use",
"=",
"$",
"use",
";",
"$",
"this",
"->",
"_mb_strlen",
"=",
"function_exists",
"(",
"'mb_strlen'",
")",
";",
"$",
"this",
"->",
"_mb_convert_encoding",
"=",
"fu... | constructs a new JSON instance
@param int $use object behavior flags; combine with boolean-OR
possible values:
- SERVICES_JSON_LOOSE_TYPE: loose typing.
"{...}" syntax creates associative arrays
instead of objects in decode().
- SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
Values which can't be encod... | [
"constructs",
"a",
"new",
"JSON",
"instance"
] | d91bedd91ea75793512a921bfd9aa83e86a6f0a7 | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/JSON/JSON.php#L144-L150 |
14,552 | nicoSWD/put.io-api-v2 | src/PutIO/Engines/JSON/JSON.php | Services_JSON.encodeUnsafe | function encodeUnsafe($var)
{
// see bug #16908 - regarding numeric locale printing
$lc = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'C');
$ret = $this->_encode($var);
setlocale(LC_NUMERIC, $lc);
return $ret;
} | php | function encodeUnsafe($var)
{
// see bug #16908 - regarding numeric locale printing
$lc = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'C');
$ret = $this->_encode($var);
setlocale(LC_NUMERIC, $lc);
return $ret;
} | [
"function",
"encodeUnsafe",
"(",
"$",
"var",
")",
"{",
"// see bug #16908 - regarding numeric locale printing",
"$",
"lc",
"=",
"setlocale",
"(",
"LC_NUMERIC",
",",
"0",
")",
";",
"setlocale",
"(",
"LC_NUMERIC",
",",
"'C'",
")",
";",
"$",
"ret",
"=",
"$",
"t... | encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!)
@param mixed $var any number, boolean, string, array, or object to be encoded.
see argument 1 to Services_JSON() above for array-parsing behavior.
if var is a strng, note that encode() always expects it
to be in A... | [
"encodes",
"an",
"arbitrary",
"variable",
"into",
"JSON",
"format",
"without",
"JSON",
"Header",
"-",
"warning",
"-",
"may",
"allow",
"XSS!!!!",
")"
] | d91bedd91ea75793512a921bfd9aa83e86a6f0a7 | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/JSON/JSON.php#L271-L280 |
14,553 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php | KeyframesRuleSet.setKeyframes | public function setKeyframes($keyframes)
{
$this->keyframes = [];
if (!is_array($keyframes)) {
$keyframes = [$keyframes];
}
foreach ($keyframes as $keyframe) {
$this->addKeyframe($keyframe);
}
return $this;
} | php | public function setKeyframes($keyframes)
{
$this->keyframes = [];
if (!is_array($keyframes)) {
$keyframes = [$keyframes];
}
foreach ($keyframes as $keyframe) {
$this->addKeyframe($keyframe);
}
return $this;
} | [
"public",
"function",
"setKeyframes",
"(",
"$",
"keyframes",
")",
"{",
"$",
"this",
"->",
"keyframes",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"keyframes",
")",
")",
"{",
"$",
"keyframes",
"=",
"[",
"$",
"keyframes",
"]",
";",
"}"... | Sets the keyframes.
@param KeyframesKeyframe[]|KeyframesKeyframe $keyframes
@return $this | [
"Sets",
"the",
"keyframes",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php#L41-L52 |
14,554 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php | KeyframesRuleSet.addDeclaration | public function addDeclaration(DeclarationAbstract $declaration)
{
// TODO Selectors (or keyframes in this case) do NOT cascade!
// The last one overwrites previous ones
// @see: https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#When_a_keyframe_is_defined_multiple_times
if... | php | public function addDeclaration(DeclarationAbstract $declaration)
{
// TODO Selectors (or keyframes in this case) do NOT cascade!
// The last one overwrites previous ones
// @see: https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#When_a_keyframe_is_defined_multiple_times
if... | [
"public",
"function",
"addDeclaration",
"(",
"DeclarationAbstract",
"$",
"declaration",
")",
"{",
"// TODO Selectors (or keyframes in this case) do NOT cascade!",
"// The last one overwrites previous ones",
"// @see: https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#When_a_keyframe_i... | Adds a keyframes declaration.
@param KeyframesDeclaration $declaration
@return $this | [
"Adds",
"a",
"keyframes",
"declaration",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php#L83-L98 |
14,555 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php | KeyframesRuleSet.parseKeyframeList | protected function parseKeyframeList($keyframeList)
{
foreach (explode(",", $keyframeList) as $keyframe) {
$keyframe = trim($keyframe, " \r\n\t\f");
$this->addKeyframe(new KeyframesKeyframe($keyframe, $this->getStyleSheet()));
}
} | php | protected function parseKeyframeList($keyframeList)
{
foreach (explode(",", $keyframeList) as $keyframe) {
$keyframe = trim($keyframe, " \r\n\t\f");
$this->addKeyframe(new KeyframesKeyframe($keyframe, $this->getStyleSheet()));
}
} | [
"protected",
"function",
"parseKeyframeList",
"(",
"$",
"keyframeList",
")",
"{",
"foreach",
"(",
"explode",
"(",
"\",\"",
",",
"$",
"keyframeList",
")",
"as",
"$",
"keyframe",
")",
"{",
"$",
"keyframe",
"=",
"trim",
"(",
"$",
"keyframe",
",",
"\" \\r\\n\\... | Parses a string of keyframes.
@param string $keyframeList | [
"Parses",
"a",
"string",
"of",
"keyframes",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php#L105-L111 |
14,556 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.addMenu | public function addMenu()
{
add_submenu_page(
'tools.php',
__('StaticWP', $this->plugin),
__('StaticWP', $this->plugin),
'manage_options',
$this->plugin,
array($this, 'viewPage')
);
} | php | public function addMenu()
{
add_submenu_page(
'tools.php',
__('StaticWP', $this->plugin),
__('StaticWP', $this->plugin),
'manage_options',
$this->plugin,
array($this, 'viewPage')
);
} | [
"public",
"function",
"addMenu",
"(",
")",
"{",
"add_submenu_page",
"(",
"'tools.php'",
",",
"__",
"(",
"'StaticWP'",
",",
"$",
"this",
"->",
"plugin",
")",
",",
"__",
"(",
"'StaticWP'",
",",
"$",
"this",
"->",
"plugin",
")",
",",
"'manage_options'",
","... | Creates menu for StaticWP admin pages.
@since 1.3.0
@return void | [
"Creates",
"menu",
"for",
"StaticWP",
"admin",
"pages",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L90-L100 |
14,557 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.deactivate | public function deactivate()
{
$muPluginFile = WP_CONTENT_DIR . '/mu-plugins/' . $this->plugin . '-mu.php';
if (is_file($muPluginFile)) {
unlink($muPluginFile);
}
if (is_dir($this->destination)) {
$this->rrmdir(dirname($this->destination));
}
... | php | public function deactivate()
{
$muPluginFile = WP_CONTENT_DIR . '/mu-plugins/' . $this->plugin . '-mu.php';
if (is_file($muPluginFile)) {
unlink($muPluginFile);
}
if (is_dir($this->destination)) {
$this->rrmdir(dirname($this->destination));
}
... | [
"public",
"function",
"deactivate",
"(",
")",
"{",
"$",
"muPluginFile",
"=",
"WP_CONTENT_DIR",
".",
"'/mu-plugins/'",
".",
"$",
"this",
"->",
"plugin",
".",
"'-mu.php'",
";",
"if",
"(",
"is_file",
"(",
"$",
"muPluginFile",
")",
")",
"{",
"unlink",
"(",
"... | Cleans up after itself on deactivation.
@since 1.1.0
@return void | [
"Cleans",
"up",
"after",
"itself",
"on",
"deactivation",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L109-L123 |
14,558 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.displayNotices | public static function displayNotices()
{
if ($notices = get_option('staticwp_deferred_admin_notices')) {
foreach ($notices as $notice) {
$message = $notice;
$type = 'updated';
if (is_array($notice)) {
$message = isset($notice[... | php | public static function displayNotices()
{
if ($notices = get_option('staticwp_deferred_admin_notices')) {
foreach ($notices as $notice) {
$message = $notice;
$type = 'updated';
if (is_array($notice)) {
$message = isset($notice[... | [
"public",
"static",
"function",
"displayNotices",
"(",
")",
"{",
"if",
"(",
"$",
"notices",
"=",
"get_option",
"(",
"'staticwp_deferred_admin_notices'",
")",
")",
"{",
"foreach",
"(",
"$",
"notices",
"as",
"$",
"notice",
")",
"{",
"$",
"message",
"=",
"$",... | Displays admin notices.
@since 1.3.0
@return void | [
"Displays",
"admin",
"notices",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L132-L148 |
14,559 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.errorToException | public static function errorToException($num, $mes, $file = null, $line = null, $context = null)
{
throw new Exception($mes, $num);
} | php | public static function errorToException($num, $mes, $file = null, $line = null, $context = null)
{
throw new Exception($mes, $num);
} | [
"public",
"static",
"function",
"errorToException",
"(",
"$",
"num",
",",
"$",
"mes",
",",
"$",
"file",
"=",
"null",
",",
"$",
"line",
"=",
"null",
",",
"$",
"context",
"=",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"mes",
",",
"$",
... | Error handler to convert errors to exceptions to make it
easier to catch them.
@param int $num
@param string $mes
@param string $file
@param int $line
@param array $context
@return bool | [
"Error",
"handler",
"to",
"convert",
"errors",
"to",
"exceptions",
"to",
"make",
"it",
"easier",
"to",
"catch",
"them",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L162-L165 |
14,560 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.handlePost | public function handlePost()
{
if (!isset($_POST['staticwp-action'])) {
return;
}
if (!check_admin_referer('staticwp')) {
return;
}
switch ($_POST['staticwp-action']) {
case 'preload':
set_error_handler(array(__CLASS__, 'er... | php | public function handlePost()
{
if (!isset($_POST['staticwp-action'])) {
return;
}
if (!check_admin_referer('staticwp')) {
return;
}
switch ($_POST['staticwp-action']) {
case 'preload':
set_error_handler(array(__CLASS__, 'er... | [
"public",
"function",
"handlePost",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_POST",
"[",
"'staticwp-action'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"check_admin_referer",
"(",
"'staticwp'",
")",
")",
"{",
"return",
";",
"... | Handles form submission on StaticWP admin pages.
@return void | [
"Handles",
"form",
"submission",
"on",
"StaticWP",
"admin",
"pages",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L172-L202 |
14,561 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.update | public function update()
{
$version = get_option($this->plugin . 'version');
if ($version != STATICWP_VERSION) {
update_option($this->plugin . 'version', STATICWP_VERSION);
}
} | php | public function update()
{
$version = get_option($this->plugin . 'version');
if ($version != STATICWP_VERSION) {
update_option($this->plugin . 'version', STATICWP_VERSION);
}
} | [
"public",
"function",
"update",
"(",
")",
"{",
"$",
"version",
"=",
"get_option",
"(",
"$",
"this",
"->",
"plugin",
".",
"'version'",
")",
";",
"if",
"(",
"$",
"version",
"!=",
"STATICWP_VERSION",
")",
"{",
"update_option",
"(",
"$",
"this",
"->",
"plu... | Handles plugin updates.
@since 1.3.0
@return void | [
"Handles",
"plugin",
"updates",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L231-L237 |
14,562 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.viewPage | public function viewPage()
{
$page = isset($_GET['sub']) ? (string)$_GET['sub'] : self::DEFAULT_SUB_PAGE;
View::page('admin/' . $page);
} | php | public function viewPage()
{
$page = isset($_GET['sub']) ? (string)$_GET['sub'] : self::DEFAULT_SUB_PAGE;
View::page('admin/' . $page);
} | [
"public",
"function",
"viewPage",
"(",
")",
"{",
"$",
"page",
"=",
"isset",
"(",
"$",
"_GET",
"[",
"'sub'",
"]",
")",
"?",
"(",
"string",
")",
"$",
"_GET",
"[",
"'sub'",
"]",
":",
"self",
"::",
"DEFAULT_SUB_PAGE",
";",
"View",
"::",
"page",
"(",
... | Displays a page.
@since 1.4.2
@return void | [
"Displays",
"a",
"page",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L261-L265 |
14,563 | slogsdon/staticwp | includes/staticwp-admin.class.php | Admin.preload | protected function preload($post_type = 'post')
{
$args = array(
'fields' => 'ids',
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
'post_type' => $post_type,
'showposts... | php | protected function preload($post_type = 'post')
{
$args = array(
'fields' => 'ids',
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
'post_type' => $post_type,
'showposts... | [
"protected",
"function",
"preload",
"(",
"$",
"post_type",
"=",
"'post'",
")",
"{",
"$",
"args",
"=",
"array",
"(",
"'fields'",
"=>",
"'ids'",
",",
"'orderby'",
"=>",
"'post_date'",
",",
"'order'",
"=>",
"'DESC'",
",",
"'post_status'",
"=>",
"'publish'",
"... | Loops through posts to compile static HTML for each.
@since 1.3.0
@return void | [
"Loops",
"through",
"posts",
"to",
"compile",
"static",
"HTML",
"for",
"each",
"."
] | e96811e57c521b0dc28fc600647b89828cdba8c0 | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L288-L307 |
14,564 | jan-dolata/crude-crud | src/Engine/Helpers/CrudeFiles.php | CrudeFiles.upload | public function upload($model, $folderName, $files, $fileAttrName = 'files', $width = null)
{
$updatedFiles = $model->$fileAttrName;
foreach ($files as $file) {
$log = (new FileLog)->create([
'model_id' => $model->id,
'model_name' => $folderName,
... | php | public function upload($model, $folderName, $files, $fileAttrName = 'files', $width = null)
{
$updatedFiles = $model->$fileAttrName;
foreach ($files as $file) {
$log = (new FileLog)->create([
'model_id' => $model->id,
'model_name' => $folderName,
... | [
"public",
"function",
"upload",
"(",
"$",
"model",
",",
"$",
"folderName",
",",
"$",
"files",
",",
"$",
"fileAttrName",
"=",
"'files'",
",",
"$",
"width",
"=",
"null",
")",
"{",
"$",
"updatedFiles",
"=",
"$",
"model",
"->",
"$",
"fileAttrName",
";",
... | Upload files for model, without save model
@param Model $model - with 'files' attribute
@param string $folderName
@param Files $files
@return Model | [
"Upload",
"files",
"for",
"model",
"without",
"save",
"model"
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Helpers/CrudeFiles.php#L21-L59 |
14,565 | jan-dolata/crude-crud | src/Engine/Helpers/CrudeFiles.php | CrudeFiles.delete | public function delete($model, $log, $fileAttrName = 'files', $fileLogId = 0)
{
$updatedFiles = [];
if ($log)
$fileLogId = $log->id;
$fileToDelete = [];
foreach ($model->files as $file) {
if ($file['file_log_id'] == $fileLogId)
$fileToDelete =... | php | public function delete($model, $log, $fileAttrName = 'files', $fileLogId = 0)
{
$updatedFiles = [];
if ($log)
$fileLogId = $log->id;
$fileToDelete = [];
foreach ($model->files as $file) {
if ($file['file_log_id'] == $fileLogId)
$fileToDelete =... | [
"public",
"function",
"delete",
"(",
"$",
"model",
",",
"$",
"log",
",",
"$",
"fileAttrName",
"=",
"'files'",
",",
"$",
"fileLogId",
"=",
"0",
")",
"{",
"$",
"updatedFiles",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"log",
")",
"$",
"fileLogId",
"=",
"... | Delete file for model, without save model
@param Model $model
@param FileLog $log
@param String $fileAttrName = 'files'
@param String $fileLogId = 0 - used when log is missing
@return Model | [
"Delete",
"file",
"for",
"model",
"without",
"save",
"model"
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Helpers/CrudeFiles.php#L82-L106 |
14,566 | activecollab/databasestructure | src/Field/Scalar/Traits/SizeInterface/Implementation.php | Implementation.getSupportedSizes | protected function getSupportedSizes()
{
return [FieldInterface::SIZE_TINY, FieldInterface::SIZE_SMALL, FieldInterface::SIZE_MEDIUM, FieldInterface::SIZE_NORMAL, FieldInterface::SIZE_BIG];
} | php | protected function getSupportedSizes()
{
return [FieldInterface::SIZE_TINY, FieldInterface::SIZE_SMALL, FieldInterface::SIZE_MEDIUM, FieldInterface::SIZE_NORMAL, FieldInterface::SIZE_BIG];
} | [
"protected",
"function",
"getSupportedSizes",
"(",
")",
"{",
"return",
"[",
"FieldInterface",
"::",
"SIZE_TINY",
",",
"FieldInterface",
"::",
"SIZE_SMALL",
",",
"FieldInterface",
"::",
"SIZE_MEDIUM",
",",
"FieldInterface",
"::",
"SIZE_NORMAL",
",",
"FieldInterface",
... | Return an array of supported sizes.
@return array | [
"Return",
"an",
"array",
"of",
"supported",
"sizes",
"."
] | 4b2353c4422186bcfce63b3212da3e70e63eb5df | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Scalar/Traits/SizeInterface/Implementation.php#L54-L57 |
14,567 | okvpn/fixture-bundle | src/Command/LoadDataFixturesCommand.php | LoadDataFixturesCommand.outputFixtures | protected function outputFixtures(InputInterface $input, OutputInterface $output, $fixtures)
{
$output->writeln(
sprintf(
'List of "%s" data fixtures ...',
$this->getTypeOfFixtures($input)
)
);
foreach ($fixtures as $fixture) {
... | php | protected function outputFixtures(InputInterface $input, OutputInterface $output, $fixtures)
{
$output->writeln(
sprintf(
'List of "%s" data fixtures ...',
$this->getTypeOfFixtures($input)
)
);
foreach ($fixtures as $fixture) {
... | [
"protected",
"function",
"outputFixtures",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"fixtures",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'List of \"%s\" data fixtures ...'",
",",
"$",
"this",
"-... | Output list of fixtures
@param InputInterface $input
@param OutputInterface $output
@param array $fixtures | [
"Output",
"list",
"of",
"fixtures"
] | 243b5e4dff9773e97fa447280e929c936a5d66ae | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Command/LoadDataFixturesCommand.php#L133-L144 |
14,568 | comelyio/comely | src/Comely/IO/Events/EventsHandler.php | EventsHandler.on | public function on(string $tag): Event
{
// Look for existing Event
$event = $this->events[$tag] ?? null;
if ($event) { // Found?
return $event; // Return existing Event
}
// Register and return instance of new Event
return $this->events[$tag] = new Event... | php | public function on(string $tag): Event
{
// Look for existing Event
$event = $this->events[$tag] ?? null;
if ($event) { // Found?
return $event; // Return existing Event
}
// Register and return instance of new Event
return $this->events[$tag] = new Event... | [
"public",
"function",
"on",
"(",
"string",
"$",
"tag",
")",
":",
"Event",
"{",
"// Look for existing Event",
"$",
"event",
"=",
"$",
"this",
"->",
"events",
"[",
"$",
"tag",
"]",
"??",
"null",
";",
"if",
"(",
"$",
"event",
")",
"{",
"// Found?",
"ret... | Returns a registered Event if exists, otherwise creates a new Event
@param string $tag
@return Event | [
"Returns",
"a",
"registered",
"Event",
"if",
"exists",
"otherwise",
"creates",
"a",
"new",
"Event"
] | 561ea7aef36fea347a1a79d3ee5597d4057ddf82 | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Events/EventsHandler.php#L43-L53 |
14,569 | kderyabin/logger | src/Utils/Stringer.php | Stringer.stringify | public static function stringify($value)
{
if (is_string($value)) {
return $value;
}
if ($value === null || is_bool($value)) {
return var_export($value, true);
}
if (is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) {
... | php | public static function stringify($value)
{
if (is_string($value)) {
return $value;
}
if ($value === null || is_bool($value)) {
return var_export($value, true);
}
if (is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) {
... | [
"public",
"static",
"function",
"stringify",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"value",
"===",
"null",
"||",
"is_bool",
"(",
"$",
"value",
")",
... | Converts a value into a string.
@param mixed $value
@return string | [
"Converts",
"a",
"value",
"into",
"a",
"string",
"."
] | 683890192b37fe9d36611972e12c2994669f5b85 | https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/Utils/Stringer.php#L19-L32 |
14,570 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intAdd | public function intAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new IntType($a() + $b());
} | php | public function intAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new IntType($a() + $b());
} | [
"public",
"function",
"intAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"IntType",
"(",
... | Integer type addition
@param NI $a first operand
@param NI $b second operand
@return IntType | [
"Integer",
"type",
"addition"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L54-L59 |
14,571 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intSub | public function intSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new IntType($a() - $b());
} | php | public function intSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new IntType($a() - $b());
} | [
"public",
"function",
"intSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"IntType",
"(",
... | Integer type subtraction
@param NI $a first operand
@param NI $b second operand
@return IntType | [
"Integer",
"type",
"subtraction"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L69-L74 |
14,572 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intMul | public function intMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new IntType($a() * $b());
} | php | public function intMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new IntType($a() * $b());
} | [
"public",
"function",
"intMul",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"IntType",
"(",
... | Integer type multiplication
@param NI $a first operand
@param NI $b second operand
@return IntType | [
"Integer",
"type",
"multiplication"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L84-L89 |
14,573 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intPow | public function intPow(IntType $a, NI $exp)
{
if ($exp instanceof RationalType) {
$b = new RationalType(clone $a, new IntType(1));
return $this->rationalPow($b, $exp);
}
if ($exp instanceof ComplexType) {
return $this->intComplexPow($a(), $exp);
}... | php | public function intPow(IntType $a, NI $exp)
{
if ($exp instanceof RationalType) {
$b = new RationalType(clone $a, new IntType(1));
return $this->rationalPow($b, $exp);
}
if ($exp instanceof ComplexType) {
return $this->intComplexPow($a(), $exp);
}... | [
"public",
"function",
"intPow",
"(",
"IntType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"RationalType",
")",
"{",
"$",
"b",
"=",
"new",
"RationalType",
"(",
"clone",
"$",
"a",
",",
"new",
"IntType",
"(",
"1",... | Integer Pow - raise number to the exponent
Will return an IntType, RationalType or ComplexType
@param IntType $a operand
@param NI $exp Exponent
@return NI | [
"Integer",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"an",
"IntType",
"RationalType",
"or",
"ComplexType"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L115-L133 |
14,574 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intSqrt | public function intSqrt(IntType $a)
{
$res = $this->rationalSqrt(new RationalType($a, new IntType(1)));
if ($res->isInteger()) {
return $res->numerator();
}
return $res;
} | php | public function intSqrt(IntType $a)
{
$res = $this->rationalSqrt(new RationalType($a, new IntType(1)));
if ($res->isInteger()) {
return $res->numerator();
}
return $res;
} | [
"public",
"function",
"intSqrt",
"(",
"IntType",
"$",
"a",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"rationalSqrt",
"(",
"new",
"RationalType",
"(",
"$",
"a",
",",
"new",
"IntType",
"(",
"1",
")",
")",
")",
";",
"if",
"(",
"$",
"res",
"->",
... | Integer sqrt
Return IntType for perfect squares, else RationalType
@param IntType $a operand
@return IntType|RationalType result | [
"Integer",
"sqrt",
"Return",
"IntType",
"for",
"perfect",
"squares",
"else",
"RationalType"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L143-L151 |
14,575 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.floatPow | public function floatPow(FloatType $a, NI $exp)
{
if ($exp instanceof RationalType) {
$b = RationalTypeFactory::fromFloat($a());
return $this->rationalPow($b, $exp)->asFloatType();
}
if ($exp instanceof ComplexType) {
return $this->floatComplexPow($a(), $... | php | public function floatPow(FloatType $a, NI $exp)
{
if ($exp instanceof RationalType) {
$b = RationalTypeFactory::fromFloat($a());
return $this->rationalPow($b, $exp)->asFloatType();
}
if ($exp instanceof ComplexType) {
return $this->floatComplexPow($a(), $... | [
"public",
"function",
"floatPow",
"(",
"FloatType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"RationalType",
")",
"{",
"$",
"b",
"=",
"RationalTypeFactory",
"::",
"fromFloat",
"(",
"$",
"a",
"(",
")",
")",
";",
... | Float Pow - raise number to the exponent
Will return a float type
@param FloatType $a operand
@param NI $exp Exponent
@return FloatType | [
"Float",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"a",
"float",
"type"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L230-L245 |
14,576 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.wholeAdd | public function wholeAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() + $b());
} | php | public function wholeAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() + $b());
} | [
"public",
"function",
"wholeAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"WholeIntType",
... | Whole number addition
@param NI $a first operand
@param NI $b second operand
@return WholeIntType | [
"Whole",
"number",
"addition"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L267-L271 |
14,577 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.wholeSub | public function wholeSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() - $b());
} | php | public function wholeSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() - $b());
} | [
"public",
"function",
"wholeSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"WholeIntType",
... | Whole number subtraction
@param NI $a first operand
@param NI $b second operand
@return WholeIntType | [
"Whole",
"number",
"subtraction"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L281-L285 |
14,578 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.wholeMul | public function wholeMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() * $b());
} | php | public function wholeMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() * $b());
} | [
"public",
"function",
"wholeMul",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"WholeIntType",
... | Whole number multiplication
@param NI $a first operand
@param NI $b second operand
@return WholeIntType | [
"Whole",
"number",
"multiplication"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L295-L299 |
14,579 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.naturalAdd | public function naturalAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() + $b());
} | php | public function naturalAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() + $b());
} | [
"public",
"function",
"naturalAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"NaturalIntType... | Natural number addition
@param NI $a first operand
@param NI $b second operand
@return NaturalIntType | [
"Natural",
"number",
"addition"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L309-L313 |
14,580 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.naturalSub | public function naturalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() - $b());
} | php | public function naturalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() - $b());
} | [
"public",
"function",
"naturalSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"NaturalIntType... | Natural number subtraction
@param NI $a first operand
@param NI $b second operand
@return NaturalIntType | [
"Natural",
"number",
"subtraction"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L323-L327 |
14,581 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.naturalMul | public function naturalMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() * $b());
} | php | public function naturalMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() * $b());
} | [
"public",
"function",
"naturalMul",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"NaturalIntType... | Natural number multiplication
@param NI $a first operand
@param NI $b second operand
@return NaturalIntType | [
"Natural",
"number",
"multiplication"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L337-L341 |
14,582 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalAdd | public function rationalAdd(NI $a, NI $b)
{
if (!$a instanceof RationalType) {
$a = $a->asRational();
}
if (!$b instanceof RationalType) {
$b = $b->asRational();
}
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()... | php | public function rationalAdd(NI $a, NI $b)
{
if (!$a instanceof RationalType) {
$a = $a->asRational();
}
if (!$b instanceof RationalType) {
$b = $b->asRational();
}
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()... | [
"public",
"function",
"rationalAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"if",
"(",
"!",
"$",
"a",
"instanceof",
"RationalType",
")",
"{",
"$",
"a",
"=",
"$",
"a",
"->",
"asRational",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"... | Rational number addition
@param NI $a first operand
@param NI $b second operand
@return RationalType | [
"Rational",
"number",
"addition"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L351-L366 |
14,583 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalSub | public function rationalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()->get()));
$nn = $this->rationalDiv($this->rationalMul($a->numerator(), $d), $a->denominator())->get();
... | php | public function rationalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()->get()));
$nn = $this->rationalDiv($this->rationalMul($a->numerator(), $d), $a->denominator())->get();
... | [
"public",
"function",
"rationalSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkRationalTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"$",
"d",
"=",
"Rational... | Rational number subtraction
@param NI $a first operand
@param NI $b second operand
@return RationalType | [
"Rational",
"number",
"subtraction"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L376-L385 |
14,584 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalDiv | public function rationalDiv(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$n = $this->intMul($a->numerator(), $b->denominator());
$d = $this->intMul($a->denominator(), $b->numerator());
return RationalTypeFactory::create($n, $d);
} | php | public function rationalDiv(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$n = $this->intMul($a->numerator(), $b->denominator());
$d = $this->intMul($a->denominator(), $b->numerator());
return RationalTypeFactory::create($n, $d);
} | [
"public",
"function",
"rationalDiv",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkRationalTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"$",
"n",
"=",
"$",
"t... | Rational number division
@param NI $a first operand
@param NI $b second operand
@return RationalType | [
"Rational",
"number",
"division"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L412-L419 |
14,585 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalPow | public function rationalPow(RationalType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$r = $this->floatComplexPow($a(), $exp);
if ($r instanceof FloatType) {
return RationalTypeFactory::fromFloat($r());
}
return $r;
}
$exp... | php | public function rationalPow(RationalType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$r = $this->floatComplexPow($a(), $exp);
if ($r instanceof FloatType) {
return RationalTypeFactory::fromFloat($r());
}
return $r;
}
$exp... | [
"public",
"function",
"rationalPow",
"(",
"RationalType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"ComplexType",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"floatComplexPow",
"(",
"$",
"a",
"(",
")",
",",
"$... | Rational Pow - raise number to the exponent
Will return a RationalType
@param RationalType $a operand
@param NI $exp exponent
@return NI | [
"Rational",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"a",
"RationalType"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L442-L459 |
14,586 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexAdd | public function complexAdd(ComplexType $a, ComplexType $b)
{
$r = $this->rationalAdd($a->r(), $b->r());
$i = $this->rationalAdd($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | php | public function complexAdd(ComplexType $a, ComplexType $b)
{
$r = $this->rationalAdd($a->r(), $b->r());
$i = $this->rationalAdd($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | [
"public",
"function",
"complexAdd",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"rationalAdd",
"(",
"$",
"a",
"->",
"r",
"(",
")",
",",
"$",
"b",
"->",
"r",
"(",
")",
")",
";",
"$",
... | Complex number addition
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType | [
"Complex",
"number",
"addition"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L487-L492 |
14,587 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexSub | public function complexSub(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub($a->r(), $b->r());
$i = $this->rationalSub($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | php | public function complexSub(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub($a->r(), $b->r());
$i = $this->rationalSub($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | [
"public",
"function",
"complexSub",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"rationalSub",
"(",
"$",
"a",
"->",
"r",
"(",
")",
",",
"$",
"b",
"->",
"r",
"(",
")",
")",
";",
"$",
... | Complex number subtraction
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType | [
"Complex",
"number",
"subtraction"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L502-L507 |
14,588 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexMul | public function complexMul(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub(
$this->rationalMul($a->r(), $b->r()),
$this->rationalMul($a->i(), $b->i())
);
$i = $this->rationalAdd(
$this->rationalMul($a->i(), $b->r()),
$this->rationalMu... | php | public function complexMul(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub(
$this->rationalMul($a->r(), $b->r()),
$this->rationalMul($a->i(), $b->i())
);
$i = $this->rationalAdd(
$this->rationalMul($a->i(), $b->r()),
$this->rationalMu... | [
"public",
"function",
"complexMul",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"rationalSub",
"(",
"$",
"this",
"->",
"rationalMul",
"(",
"$",
"a",
"->",
"r",
"(",
")",
",",
"$",
"b",
"... | Complex number multiplication
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType | [
"Complex",
"number",
"multiplication"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L517-L528 |
14,589 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexDiv | public function complexDiv(ComplexType $a, ComplexType $b)
{
if ($b->isZero()) {
throw new \BadMethodCallException('Cannot divide complex number by zero complex number');
}
//div = br^2 + bi^2
$div = $this->rationalAdd(
$this->rationalMul($b->r(), $b->r()),
... | php | public function complexDiv(ComplexType $a, ComplexType $b)
{
if ($b->isZero()) {
throw new \BadMethodCallException('Cannot divide complex number by zero complex number');
}
//div = br^2 + bi^2
$div = $this->rationalAdd(
$this->rationalMul($b->r(), $b->r()),
... | [
"public",
"function",
"complexDiv",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"b",
"->",
"isZero",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'Cannot divide complex number by zero compl... | Complex number division
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType
@throws \BadMethodCallException | [
"Complex",
"number",
"division"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L540-L568 |
14,590 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexPow | public function complexPow(ComplexType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$comp = new Comparator();
$zero = new IntType(0);
$real = 0;
$imaginary = 0;
if (!($comp->eq($a->r(), $zero) && $comp->eq($a->i(), $zero))) {
l... | php | public function complexPow(ComplexType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$comp = new Comparator();
$zero = new IntType(0);
$real = 0;
$imaginary = 0;
if (!($comp->eq($a->r(), $zero) && $comp->eq($a->i(), $zero))) {
l... | [
"public",
"function",
"complexPow",
"(",
"ComplexType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"ComplexType",
")",
"{",
"$",
"comp",
"=",
"new",
"Comparator",
"(",
")",
";",
"$",
"zero",
"=",
"new",
"IntType",... | Complex Pow - raise number to the exponent
Will return a ComplexType
Exponent must be non complex
@param ComplexType $a operand
@param NI $exp Exponent
@return ComplexType
@throws \InvalidArgumentException If exponent is complex | [
"Complex",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"a",
"ComplexType",
"Exponent",
"must",
"be",
"non",
"complex"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L606-L636 |
14,591 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intComplexPow | private function intComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new IntType(1);
}
return $this->complexExponent($a, $exp);
} | php | private function intComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new IntType(1);
}
return $this->complexExponent($a, $exp);
} | [
"private",
"function",
"intComplexPow",
"(",
"$",
"a",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"->",
"isZero",
"(",
")",
")",
"{",
"return",
"new",
"IntType",
"(",
"1",
")",
";",
"}",
"return",
"$",
"this",
"->",
"complexEx... | Create Complex power from an integer
@param int $a operand
@param ComplexType $exp exponent
@return NI|ComplexType|IntType | [
"Create",
"Complex",
"power",
"from",
"an",
"integer"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L676-L682 |
14,592 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.floatComplexPow | private function floatComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new FloatType(1);
}
return $this->complexExponent($a, $exp);
} | php | private function floatComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new FloatType(1);
}
return $this->complexExponent($a, $exp);
} | [
"private",
"function",
"floatComplexPow",
"(",
"$",
"a",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"->",
"isZero",
"(",
")",
")",
"{",
"return",
"new",
"FloatType",
"(",
"1",
")",
";",
"}",
"return",
"$",
"this",
"->",
"compl... | Create complex power from a float
@param float $a operand
@param ComplexType $exp exponent
@return NI|ComplexType|FloatType | [
"Create",
"complex",
"power",
"from",
"a",
"float"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L692-L698 |
14,593 | chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexExponent | private function complexExponent($base, ComplexType $exp)
{
if ($exp->isReal()) {
return $this->rationalPow(
RationalTypeFactory::fromFloat($base),
$exp->r()
);
}
//do the imaginary part
//n^bi = cos(b.lg(n)) + i.sin(b.lg(n))
... | php | private function complexExponent($base, ComplexType $exp)
{
if ($exp->isReal()) {
return $this->rationalPow(
RationalTypeFactory::fromFloat($base),
$exp->r()
);
}
//do the imaginary part
//n^bi = cos(b.lg(n)) + i.sin(b.lg(n))
... | [
"private",
"function",
"complexExponent",
"(",
"$",
"base",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"->",
"isReal",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"rationalPow",
"(",
"RationalTypeFactory",
"::",
"fromFloat",
"(... | Create complex power from natural base and complex exponent
@param int|float $base base
@param ComplexType $exp exponent
@return NI|ComplexType | [
"Create",
"complex",
"power",
"from",
"natural",
"base",
"and",
"complex",
"exponent"
] | 2a2fae0ab4d052772d3dd45745efd5a91f88b9e3 | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L708-L740 |
14,594 | jasny/router | src/Router/Runner/Delegate.php | Delegate.getRunner | public function getRunner(Route $route)
{
if (isset($route->controller)) {
$class = Runner\Controller::class;
} elseif (isset($route->fn)) {
$class = Runner\Callback::class;
} elseif (isset($route->file)) {
$class = Runner\PhpScript::class;
} else ... | php | public function getRunner(Route $route)
{
if (isset($route->controller)) {
$class = Runner\Controller::class;
} elseif (isset($route->fn)) {
$class = Runner\Callback::class;
} elseif (isset($route->file)) {
$class = Runner\PhpScript::class;
} else ... | [
"public",
"function",
"getRunner",
"(",
"Route",
"$",
"route",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"route",
"->",
"controller",
")",
")",
"{",
"$",
"class",
"=",
"Runner",
"\\",
"Controller",
"::",
"class",
";",
"}",
"elseif",
"(",
"isset",
"(",
... | Create Runner instance
@param Route $route
@return Runner | [
"Create",
"Runner",
"instance"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Runner/Delegate.php#L24-L38 |
14,595 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php | GroupedItemsPriceCalculator.addPriceToPriceGroup | protected function addPriceToPriceGroup($price, $item, &$groupPrices, &$groupedItems)
{
$itemPriceGroup = $item->getCalcPriceGroup();
if ($itemPriceGroup === null) {
$itemPriceGroup = 'undefined';
}
if (!isset($groupPrices[$itemPriceGroup])) {
$groupPrices[$... | php | protected function addPriceToPriceGroup($price, $item, &$groupPrices, &$groupedItems)
{
$itemPriceGroup = $item->getCalcPriceGroup();
if ($itemPriceGroup === null) {
$itemPriceGroup = 'undefined';
}
if (!isset($groupPrices[$itemPriceGroup])) {
$groupPrices[$... | [
"protected",
"function",
"addPriceToPriceGroup",
"(",
"$",
"price",
",",
"$",
"item",
",",
"&",
"$",
"groupPrices",
",",
"&",
"$",
"groupedItems",
")",
"{",
"$",
"itemPriceGroup",
"=",
"$",
"item",
"->",
"getCalcPriceGroup",
"(",
")",
";",
"if",
"(",
"$"... | adds price to a price-group
@param $price
@param $item
@param $groupPrices
@param $groupedItems
@internal param $itemPriceGroup | [
"adds",
"price",
"to",
"a",
"price",
"-",
"group"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php#L82-L112 |
14,596 | dragosprotung/stc-core | src/Date/DateTimeZone.php | DateTimeZone.UTCTimeZoneOffset | public function UTCTimeZoneOffset() : int
{
$originDateTime = new \DateTime('now', $this);
$utcTimeZone = new \DateTimeZone('UTC');
$utcDateTime = new \DateTime('now', $utcTimeZone);
return $utcTimeZone->getOffset($utcDateTime) - $this->getOffset($originDateTime);
} | php | public function UTCTimeZoneOffset() : int
{
$originDateTime = new \DateTime('now', $this);
$utcTimeZone = new \DateTimeZone('UTC');
$utcDateTime = new \DateTime('now', $utcTimeZone);
return $utcTimeZone->getOffset($utcDateTime) - $this->getOffset($originDateTime);
} | [
"public",
"function",
"UTCTimeZoneOffset",
"(",
")",
":",
"int",
"{",
"$",
"originDateTime",
"=",
"new",
"\\",
"DateTime",
"(",
"'now'",
",",
"$",
"this",
")",
";",
"$",
"utcTimeZone",
"=",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
")",
";",
"$",
"utc... | Get offset between a time zone and UTC time zone in seconds.
@return integer | [
"Get",
"offset",
"between",
"a",
"time",
"zone",
"and",
"UTC",
"time",
"zone",
"in",
"seconds",
"."
] | 9783e3414294f4ee555a1d538d2807269deeb9e7 | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Date/DateTimeZone.php#L17-L25 |
14,597 | andyvenus/form | src/FormBlueprint.php | FormBlueprint.setFieldOption | public function setFieldOption($field, $option, $value)
{
if (!isset($this->fields[$field])) {
throw new \Exception("Cannot set field option: Field {$field} not found");
}
$this->fields[$field]['options'][$option] = $value;
} | php | public function setFieldOption($field, $option, $value)
{
if (!isset($this->fields[$field])) {
throw new \Exception("Cannot set field option: Field {$field} not found");
}
$this->fields[$field]['options'][$option] = $value;
} | [
"public",
"function",
"setFieldOption",
"(",
"$",
"field",
",",
"$",
"option",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"field",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
... | Override a field option
@param $field
@param $option
@param $value
@return void
@throws \Exception | [
"Override",
"a",
"field",
"option"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L230-L237 |
14,598 | hamjoint/mustard-auctions | src/lib/Http/Controllers/InventoryController.php | InventoryController.getBidding | public function getBidding()
{
$items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
return $query->where('user_id', Auth::user()->userId);
});
$items = Item::typeAuction()->active()->leftJoin('bids')->where(
'bids.user_id',
Auth::u... | php | public function getBidding()
{
$items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
return $query->where('user_id', Auth::user()->userId);
});
$items = Item::typeAuction()->active()->leftJoin('bids')->where(
'bids.user_id',
Auth::u... | [
"public",
"function",
"getBidding",
"(",
")",
"{",
"$",
"items",
"=",
"Item",
"::",
"typeAuction",
"(",
")",
"->",
"active",
"(",
")",
"->",
"whereHas",
"(",
"'bids'",
",",
"function",
"(",
"$",
"query",
")",
"{",
"return",
"$",
"query",
"->",
"where... | Return the inventory bidding items view.
@return \Illuminate\View\View | [
"Return",
"the",
"inventory",
"bidding",
"items",
"view",
"."
] | 66c8723d8681466e280263ad100f3fdc5895480d | https://github.com/hamjoint/mustard-auctions/blob/66c8723d8681466e280263ad100f3fdc5895480d/src/lib/Http/Controllers/InventoryController.php#L37-L58 |
14,599 | codeburnerframework/router | src/Resource.php | Resource.filterByMethod | private function filterByMethod(array $methods, $alt)
{
$methods = array_flip(array_map('strtolower', $methods));
foreach ($this->routes as $route) {
if (isset($methods[$route->getAction()[1]]) === $alt) {
$route->forget();
}
}
} | php | private function filterByMethod(array $methods, $alt)
{
$methods = array_flip(array_map('strtolower', $methods));
foreach ($this->routes as $route) {
if (isset($methods[$route->getAction()[1]]) === $alt) {
$route->forget();
}
}
} | [
"private",
"function",
"filterByMethod",
"(",
"array",
"$",
"methods",
",",
"$",
"alt",
")",
"{",
"$",
"methods",
"=",
"array_flip",
"(",
"array_map",
"(",
"'strtolower'",
",",
"$",
"methods",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
... | Forget the grouped routes filtering by http methods.
@param string[] $methods
@param bool $alt Should remove? | [
"Forget",
"the",
"grouped",
"routes",
"filtering",
"by",
"http",
"methods",
"."
] | 2b0e8030303dd08d3fadfc4c57aa37b184a408cd | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L66-L75 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.