repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
mimmi20/Wurfl | src/Manager.php | Manager.getDeviceForUserAgent | public function getDeviceForUserAgent($userAgent = '')
{
if (!is_string($userAgent)) {
$userAgent = '';
}
$requestFactory = new Request\GenericRequestFactory();
$request = $requestFactory->createRequestForUserAgent($userAgent);
$device = $this->getDeviceForRequ... | php | public function getDeviceForUserAgent($userAgent = '')
{
if (!is_string($userAgent)) {
$userAgent = '';
}
$requestFactory = new Request\GenericRequestFactory();
$request = $requestFactory->createRequestForUserAgent($userAgent);
$device = $this->getDeviceForRequ... | [
"public",
"function",
"getDeviceForUserAgent",
"(",
"$",
"userAgent",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"userAgent",
")",
")",
"{",
"$",
"userAgent",
"=",
"''",
";",
"}",
"$",
"requestFactory",
"=",
"new",
"Request",
"\\",
"Ge... | Returns a device for the given user-agent
@param string $userAgent
@throws Exception if $userAgent is not set
@return \Wurfl\CustomDevice device | [
"Returns",
"a",
"device",
"for",
"the",
"given",
"user",
"-",
"agent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L401-L413 |
mimmi20/Wurfl | src/Manager.php | Manager.getDevice | public function getDevice($deviceId, Request\GenericRequest $request = null)
{
if ($request !== null) {
if (!($request instanceof GenericRequest)) {
throw new \InvalidArgumentException(
'Error: Request parameter must be null or instance of WURFL_Request_Generi... | php | public function getDevice($deviceId, Request\GenericRequest $request = null)
{
if ($request !== null) {
if (!($request instanceof GenericRequest)) {
throw new \InvalidArgumentException(
'Error: Request parameter must be null or instance of WURFL_Request_Generi... | [
"public",
"function",
"getDevice",
"(",
"$",
"deviceId",
",",
"Request",
"\\",
"GenericRequest",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"request",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"request",
"instanceof",
"GenericRequest... | Return a device for the given device id
@param string $deviceId
@param Request\GenericRequest $request
@throws \InvalidArgumentException
@return \Wurfl\Device\ModelDeviceInterface | [
"Return",
"a",
"device",
"for",
"the",
"given",
"device",
"id"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L424-L440 |
mimmi20/Wurfl | src/Manager.php | Manager.getFallBackDevices | public function getFallBackDevices($deviceId)
{
$fallBackDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);
array_shift($fallBackDevices);
return array_map(array($this, 'deviceId'), $fallBackDevices);
} | php | public function getFallBackDevices($deviceId)
{
$fallBackDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);
array_shift($fallBackDevices);
return array_map(array($this, 'deviceId'), $fallBackDevices);
} | [
"public",
"function",
"getFallBackDevices",
"(",
"$",
"deviceId",
")",
"{",
"$",
"fallBackDevices",
"=",
"$",
"this",
"->",
"getDeviceRepository",
"(",
")",
"->",
"getDeviceHierarchy",
"(",
"$",
"deviceId",
")",
";",
"array_shift",
"(",
"$",
"fallBackDevices",
... | Returns an array of all the fall back devices starting from
the given device
@param string $deviceId
@return array | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"fall",
"back",
"devices",
"starting",
"from",
"the",
"given",
"device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L472-L479 |
mimmi20/Wurfl | src/Manager.php | Manager.deviceIdForRequest | private function deviceIdForRequest(Request\GenericRequest $request)
{
$userAgent = $request->getUserAgent();
if (!$userAgent) {
// $request->id is not set
// -> do not try to get info from cache nor try to save to the cache
$request->getMatchInfo()->fromCache =... | php | private function deviceIdForRequest(Request\GenericRequest $request)
{
$userAgent = $request->getUserAgent();
if (!$userAgent) {
// $request->id is not set
// -> do not try to get info from cache nor try to save to the cache
$request->getMatchInfo()->fromCache =... | [
"private",
"function",
"deviceIdForRequest",
"(",
"Request",
"\\",
"GenericRequest",
"$",
"request",
")",
"{",
"$",
"userAgent",
"=",
"$",
"request",
"->",
"getUserAgent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"userAgent",
")",
"{",
"// $request->id is not set",... | Returns the device id for the device that matches the $request
@param \Wurfl\Request\GenericRequest $request WURFL Request object
@return string WURFL device id | [
"Returns",
"the",
"device",
"id",
"for",
"the",
"device",
"that",
"matches",
"the",
"$request"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L510-L547 |
mimmi20/Wurfl | src/Manager.php | Manager.getWrappedDevice | private function getWrappedDevice($deviceId, Request\GenericRequest $request = null)
{
$modelDevices = $this->getCacheStorage()->load('DEVS_' . $deviceId);
if (empty($modelDevices)) {
$modelDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);
}
$this->... | php | private function getWrappedDevice($deviceId, Request\GenericRequest $request = null)
{
$modelDevices = $this->getCacheStorage()->load('DEVS_' . $deviceId);
if (empty($modelDevices)) {
$modelDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);
}
$this->... | [
"private",
"function",
"getWrappedDevice",
"(",
"$",
"deviceId",
",",
"Request",
"\\",
"GenericRequest",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"modelDevices",
"=",
"$",
"this",
"->",
"getCacheStorage",
"(",
")",
"->",
"load",
"(",
"'DEVS_'",
".",
"$"... | Wraps the model device with \Wurfl\Xml\ModelDeviceInterface. This function takes the
Device ID and returns the \Wurfl\CustomDevice with all capabilities.
@param string $deviceId
@param Request\GenericRequest $request
@return \Wurfl\CustomDevice | [
"Wraps",
"the",
"model",
"device",
"with",
"\\",
"Wurfl",
"\\",
"Xml",
"\\",
"ModelDeviceInterface",
".",
"This",
"function",
"takes",
"the",
"Device",
"ID",
"and",
"returns",
"the",
"\\",
"Wurfl",
"\\",
"CustomDevice",
"with",
"all",
"capabilities",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L558-L581 |
codezero-be/flash | src/Flash.php | Flash.info | public function info($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'info', $dismissible);
return $this;
} | php | public function info($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'info', $dismissible);
return $this;
} | [
"public",
"function",
"info",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"dismissible",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"message",
"(",
"$",
"message",
",",
"null",
",",
"$",
"placeholders",
",",
"'info... | Flash an info message.
@param string $message
@param array $placeholders
@param bool $dismissible
@return $this | [
"Flash",
"an",
"info",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L64-L69 |
codezero-be/flash | src/Flash.php | Flash.success | public function success($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'success', $dismissible);
return $this;
} | php | public function success($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'success', $dismissible);
return $this;
} | [
"public",
"function",
"success",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"dismissible",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"message",
"(",
"$",
"message",
",",
"null",
",",
"$",
"placeholders",
",",
"'s... | Flash a success message.
@param string $message
@param array $placeholders
@param bool $dismissible
@return $this | [
"Flash",
"a",
"success",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L80-L85 |
codezero-be/flash | src/Flash.php | Flash.warning | public function warning($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'warning', $dismissible);
return $this;
} | php | public function warning($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'warning', $dismissible);
return $this;
} | [
"public",
"function",
"warning",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"dismissible",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"message",
"(",
"$",
"message",
",",
"null",
",",
"$",
"placeholders",
",",
"'w... | Flash a warning message.
@param string $message
@param array $placeholders
@param bool $dismissible
@return $this | [
"Flash",
"a",
"warning",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L96-L101 |
codezero-be/flash | src/Flash.php | Flash.error | public function error($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'error', $dismissible);
return $this;
} | php | public function error($message, array $placeholders = [], $dismissible = true)
{
$this->message($message, null, $placeholders, 'error', $dismissible);
return $this;
} | [
"public",
"function",
"error",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"dismissible",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"message",
"(",
"$",
"message",
",",
"null",
",",
"$",
"placeholders",
",",
"'err... | Flash an error message.
@param string $message
@param array $placeholders
@param bool $dismissible
@return $this | [
"Flash",
"an",
"error",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L112-L117 |
codezero-be/flash | src/Flash.php | Flash.overlay | public function overlay($message, $title = 'Info', array $placeholders = [])
{
$this->message($message, $title, $placeholders, 'overlay', true, true);
return $this;
} | php | public function overlay($message, $title = 'Info', array $placeholders = [])
{
$this->message($message, $title, $placeholders, 'overlay', true, true);
return $this;
} | [
"public",
"function",
"overlay",
"(",
"$",
"message",
",",
"$",
"title",
"=",
"'Info'",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"message",
"(",
"$",
"message",
",",
"$",
"title",
",",
"$",
"placeholders",
",",
... | Flash an overlay message.
@param string $message
@param string $title
@param array $placeholders
@return $this | [
"Flash",
"an",
"overlay",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L128-L133 |
codezero-be/flash | src/Flash.php | Flash.message | private function message(
$message,
$title = '',
array $placeholders = [],
$level = 'info',
$dismissible = true,
$overlay = false
) {
$message = $this->getTranslation($message, $placeholders);
if ( ! empty($title)) {
$title = $this->getTra... | php | private function message(
$message,
$title = '',
array $placeholders = [],
$level = 'info',
$dismissible = true,
$overlay = false
) {
$message = $this->getTranslation($message, $placeholders);
if ( ! empty($title)) {
$title = $this->getTra... | [
"private",
"function",
"message",
"(",
"$",
"message",
",",
"$",
"title",
"=",
"''",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"level",
"=",
"'info'",
",",
"$",
"dismissible",
"=",
"true",
",",
"$",
"overlay",
"=",
"false",
")",
"... | Flash a message.
@param string $message
@param string $title
@param array $placeholders
@param string $level
@param bool $dismissible
@param bool $overlay
@return $this | [
"Flash",
"a",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L147-L176 |
codezero-be/flash | src/Flash.php | Flash.getExistingFlashMessages | private function getExistingFlashMessages()
{
return $this->session->has($this->sessionKey)
? $this->session->get($this->sessionKey)
: [];
} | php | private function getExistingFlashMessages()
{
return $this->session->has($this->sessionKey)
? $this->session->get($this->sessionKey)
: [];
} | [
"private",
"function",
"getExistingFlashMessages",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"$",
"this",
"->",
"sessionKey",
")",
"?",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"$",
"this",
"->",
"sessionKey",
")",
... | Get messages that have already been flashed.
@return array | [
"Get",
"messages",
"that",
"have",
"already",
"been",
"flashed",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L183-L188 |
codezero-be/flash | src/Flash.php | Flash.getTranslation | private function getTranslation($message, array $placeholders)
{
if ($this->translator->has($message)) {
$message = $this->translator->get($message, $placeholders);
}
return $message;
} | php | private function getTranslation($message, array $placeholders)
{
if ($this->translator->has($message)) {
$message = $this->translator->get($message, $placeholders);
}
return $message;
} | [
"private",
"function",
"getTranslation",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"translator",
"->",
"has",
"(",
"$",
"message",
")",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"translator"... | Get a translation for the message key
or return the original message.
@param string $message
@param array $placeholders
@return string | [
"Get",
"a",
"translation",
"for",
"the",
"message",
"key",
"or",
"return",
"the",
"original",
"message",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/Flash.php#L199-L206 |
venta/framework | src/Console/src/AbstractCommand.php | AbstractCommand.configure | final protected function configure()
{
$signature = (new SignatureParser())->parse($this->signature);
$this->setName($signature['name']);
$this->setDescription($this->description);
foreach ($signature['arguments'] as $argument) {
$this->addArgument(
$arg... | php | final protected function configure()
{
$signature = (new SignatureParser())->parse($this->signature);
$this->setName($signature['name']);
$this->setDescription($this->description);
foreach ($signature['arguments'] as $argument) {
$this->addArgument(
$arg... | [
"final",
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"signature",
"=",
"(",
"new",
"SignatureParser",
"(",
")",
")",
"->",
"parse",
"(",
"$",
"this",
"->",
"signature",
")",
";",
"$",
"this",
"->",
"setName",
"(",
"$",
"signature",
"[",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/AbstractCommand.php#L59-L78 |
delatbabel/site-config | src/Models/Website.php | Website.currentServerName | public static function currentServerName()
{
if (! empty(env('SERVER_NAME'))) {
$BASE_URL = env('SERVER_NAME');
} elseif (! empty($_SERVER['SERVER_NAME'])) {
$BASE_URL = $_SERVER['SERVER_NAME'];
} elseif (! empty($_SERVER['HTTP_HOST'])) {
$BASE_URL = $_SER... | php | public static function currentServerName()
{
if (! empty(env('SERVER_NAME'))) {
$BASE_URL = env('SERVER_NAME');
} elseif (! empty($_SERVER['SERVER_NAME'])) {
$BASE_URL = $_SERVER['SERVER_NAME'];
} elseif (! empty($_SERVER['HTTP_HOST'])) {
$BASE_URL = $_SER... | [
"public",
"static",
"function",
"currentServerName",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"env",
"(",
"'SERVER_NAME'",
")",
")",
")",
"{",
"$",
"BASE_URL",
"=",
"env",
"(",
"'SERVER_NAME'",
")",
";",
"}",
"elseif",
"(",
"!",
"empty",
"(",
"$"... | Determine the current website server name.
This doesn't contain any URL identifiers such as 'http://', just
the host name (e.g. www.myserver.com).
@return string | [
"Determine",
"the",
"current",
"website",
"server",
"name",
"."
] | train | https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Website.php#L49-L61 |
delatbabel/site-config | src/Models/Website.php | Website.currentWebsiteData | public static function currentWebsiteData()
{
static $current_data;
$BASE_URL = static::currentServerName();
$cache_key = 'website-data.' . $BASE_URL;
// Get the current ID from the cache if it is present.
if (empty($current_data)) {
if (Cache::has($cache_key)) ... | php | public static function currentWebsiteData()
{
static $current_data;
$BASE_URL = static::currentServerName();
$cache_key = 'website-data.' . $BASE_URL;
// Get the current ID from the cache if it is present.
if (empty($current_data)) {
if (Cache::has($cache_key)) ... | [
"public",
"static",
"function",
"currentWebsiteData",
"(",
")",
"{",
"static",
"$",
"current_data",
";",
"$",
"BASE_URL",
"=",
"static",
"::",
"currentServerName",
"(",
")",
";",
"$",
"cache_key",
"=",
"'website-data.'",
".",
"$",
"BASE_URL",
";",
"// Get the ... | Determine the current website data.
Returns null if the web site is not found in the websites table.
@return array | [
"Determine",
"the",
"current",
"website",
"data",
"."
] | train | https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Website.php#L70-L105 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.__before | protected function __before(ServerRequestInterface $request, array $arguments)
{
$type_id_variable = $this->getTypeIdVariable();
if (array_key_exists($type_id_variable, $arguments)) {
$this->active_object = empty($arguments[$type_id_variable]) ? null : $this->pool->getById($this->getTyp... | php | protected function __before(ServerRequestInterface $request, array $arguments)
{
$type_id_variable = $this->getTypeIdVariable();
if (array_key_exists($type_id_variable, $arguments)) {
$this->active_object = empty($arguments[$type_id_variable]) ? null : $this->pool->getById($this->getTyp... | [
"protected",
"function",
"__before",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"array",
"$",
"arguments",
")",
"{",
"$",
"type_id_variable",
"=",
"$",
"this",
"->",
"getTypeIdVariable",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"type_id... | Run before every action.
@param ServerRequestInterface $request
@param array $arguments
@return void|StatusResponse | [
"Run",
"before",
"every",
"action",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L50-L63 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.index | public function index(ServerRequestInterface $request)
{
if ($this->shouldCheckPermissions()) {
$authenticated_user = $this->getAuthenticatedUser($request);
if (!$this->canList($authenticated_user)) {
return new ForbiddenStatusResponse();
}
}
... | php | public function index(ServerRequestInterface $request)
{
if ($this->shouldCheckPermissions()) {
$authenticated_user = $this->getAuthenticatedUser($request);
if (!$this->canList($authenticated_user)) {
return new ForbiddenStatusResponse();
}
}
... | [
"public",
"function",
"index",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldCheckPermissions",
"(",
")",
")",
"{",
"$",
"authenticated_user",
"=",
"$",
"this",
"->",
"getAuthenticatedUser",
"(",
"$",
"request",
... | Return a collection of type instances.
@param ServerRequestInterface $request
@return CollectionInterface | [
"Return",
"a",
"collection",
"of",
"type",
"instances",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L71-L95 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.edit | public function edit(ServerRequestInterface $request)
{
if ($this->isReadOnly()) {
return new NotFoundStatusResponse();
}
if ($this->active_object && $this->active_object->isLoaded()) {
$authenticated_user = $this->getAuthenticatedUser($request);
if ($th... | php | public function edit(ServerRequestInterface $request)
{
if ($this->isReadOnly()) {
return new NotFoundStatusResponse();
}
if ($this->active_object && $this->active_object->isLoaded()) {
$authenticated_user = $this->getAuthenticatedUser($request);
if ($th... | [
"public",
"function",
"edit",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReadOnly",
"(",
")",
")",
"{",
"return",
"new",
"NotFoundStatusResponse",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"active_ob... | Update an existing type instance.
@param ServerRequestInterface $request
@return EntityInterface | [
"Update",
"an",
"existing",
"type",
"instance",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L170-L203 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.delete | public function delete(ServerRequestInterface $request)
{
if ($this->isReadOnly()) {
return new NotFoundStatusResponse();
}
if ($this->active_object && $this->active_object->isLoaded()) {
$authenticated_user = $this->getAuthenticatedUser($request);
if ($... | php | public function delete(ServerRequestInterface $request)
{
if ($this->isReadOnly()) {
return new NotFoundStatusResponse();
}
if ($this->active_object && $this->active_object->isLoaded()) {
$authenticated_user = $this->getAuthenticatedUser($request);
if ($... | [
"public",
"function",
"delete",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReadOnly",
"(",
")",
")",
"{",
"return",
"new",
"NotFoundStatusResponse",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"active_... | Drop an existing type instance.
@param ServerRequestInterface $request
@return EntityInterface|StatusResponse | [
"Drop",
"an",
"existing",
"type",
"instance",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L211-L236 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.getPageFromQueryParams | protected function getPageFromQueryParams(array $query_params)
{
$page = 1;
if (isset($query_params['page'])) {
$page = (integer) $query_params['page'];
}
return $page < 1 ? 1 : $page;
} | php | protected function getPageFromQueryParams(array $query_params)
{
$page = 1;
if (isset($query_params['page'])) {
$page = (integer) $query_params['page'];
}
return $page < 1 ? 1 : $page;
} | [
"protected",
"function",
"getPageFromQueryParams",
"(",
"array",
"$",
"query_params",
")",
"{",
"$",
"page",
"=",
"1",
";",
"if",
"(",
"isset",
"(",
"$",
"query_params",
"[",
"'page'",
"]",
")",
")",
"{",
"$",
"page",
"=",
"(",
"integer",
")",
"$",
"... | Return page from request query params.
@param array $query_params
@return int | [
"Return",
"page",
"from",
"request",
"query",
"params",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L248-L257 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.getTypeFromRequestBody | protected function getTypeFromRequestBody(array &$request_body)
{
$type_class = $this->getTypeClassName();
if (isset($request_body['type'])) {
$type_class = $request_body['type'];
unset($request_body['type']);
}
if (class_exists($type_class)) {
$... | php | protected function getTypeFromRequestBody(array &$request_body)
{
$type_class = $this->getTypeClassName();
if (isset($request_body['type'])) {
$type_class = $request_body['type'];
unset($request_body['type']);
}
if (class_exists($type_class)) {
$... | [
"protected",
"function",
"getTypeFromRequestBody",
"(",
"array",
"&",
"$",
"request_body",
")",
"{",
"$",
"type_class",
"=",
"$",
"this",
"->",
"getTypeClassName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"request_body",
"[",
"'type'",
"]",
")",
")",
... | Get a valid type class from request body.
@param array $request_body
@return string | [
"Get",
"a",
"valid",
"type",
"class",
"from",
"request",
"body",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L265-L283 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.requestBodyContainsProtectedFields | private function requestBodyContainsProtectedFields($object_or_object_class, array $request_body)
{
if ($object_or_object_class instanceof EntityInterface) {
$protected_fields = $object_or_object_class instanceof ProtectedFieldsInterface ? $object_or_object_class->getProtectedFields() : [];
... | php | private function requestBodyContainsProtectedFields($object_or_object_class, array $request_body)
{
if ($object_or_object_class instanceof EntityInterface) {
$protected_fields = $object_or_object_class instanceof ProtectedFieldsInterface ? $object_or_object_class->getProtectedFields() : [];
... | [
"private",
"function",
"requestBodyContainsProtectedFields",
"(",
"$",
"object_or_object_class",
",",
"array",
"$",
"request_body",
")",
"{",
"if",
"(",
"$",
"object_or_object_class",
"instanceof",
"EntityInterface",
")",
"{",
"$",
"protected_fields",
"=",
"$",
"objec... | Return true if $request_body contains a protected field.
@param EntityInterface|string $object_or_object_class
@param array $request_body
@return bool | [
"Return",
"true",
"if",
"$request_body",
"contains",
"a",
"protected",
"field",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L292-L311 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.cleanUpRequestBodyForEdit | protected function cleanUpRequestBodyForEdit(array &$request_body, UserInterface $user = null)
{
$this->cleanUpRequestBody($request_body, $user);
if ($this->pool->isTypePolymorph($this->getTypeClassName()) && array_key_exists('type', $request_body)) {
unset($request_body['type']);
... | php | protected function cleanUpRequestBodyForEdit(array &$request_body, UserInterface $user = null)
{
$this->cleanUpRequestBody($request_body, $user);
if ($this->pool->isTypePolymorph($this->getTypeClassName()) && array_key_exists('type', $request_body)) {
unset($request_body['type']);
... | [
"protected",
"function",
"cleanUpRequestBodyForEdit",
"(",
"array",
"&",
"$",
"request_body",
",",
"UserInterface",
"$",
"user",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"cleanUpRequestBody",
"(",
"$",
"request_body",
",",
"$",
"user",
")",
";",
"if",
"(",
... | Perform request data clean-up before reqeust data is being used for edit action.
@param array $request_body
@param UserInterface|null $user | [
"Perform",
"request",
"data",
"clean",
"-",
"up",
"before",
"reqeust",
"data",
"is",
"being",
"used",
"for",
"edit",
"action",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L330-L337 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.getTypeName | public function getTypeName(): string
{
if (empty($this->type_name)) {
$this->type_name = Inflector::singularize(rtrim($this->getControllerName(), 'Controller'));
}
return $this->type_name;
} | php | public function getTypeName(): string
{
if (empty($this->type_name)) {
$this->type_name = Inflector::singularize(rtrim($this->getControllerName(), 'Controller'));
}
return $this->type_name;
} | [
"public",
"function",
"getTypeName",
"(",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"type_name",
")",
")",
"{",
"$",
"this",
"->",
"type_name",
"=",
"Inflector",
"::",
"singularize",
"(",
"rtrim",
"(",
"$",
"this",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L461-L468 |
activecollab/bootstrap | src/Controller/TypeController.php | TypeController.getTypeIdVariable | public function getTypeIdVariable(): string
{
if (empty($this->type_id_variable)) {
return Inflector::tableize($this->getTypeName()) . '_id';
}
return $this->type_id_variable;
} | php | public function getTypeIdVariable(): string
{
if (empty($this->type_id_variable)) {
return Inflector::tableize($this->getTypeName()) . '_id';
}
return $this->type_id_variable;
} | [
"public",
"function",
"getTypeIdVariable",
"(",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"type_id_variable",
")",
")",
"{",
"return",
"Inflector",
"::",
"tableize",
"(",
"$",
"this",
"->",
"getTypeName",
"(",
")",
")",
".",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Controller/TypeController.php#L478-L485 |
ignasbernotas/console | src/Question/Question.php | Question.ask | public function ask()
{
$this->drawer->open();
$phkey = new Detector();
$listener = $phkey->getListenerInstance();
$event = $listener->getEventDispatcher();
$event->addListener(
'key:up',
function () {
$this->cursor->moveUp(count($thi... | php | public function ask()
{
$this->drawer->open();
$phkey = new Detector();
$listener = $phkey->getListenerInstance();
$event = $listener->getEventDispatcher();
$event->addListener(
'key:up',
function () {
$this->cursor->moveUp(count($thi... | [
"public",
"function",
"ask",
"(",
")",
"{",
"$",
"this",
"->",
"drawer",
"->",
"open",
"(",
")",
";",
"$",
"phkey",
"=",
"new",
"Detector",
"(",
")",
";",
"$",
"listener",
"=",
"$",
"phkey",
"->",
"getListenerInstance",
"(",
")",
";",
"$",
"event",... | Asks the question
@return array | [
"Asks",
"the",
"question"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/Question/Question.php#L113-L157 |
ignasbernotas/console | src/Question/Question.php | Question.draw | protected function draw()
{
$this->drawer->drawWindow(
$this->title,
$this->choices,
$this->cursor->getPosition(),
$this->answers
);
} | php | protected function draw()
{
$this->drawer->drawWindow(
$this->title,
$this->choices,
$this->cursor->getPosition(),
$this->answers
);
} | [
"protected",
"function",
"draw",
"(",
")",
"{",
"$",
"this",
"->",
"drawer",
"->",
"drawWindow",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"choices",
",",
"$",
"this",
"->",
"cursor",
"->",
"getPosition",
"(",
")",
",",
"$",
"this",
... | Draws the window | [
"Draws",
"the",
"window"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/Question/Question.php#L162-L170 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/URIScheme.php | HTMLPurifier_URIScheme.validate | public function validate(&$uri, $config, $context) {
if ($this->default_port == $uri->port) $uri->port = null;
return true;
} | php | public function validate(&$uri, $config, $context) {
if ($this->default_port == $uri->port) $uri->port = null;
return true;
} | [
"public",
"function",
"validate",
"(",
"&",
"$",
"uri",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"default_port",
"==",
"$",
"uri",
"->",
"port",
")",
"$",
"uri",
"->",
"port",
"=",
"null",
";",
"return",
"t... | Validates the components of a URI
@note This implementation should be called by children if they define
a default port, as it does port processing.
@param $uri Instance of HTMLPurifier_URI
@param $config HTMLPurifier_Config object
@param $context HTMLPurifier_Context object
@return Bool success or failure | [
"Validates",
"the",
"components",
"of",
"a",
"URI"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/URIScheme.php#L35-L38 |
preprocess/pre-immutable-classes | source/ImmutableClassesTrait.php | ImmutableClassesTrait.handleCallImmutableClassSetters | protected function handleCallImmutableClassSetters($method, $parameters)
{
if (stripos($method, "with") === 0) {
if (count($parameters) < 1) {
throw new InvalidArgumentException("{$method} expects a parameter, none given");
}
$property = $this->camel(subs... | php | protected function handleCallImmutableClassSetters($method, $parameters)
{
if (stripos($method, "with") === 0) {
if (count($parameters) < 1) {
throw new InvalidArgumentException("{$method} expects a parameter, none given");
}
$property = $this->camel(subs... | [
"protected",
"function",
"handleCallImmutableClassSetters",
"(",
"$",
"method",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"method",
",",
"\"with\"",
")",
"===",
"0",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"parameters",
")",
"<",
... | Handles calls to withProperty($value) methods.
@param string $method
@param array $parameters
@return static | [
"Handles",
"calls",
"to",
"withProperty",
"(",
"$value",
")",
"methods",
"."
] | train | https://github.com/preprocess/pre-immutable-classes/blob/10435844183d11d208c0b0b78ae00f54bb29157d/source/ImmutableClassesTrait.php#L28-L43 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.exportImage | public function exportImage( $keep_resorce = false )
{
// prepare Capatcha
$this->getCaptchaImage();
# Sending Header Info
header( 'content-type: image/png' );
# Exporting the final image
imagepng( $this->_final_image );
# Clearing final image from the memory
imagedestroy( $this->_final_image );... | php | public function exportImage( $keep_resorce = false )
{
// prepare Capatcha
$this->getCaptchaImage();
# Sending Header Info
header( 'content-type: image/png' );
# Exporting the final image
imagepng( $this->_final_image );
# Clearing final image from the memory
imagedestroy( $this->_final_image );... | [
"public",
"function",
"exportImage",
"(",
"$",
"keep_resorce",
"=",
"false",
")",
"{",
"// prepare Capatcha",
"$",
"this",
"->",
"getCaptchaImage",
"(",
")",
";",
"# Sending Header Info",
"header",
"(",
"'content-type: image/png'",
")",
";",
"# Exporting the final ima... | send image to browser | [
"send",
"image",
"to",
"browser"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L78-L93 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.init | public static function init( $blocks = 2, $block_min_length = 4, $block_max_length = 7 )
{
if( !is_numeric( $blocks ) || !is_numeric( $block_min_length ) || !is_numeric( $block_max_length ) )
throw new CaptchaException( __METHOD__ . ' arguments must be numeric values' );
if( $blocks < 1 || $blocks > 5 )
thr... | php | public static function init( $blocks = 2, $block_min_length = 4, $block_max_length = 7 )
{
if( !is_numeric( $blocks ) || !is_numeric( $block_min_length ) || !is_numeric( $block_max_length ) )
throw new CaptchaException( __METHOD__ . ' arguments must be numeric values' );
if( $blocks < 1 || $blocks > 5 )
thr... | [
"public",
"static",
"function",
"init",
"(",
"$",
"blocks",
"=",
"2",
",",
"$",
"block_min_length",
"=",
"4",
",",
"$",
"block_max_length",
"=",
"7",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"blocks",
")",
"||",
"!",
"is_numeric",
"(",
"$",
... | This Method Will Generate a Capatcha Code and Store it in Session | [
"This",
"Method",
"Will",
"Generate",
"a",
"Capatcha",
"Code",
"and",
"Store",
"it",
"in",
"Session"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L109-L146 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.calculateDimensions | private function calculateDimensions()
{
# calculate capatcha text box dimensions
# which are the minimum image resource dimensions
$this->_calculated_text_box['dimensions'] = $this->getTextBoxDimensions(
$this->_background_text['size'],
0,
$this->_background_text['fon... | php | private function calculateDimensions()
{
# calculate capatcha text box dimensions
# which are the minimum image resource dimensions
$this->_calculated_text_box['dimensions'] = $this->getTextBoxDimensions(
$this->_background_text['size'],
0,
$this->_background_text['fon... | [
"private",
"function",
"calculateDimensions",
"(",
")",
"{",
"# calculate capatcha text box dimensions",
"# which are the minimum image resource dimensions",
"$",
"this",
"->",
"_calculated_text_box",
"[",
"'dimensions'",
"]",
"=",
"$",
"this",
"->",
"getTextBoxDimensions",
"... | calculate required size of capatcha image | [
"calculate",
"required",
"size",
"of",
"capatcha",
"image"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L191-L219 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.createCaptchaImage | private function createCaptchaImage()
{
$this->_image_resource = imagecreatetruecolor( $this->_image_info['width'], $this->_image_info['height'] );
if( function_exists( 'imageantialias' ) )
imageantialias( $this->_image_resource, true );
# Get Colors Values
$rgb = $this->getRGBFromRange(
$this-... | php | private function createCaptchaImage()
{
$this->_image_resource = imagecreatetruecolor( $this->_image_info['width'], $this->_image_info['height'] );
if( function_exists( 'imageantialias' ) )
imageantialias( $this->_image_resource, true );
# Get Colors Values
$rgb = $this->getRGBFromRange(
$this-... | [
"private",
"function",
"createCaptchaImage",
"(",
")",
"{",
"$",
"this",
"->",
"_image_resource",
"=",
"imagecreatetruecolor",
"(",
"$",
"this",
"->",
"_image_info",
"[",
"'width'",
"]",
",",
"$",
"this",
"->",
"_image_info",
"[",
"'height'",
"]",
")",
";",
... | create capatcha image resource | [
"create",
"capatcha",
"image",
"resource"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L225-L259 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.drawCapatchaImageText | private function drawCapatchaImageText()
{
# Create Image Text
# here we will first create background text, then front text
# we will set x- position
# initial front text position 'initial_x'
# current position 'current_x'
$this->_front_text['initial_x'] = $this->_front_text['x'] = rand( 10, 25 );
... | php | private function drawCapatchaImageText()
{
# Create Image Text
# here we will first create background text, then front text
# we will set x- position
# initial front text position 'initial_x'
# current position 'current_x'
$this->_front_text['initial_x'] = $this->_front_text['x'] = rand( 10, 25 );
... | [
"private",
"function",
"drawCapatchaImageText",
"(",
")",
"{",
"#\tCreate Image Text",
"# here we will first create background text, then front text",
"# we will set x- position",
"# initial front text position 'initial_x'",
"# current position 'current_x'",
"$",
"this",
"->",
"_front_te... | Draw Capatcha Code to Image | [
"Draw",
"Capatcha",
"Code",
"to",
"Image"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L265-L417 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.fixCaptchaImage | private function fixCaptchaImage(){
# Final equired image width must be
# Last _front_text x position + initial_x
$final_width = $this->_front_text['x'] + $this->_front_text['initial_x'];
# check if to set final width
if( $this->_image_info['width'] > $final_width )
$this->_image_info['width'] = $... | php | private function fixCaptchaImage(){
# Final equired image width must be
# Last _front_text x position + initial_x
$final_width = $this->_front_text['x'] + $this->_front_text['initial_x'];
# check if to set final width
if( $this->_image_info['width'] > $final_width )
$this->_image_info['width'] = $... | [
"private",
"function",
"fixCaptchaImage",
"(",
")",
"{",
"# Final equired image width must be",
"# Last _front_text x position + initial_x",
"$",
"final_width",
"=",
"$",
"this",
"->",
"_front_text",
"[",
"'x'",
"]",
"+",
"$",
"this",
"->",
"_front_text",
"[",
"'initi... | Fix Final Capatcha image Size if needed | [
"Fix",
"Final",
"Capatcha",
"image",
"Size",
"if",
"needed"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L423-L456 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.setTextSize | public function setTextSize( $front, $background = null )
{
# comment
if( !is_numeric( $front ) )
throw new CaptchaException( __METHOD__ . '($arg) must be numeric' );
if( !$background )
{
$this->_front_text['size'] = $front;
$this->_background_text['size'] = $front + 10;
}
else
{
i... | php | public function setTextSize( $front, $background = null )
{
# comment
if( !is_numeric( $front ) )
throw new CaptchaException( __METHOD__ . '($arg) must be numeric' );
if( !$background )
{
$this->_front_text['size'] = $front;
$this->_background_text['size'] = $front + 10;
}
else
{
i... | [
"public",
"function",
"setTextSize",
"(",
"$",
"front",
",",
"$",
"background",
"=",
"null",
")",
"{",
"#\tcomment",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"front",
")",
")",
"throw",
"new",
"CaptchaException",
"(",
"__METHOD__",
".",
"'($arg) must be numer... | Set Text Size
@param integer $front front text size
@param integer $background text size | [
"Set",
"Text",
"Size"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L470-L498 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.setColor | public function setColor( $key, $r, $g, $b, $alpha = 0, $range = 0 )
{
# Set color
if( !in_array( $key, array( 'background', 'background_text', 'front_text' ) ) )
throw new CaptchaException( __METHOD__ . '($key, ) must be one of( background, background_text, front_text ).' );
if( !is_numeric( $r ) || !is... | php | public function setColor( $key, $r, $g, $b, $alpha = 0, $range = 0 )
{
# Set color
if( !in_array( $key, array( 'background', 'background_text', 'front_text' ) ) )
throw new CaptchaException( __METHOD__ . '($key, ) must be one of( background, background_text, front_text ).' );
if( !is_numeric( $r ) || !is... | [
"public",
"function",
"setColor",
"(",
"$",
"key",
",",
"$",
"r",
",",
"$",
"g",
",",
"$",
"b",
",",
"$",
"alpha",
"=",
"0",
",",
"$",
"range",
"=",
"0",
")",
"{",
"#\tSet color",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"array",
"("... | Set Text Color
@param string $key define which property to set it's color
@param integer $r red value
@param integer $g green value
@param integer $b blue value
@param integer $alpha alpha value
@param integer $range range | [
"Set",
"Text",
"Color"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L510-L529 |
ahmad-sa3d/saad-image | src/Captcha/Captcha.php | Captcha.setFont | public function setFont( $key, $font )
{
# Set Fonts
if( $key != 'background_text' && $key != 'front_text' )
throw new CaptchaException( __METHOD__ . '($key, ) $key must be background_text or front_text.' );
# check font file existence
$font_file = Config::get( 'images.captcha.font_dir' ) . DIRECTORY_S... | php | public function setFont( $key, $font )
{
# Set Fonts
if( $key != 'background_text' && $key != 'front_text' )
throw new CaptchaException( __METHOD__ . '($key, ) $key must be background_text or front_text.' );
# check font file existence
$font_file = Config::get( 'images.captcha.font_dir' ) . DIRECTORY_S... | [
"public",
"function",
"setFont",
"(",
"$",
"key",
",",
"$",
"font",
")",
"{",
"#\tSet Fonts",
"if",
"(",
"$",
"key",
"!=",
"'background_text'",
"&&",
"$",
"key",
"!=",
"'front_text'",
")",
"throw",
"new",
"CaptchaException",
"(",
"__METHOD__",
".",
"'($key... | Set Captcha Font
@param string $key define which text we want to set it's font
@param string $font font file name | [
"Set",
"Captcha",
"Font"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Captcha/Captcha.php#L537-L556 |
ipunkt/social-auth | src/migrations/2014_06_12_134618_create_social_logins_table.php | CreateSocialLoginsTable.up | public function up()
{
Schema::create('social_logins', function(Blueprint $table)
{
$table->increments('id');
$table->unsignedInteger('user_id');
$table->text('provider');
$table->text('identifier');
if(Config::has('social-auth::user_table')) {
$u... | php | public function up()
{
Schema::create('social_logins', function(Blueprint $table)
{
$table->increments('id');
$table->unsignedInteger('user_id');
$table->text('provider');
$table->text('identifier');
if(Config::has('social-auth::user_table')) {
$u... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"'social_logins'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"increments",
"(",
"'id'",
")",
";",
"$",
"table",
"->",
"unsignedInteger",
"(",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/migrations/2014_06_12_134618_create_social_logins_table.php#L13-L34 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/AbstractRationalType.php | AbstractRationalType.asComplex | public function asComplex()
{
return new ComplexType(
new RationalType(clone $this->numerator(), clone $this->denominator()),
new RationalType(new IntType(0), new IntType(1))
);
} | php | public function asComplex()
{
return new ComplexType(
new RationalType(clone $this->numerator(), clone $this->denominator()),
new RationalType(new IntType(0), new IntType(1))
);
} | [
"public",
"function",
"asComplex",
"(",
")",
"{",
"return",
"new",
"ComplexType",
"(",
"new",
"RationalType",
"(",
"clone",
"$",
"this",
"->",
"numerator",
"(",
")",
",",
"clone",
"$",
"this",
"->",
"denominator",
"(",
")",
")",
",",
"new",
"RationalType... | Return the number as a Complex number i.e. n+0i
@return \Chippyash\Type\Number\Complex\ComplexType | [
"Return",
"the",
"number",
"as",
"a",
"Complex",
"number",
"i",
".",
"e",
".",
"n",
"+",
"0i"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/AbstractRationalType.php#L48-L54 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/AbstractRationalType.php | AbstractRationalType.getAsNativeType | public function getAsNativeType()
{
if ($this->isInteger()) {
return intval($this->value['num']->get());
}
return floatval($this->value['num']->get() / $this->value['den']->get());
} | php | public function getAsNativeType()
{
if ($this->isInteger()) {
return intval($this->value['num']->get());
}
return floatval($this->value['num']->get() / $this->value['den']->get());
} | [
"public",
"function",
"getAsNativeType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isInteger",
"(",
")",
")",
"{",
"return",
"intval",
"(",
"$",
"this",
"->",
"value",
"[",
"'num'",
"]",
"->",
"get",
"(",
")",
")",
";",
"}",
"return",
"floatval... | Get the basic PHP value of the object type properly
In this case, the type is an int or float
@return int|float | [
"Get",
"the",
"basic",
"PHP",
"value",
"of",
"the",
"object",
"type",
"properly",
"In",
"this",
"case",
"the",
"type",
"is",
"an",
"int",
"or",
"float"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/AbstractRationalType.php#L155-L162 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/AbstractRationalType.php | AbstractRationalType.setFromTypes | protected function setFromTypes(array $params)
{
parent::setFromTypes($params);
if ($this->reduce) {
$this->reduce();
}
if ($this->value['den']->get() < 0) {
//normalise the sign
$this->value['num']->negate();
$this->v... | php | protected function setFromTypes(array $params)
{
parent::setFromTypes($params);
if ($this->reduce) {
$this->reduce();
}
if ($this->value['den']->get() < 0) {
//normalise the sign
$this->value['num']->negate();
$this->v... | [
"protected",
"function",
"setFromTypes",
"(",
"array",
"$",
"params",
")",
"{",
"parent",
"::",
"setFromTypes",
"(",
"$",
"params",
")",
";",
"if",
"(",
"$",
"this",
"->",
"reduce",
")",
"{",
"$",
"this",
"->",
"reduce",
"(",
")",
";",
"}",
"if",
"... | Maps values passed in as parameters to constructor and set methods into
the value array
@param array $params
@return void
@throws \InvalidArgumentException | [
"Maps",
"values",
"passed",
"in",
"as",
"parameters",
"to",
"constructor",
"and",
"set",
"methods",
"into",
"the",
"value",
"array"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/AbstractRationalType.php#L205-L218 |
marcossegovia/twitter-api-client-bundle | src/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$tree_builder = new TreeBuilder();
$root_node = $tree_builder->root('twitter_api_client');
$root_node
->children()
->arrayNode('twitter')
->children()
->scalarNode('api_key')-... | php | public function getConfigTreeBuilder()
{
$tree_builder = new TreeBuilder();
$root_node = $tree_builder->root('twitter_api_client');
$root_node
->children()
->arrayNode('twitter')
->children()
->scalarNode('api_key')-... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"tree_builder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"root_node",
"=",
"$",
"tree_builder",
"->",
"root",
"(",
"'twitter_api_client'",
")",
";",
"$",
"root_node",
"->",
"children",
"... | Generates the configuration tree builder.
@return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder | [
"Generates",
"the",
"configuration",
"tree",
"builder",
"."
] | train | https://github.com/marcossegovia/twitter-api-client-bundle/blob/3312a5cae144e0b08486778d17cc54b693c4422a/src/DependencyInjection/Configuration.php#L15-L32 |
mimmi20/Wurfl | src/Handlers/Normalizer/Generic/IISLogging.php | IISLogging.normalize | public function normalize($userAgent)
{
//If there are no spaces in a UA and more than 2 plus symbols, the UA is likely affected by IIS style logging issues
if (substr_count($userAgent, ' ') === 0 and substr_count($userAgent, '+') > 2) {
$userAgent = str_replace('+', ' ', $userAgent);
... | php | public function normalize($userAgent)
{
//If there are no spaces in a UA and more than 2 plus symbols, the UA is likely affected by IIS style logging issues
if (substr_count($userAgent, ' ') === 0 and substr_count($userAgent, '+') > 2) {
$userAgent = str_replace('+', ' ', $userAgent);
... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"//If there are no spaces in a UA and more than 2 plus symbols, the UA is likely affected by IIS style logging issues",
"if",
"(",
"substr_count",
"(",
"$",
"userAgent",
",",
"' '",
")",
"===",
"0",
"and",
... | This method clean the IIS logging from user agent string.
@param string $userAgent
@return string Normalized user agent | [
"This",
"method",
"clean",
"the",
"IIS",
"logging",
"from",
"user",
"agent",
"string",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Generic/IISLogging.php#L34-L42 |
transfer-framework/transfer | src/Transfer/Processor/SequentialProcessor.php | SequentialProcessor.handleProcedure | protected function handleProcedure(Procedure $procedure)
{
foreach ((array) $procedure->getSources() as $source) {
list($adapter, $request) = $source;
$response = $this->handleSource($adapter, $request);
$response->getIterator()->rewind();
while ($object = ... | php | protected function handleProcedure(Procedure $procedure)
{
foreach ((array) $procedure->getSources() as $source) {
list($adapter, $request) = $source;
$response = $this->handleSource($adapter, $request);
$response->getIterator()->rewind();
while ($object = ... | [
"protected",
"function",
"handleProcedure",
"(",
"Procedure",
"$",
"procedure",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"procedure",
"->",
"getSources",
"(",
")",
"as",
"$",
"source",
")",
"{",
"list",
"(",
"$",
"adapter",
",",
"$",
"request",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/SequentialProcessor.php#L31-L51 |
geniv/nette-thumbnail | src/MacroThumb.php | MacroThumb.macroThumb | public function macroThumb(MacroNode $node, PhpWriter $writer)
{
if ($node->modifiers) {
// accept dataStream modifier for base64
if (Helpers::removeFilter($node->modifiers, 'dataStream')) {
return $writer->write('$_fi=Thumbnail\\Thumbnail::getSrcPath(%node.word, %nod... | php | public function macroThumb(MacroNode $node, PhpWriter $writer)
{
if ($node->modifiers) {
// accept dataStream modifier for base64
if (Helpers::removeFilter($node->modifiers, 'dataStream')) {
return $writer->write('$_fi=Thumbnail\\Thumbnail::getSrcPath(%node.word, %nod... | [
"public",
"function",
"macroThumb",
"(",
"MacroNode",
"$",
"node",
",",
"PhpWriter",
"$",
"writer",
")",
"{",
"if",
"(",
"$",
"node",
"->",
"modifiers",
")",
"{",
"// accept dataStream modifier for base64",
"if",
"(",
"Helpers",
"::",
"removeFilter",
"(",
"$",... | Macro thumb.
@param MacroNode $node
@param PhpWriter $writer
@return string
@throws CompileException | [
"Macro",
"thumb",
"."
] | train | https://github.com/geniv/nette-thumbnail/blob/408fc61e0df99113a873ca1ec463e4fc85016eed/src/MacroThumb.php#L42-L52 |
itrnka/ha-framework | src/ha/Access/HTTP/Router/Route/HTTPRouteExample.php | HTTPRouteExample.prepareResponse | public function prepareResponse(): void
{
// change default HTTP status code
$this->response->setStatusCode(200);
// clear default response headers
$this->response->resetHeaders();
// add your response headers
$this->response->setCharset('UTF-8');
$this->res... | php | public function prepareResponse(): void
{
// change default HTTP status code
$this->response->setStatusCode(200);
// clear default response headers
$this->response->resetHeaders();
// add your response headers
$this->response->setCharset('UTF-8');
$this->res... | [
"public",
"function",
"prepareResponse",
"(",
")",
":",
"void",
"{",
"// change default HTTP status code",
"$",
"this",
"->",
"response",
"->",
"setStatusCode",
"(",
"200",
")",
";",
"// clear default response headers",
"$",
"this",
"->",
"response",
"->",
"resetHea... | Setup response headers and body by your controller or other logic. | [
"Setup",
"response",
"headers",
"and",
"body",
"by",
"your",
"controller",
"or",
"other",
"logic",
"."
] | train | https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Access/HTTP/Router/Route/HTTPRouteExample.php#L28-L48 |
todstoychev/icr | src/Manipulator/AbstractManipulator.php | AbstractManipulator.calculateResize | protected function calculateResize(AbstractImage $abstractImage, $width, $height)
{
if (!is_numeric($width) || !is_numeric($height)) {
throw new \LogicException('Non numeric value provide for calculating resize!');
}
$imageWidth = $abstractImage->getSize()->getWidth();
$... | php | protected function calculateResize(AbstractImage $abstractImage, $width, $height)
{
if (!is_numeric($width) || !is_numeric($height)) {
throw new \LogicException('Non numeric value provide for calculating resize!');
}
$imageWidth = $abstractImage->getSize()->getWidth();
$... | [
"protected",
"function",
"calculateResize",
"(",
"AbstractImage",
"$",
"abstractImage",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"width",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"height",
")",
")",
"{",
"... | Calculates image resize
@param AbstractImage $abstractImage
@param int $width
@param int $height
@return Box | [
"Calculates",
"image",
"resize"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/AbstractManipulator.php#L56-L82 |
todstoychev/icr | src/Manipulator/AbstractManipulator.php | AbstractManipulator.createCropPoint | protected function createCropPoint(AbstractImage $abstractImage, $width, $height)
{
if (!is_numeric($width) || !is_numeric($height)) {
throw new \LogicException('Provided values for width and height are not numeric!');
}
$width = (int) $width;
$height = (int) $height;
... | php | protected function createCropPoint(AbstractImage $abstractImage, $width, $height)
{
if (!is_numeric($width) || !is_numeric($height)) {
throw new \LogicException('Provided values for width and height are not numeric!');
}
$width = (int) $width;
$height = (int) $height;
... | [
"protected",
"function",
"createCropPoint",
"(",
"AbstractImage",
"$",
"abstractImage",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"width",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"height",
")",
")",
"{",
"... | Creates crop point
@param AbstractImage $abstractImage
@param int $width
@param int $height
@return Point | [
"Creates",
"crop",
"point"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/AbstractManipulator.php#L93-L120 |
dphn/ScContent | src/ScContent/Entity/Widget.php | Widget.isApplicable | public function isApplicable($role)
{
if (isset($this->options['roles'][$role])) {
return (bool) (int) $this->options['roles'][$role];
}
return true;
} | php | public function isApplicable($role)
{
if (isset($this->options['roles'][$role])) {
return (bool) (int) $this->options['roles'][$role];
}
return true;
} | [
"public",
"function",
"isApplicable",
"(",
"$",
"role",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'roles'",
"]",
"[",
"$",
"role",
"]",
")",
")",
"{",
"return",
"(",
"bool",
")",
"(",
"int",
")",
"$",
"this",
"->",
... | Checks whether the widget is applicable to the role.
This behavior differs from the ACL. Returns FALSE if and only if the
widget is explicitly disabled for a given role.
This is true because the widgets do not have to perform any
function other than displaying information. To change the information
are frontend and ba... | [
"Checks",
"whether",
"the",
"widget",
"is",
"applicable",
"to",
"the",
"role",
".",
"This",
"behavior",
"differs",
"from",
"the",
"ACL",
".",
"Returns",
"FALSE",
"if",
"and",
"only",
"if",
"the",
"widget",
"is",
"explicitly",
"disabled",
"for",
"a",
"given... | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Entity/Widget.php#L237-L243 |
chippyash/Strong-Type | src/Chippyash/Type/Number/GMPIntType.php | GMPIntType.factors | public function factors()
{
$num = $this->cloneValue();
$limit = gmp_sqrt($num);
$zero = gmp_init(0);
$one = gmp_init(1);
$ret = array();
for ($x = gmp_init(1); gmp_cmp($x, $limit) <= 0; $x = gmp_add($x, $one)) {
if (gmp_cmp(gmp_mod($num, $x), $zero) == 0)... | php | public function factors()
{
$num = $this->cloneValue();
$limit = gmp_sqrt($num);
$zero = gmp_init(0);
$one = gmp_init(1);
$ret = array();
for ($x = gmp_init(1); gmp_cmp($x, $limit) <= 0; $x = gmp_add($x, $one)) {
if (gmp_cmp(gmp_mod($num, $x), $zero) == 0)... | [
"public",
"function",
"factors",
"(",
")",
"{",
"$",
"num",
"=",
"$",
"this",
"->",
"cloneValue",
"(",
")",
";",
"$",
"limit",
"=",
"gmp_sqrt",
"(",
"$",
"num",
")",
";",
"$",
"zero",
"=",
"gmp_init",
"(",
"0",
")",
";",
"$",
"one",
"=",
"gmp_i... | Return all factors of this number (sorted)
Returned factors are strings
@return array [factor,factor, ...] | [
"Return",
"all",
"factors",
"of",
"this",
"number",
"(",
"sorted",
")",
"Returned",
"factors",
"are",
"strings"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/GMPIntType.php#L103-L120 |
chippyash/Strong-Type | src/Chippyash/Type/Number/GMPIntType.php | GMPIntType.primeFactors | public function primeFactors()
{
$number = $this->cloneValue();
$divisor = 2;
$zero = gmp_init(0);
$one = gmp_init(1);
$dmax = gmp_sqrt($number);
$factors = array();
$sieve = array_fill(1, intval(gmp_strval($dmax)), 1);
do {
$rFlag = false;... | php | public function primeFactors()
{
$number = $this->cloneValue();
$divisor = 2;
$zero = gmp_init(0);
$one = gmp_init(1);
$dmax = gmp_sqrt($number);
$factors = array();
$sieve = array_fill(1, intval(gmp_strval($dmax)), 1);
do {
$rFlag = false;... | [
"public",
"function",
"primeFactors",
"(",
")",
"{",
"$",
"number",
"=",
"$",
"this",
"->",
"cloneValue",
"(",
")",
";",
"$",
"divisor",
"=",
"2",
";",
"$",
"zero",
"=",
"gmp_init",
"(",
"0",
")",
";",
"$",
"one",
"=",
"gmp_init",
"(",
"1",
")",
... | Return all prime factors of this number
The keys (prime factors) will be strings
The values (exponents will be integers
Adapted from http://www.thatsgeeky.com/2011/03/prime-factoring-with-php/
@return array [primeFactor => exponent,...] | [
"Return",
"all",
"prime",
"factors",
"of",
"this",
"number"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/GMPIntType.php#L132-L166 |
chippyash/Strong-Type | src/Chippyash/Type/Number/GMPIntType.php | GMPIntType.asGMPComplex | public function asGMPComplex()
{
return new GMPComplexType(
new GMPRationalType(new GMPIntType($this->get()), new GMPIntType(1)),
new GMPRationalType(new GMPIntType(0), new GMPIntType(1))
);
} | php | public function asGMPComplex()
{
return new GMPComplexType(
new GMPRationalType(new GMPIntType($this->get()), new GMPIntType(1)),
new GMPRationalType(new GMPIntType(0), new GMPIntType(1))
);
} | [
"public",
"function",
"asGMPComplex",
"(",
")",
"{",
"return",
"new",
"GMPComplexType",
"(",
"new",
"GMPRationalType",
"(",
"new",
"GMPIntType",
"(",
"$",
"this",
"->",
"get",
"(",
")",
")",
",",
"new",
"GMPIntType",
"(",
"1",
")",
")",
",",
"new",
"GM... | Return the number as a GMPComplex number i.e. n+0i
@return \Chippyash\Type\Number\Complex\GMPComplexType | [
"Return",
"the",
"number",
"as",
"a",
"GMPComplex",
"number",
"i",
".",
"e",
".",
"n",
"+",
"0i"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/GMPIntType.php#L224-L230 |
chippyash/Strong-Type | src/Chippyash/Type/Number/GMPIntType.php | GMPIntType.gmpTypeCheck | protected function gmpTypeCheck($value)
{
if (version_compare(PHP_VERSION, '5.6.0') < 0) {
return is_resource($value) && get_resource_type($value) == 'GMP integer';
}
return ($value instanceof \GMP);
} | php | protected function gmpTypeCheck($value)
{
if (version_compare(PHP_VERSION, '5.6.0') < 0) {
return is_resource($value) && get_resource_type($value) == 'GMP integer';
}
return ($value instanceof \GMP);
} | [
"protected",
"function",
"gmpTypeCheck",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"version_compare",
"(",
"PHP_VERSION",
",",
"'5.6.0'",
")",
"<",
"0",
")",
"{",
"return",
"is_resource",
"(",
"$",
"value",
")",
"&&",
"get_resource_type",
"(",
"$",
"value",
... | Check gmp type depending on PHP version
@param mixed $value value to check type of
@return boolean true if gmp number else false | [
"Check",
"gmp",
"type",
"depending",
"on",
"PHP",
"version"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/GMPIntType.php#L292-L299 |
KejawenLab/PetrukUsername | Generator/WesternUsernameGenerator.php | WesternUsernameGenerator.generate | public function generate(string $fullName, int $limit = 8): array
{
$original = str_replace(' ', '', $fullName);
if ($limit > strlen($original)) {
return array();
}
if (-1 === $index = $this->isReservedName($fullName)) {
return array();
}
$te... | php | public function generate(string $fullName, int $limit = 8): array
{
$original = str_replace(' ', '', $fullName);
if ($limit > strlen($original)) {
return array();
}
if (-1 === $index = $this->isReservedName($fullName)) {
return array();
}
$te... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"fullName",
",",
"int",
"$",
"limit",
"=",
"8",
")",
":",
"array",
"{",
"$",
"original",
"=",
"str_replace",
"(",
"' '",
",",
"''",
",",
"$",
"fullName",
")",
";",
"if",
"(",
"$",
"limit",
">",
... | @param string $fullName
@param int $limit
@return array | [
"@param",
"string",
"$fullName",
"@param",
"int",
"$limit"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/Generator/WesternUsernameGenerator.php#L41-L66 |
KejawenLab/PetrukUsername | Generator/WesternUsernameGenerator.php | WesternUsernameGenerator.isReservedName | public function isReservedName(string $fullName): int
{
$temp = explode(' ', strtoupper($fullName));
if (in_array($temp[0], array_keys($this->reservedNames))) {
return 0;
}
return -1;
} | php | public function isReservedName(string $fullName): int
{
$temp = explode(' ', strtoupper($fullName));
if (in_array($temp[0], array_keys($this->reservedNames))) {
return 0;
}
return -1;
} | [
"public",
"function",
"isReservedName",
"(",
"string",
"$",
"fullName",
")",
":",
"int",
"{",
"$",
"temp",
"=",
"explode",
"(",
"' '",
",",
"strtoupper",
"(",
"$",
"fullName",
")",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"temp",
"[",
"0",
"]",
"... | @param string $fullName
@return int | [
"@param",
"string",
"$fullName"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/Generator/WesternUsernameGenerator.php#L73-L81 |
mimmi20/Wurfl | src/Handlers/OperaMobiOrTabletOnAndroidHandler.php | OperaMobiOrTabletOnAndroidHandler.applyRecoveryMatch | public function applyRecoveryMatch($userAgent)
{
$isOperaMobi = Utils::checkIfContains($userAgent, 'Opera Mobi');
$isOperaTablet = Utils::checkIfContains($userAgent, 'Opera Tablet');
if ($isOperaMobi || $isOperaTablet) {
$androidVersion = AndroidHandler::getAndroidVersio... | php | public function applyRecoveryMatch($userAgent)
{
$isOperaMobi = Utils::checkIfContains($userAgent, 'Opera Mobi');
$isOperaTablet = Utils::checkIfContains($userAgent, 'Opera Tablet');
if ($isOperaMobi || $isOperaTablet) {
$androidVersion = AndroidHandler::getAndroidVersio... | [
"public",
"function",
"applyRecoveryMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"isOperaMobi",
"=",
"Utils",
"::",
"checkIfContains",
"(",
"$",
"userAgent",
",",
"'Opera Mobi'",
")",
";",
"$",
"isOperaTablet",
"=",
"Utils",
"::",
"checkIfContains",
"(",
"$",... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaMobiOrTabletOnAndroidHandler.php#L95-L114 |
mimmi20/Wurfl | src/Handlers/OperaMobiOrTabletOnAndroidHandler.php | OperaMobiOrTabletOnAndroidHandler.getOperaOnAndroidVersion | public static function getOperaOnAndroidVersion($userAgent, $useDefault = true)
{
if (preg_match('/Version\/(\d\d)/', $userAgent, $matches)) {
$version = $matches[1];
if (in_array($version, self::$validOperaVersions)) {
return $version;
}
}
... | php | public static function getOperaOnAndroidVersion($userAgent, $useDefault = true)
{
if (preg_match('/Version\/(\d\d)/', $userAgent, $matches)) {
$version = $matches[1];
if (in_array($version, self::$validOperaVersions)) {
return $version;
}
}
... | [
"public",
"static",
"function",
"getOperaOnAndroidVersion",
"(",
"$",
"userAgent",
",",
"$",
"useDefault",
"=",
"true",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/Version\\/(\\d\\d)/'",
",",
"$",
"userAgent",
",",
"$",
"matches",
")",
")",
"{",
"$",
"version... | Get the Opera browser version from an Opera Android user agent
@param string $userAgent User Agent
@param bool $useDefault Return the default version on fail, else return null
@return string Opera version
@see self::$defaultOperaVersion | [
"Get",
"the",
"Opera",
"browser",
"version",
"from",
"an",
"Opera",
"Android",
"user",
"agent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaMobiOrTabletOnAndroidHandler.php#L130-L141 |
demisang/yii2-recaptcha | ReCaptcha.php | ReCaptcha.registerClientScript | public function registerClientScript($gCaptchaParams = [])
{
$id = $this->id;
$view = $this->view;
ReCaptchaAsset::register($view);
$options = Json::encode($gCaptchaParams);
// Directly creating captcha widgets.
// This code placed only one time irrespective of coun... | php | public function registerClientScript($gCaptchaParams = [])
{
$id = $this->id;
$view = $this->view;
ReCaptchaAsset::register($view);
$options = Json::encode($gCaptchaParams);
// Directly creating captcha widgets.
// This code placed only one time irrespective of coun... | [
"public",
"function",
"registerClientScript",
"(",
"$",
"gCaptchaParams",
"=",
"[",
"]",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"view",
";",
"ReCaptchaAsset",
"::",
"register",
"(",
"$",
"view",
"... | Register google reCAPTCHA js api and custom render scripts
@param array $gCaptchaParams | [
"Register",
"google",
"reCAPTCHA",
"js",
"api",
"and",
"custom",
"render",
"scripts"
] | train | https://github.com/demisang/yii2-recaptcha/blob/ecedd26b7e252c6d307365fbd9ab012a9ee33294/ReCaptcha.php#L94-L123 |
venta/framework | src/Container/src/AbstractContainer.php | AbstractContainer.instantiateService | protected function instantiateService(string $id, array $arguments)
{
if (isset($this->instances[$id])) {
return $this->instances[$id];
}
if (isset($this->factories[$id])) {
return ($this->factories[$id])($arguments);
}
if (isset($this->callableDefin... | php | protected function instantiateService(string $id, array $arguments)
{
if (isset($this->instances[$id])) {
return $this->instances[$id];
}
if (isset($this->factories[$id])) {
return ($this->factories[$id])($arguments);
}
if (isset($this->callableDefin... | [
"protected",
"function",
"instantiateService",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"instances",
... | Create callable factory for the subject service.
@param string $id
@param array $arguments
@return mixed
@throws NotFoundException | [
"Create",
"callable",
"factory",
"for",
"the",
"subject",
"service",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/AbstractContainer.php#L123-L150 |
venta/framework | src/Container/src/AbstractContainer.php | AbstractContainer.isResolvableService | protected function isResolvableService(string $id): bool
{
return isset($this->keys[$id]) || class_exists($id);
} | php | protected function isResolvableService(string $id): bool
{
return isset($this->keys[$id]) || class_exists($id);
} | [
"protected",
"function",
"isResolvableService",
"(",
"string",
"$",
"id",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"keys",
"[",
"$",
"id",
"]",
")",
"||",
"class_exists",
"(",
"$",
"id",
")",
";",
"}"
] | Check if container can resolve the service with subject identifier.
@param string $id
@return bool | [
"Check",
"if",
"container",
"can",
"resolve",
"the",
"service",
"with",
"subject",
"identifier",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/AbstractContainer.php#L166-L169 |
venta/framework | src/Container/src/AbstractContainer.php | AbstractContainer.resolving | protected function resolving(string $id)
{
if (isset($this->resolving[$id])) {
throw new CircularReferenceException($id, $this->resolving);
}
// We mark service as being resolved to detect circular references through out the resolution chain.
$this->resolving[$id] = $id;... | php | protected function resolving(string $id)
{
if (isset($this->resolving[$id])) {
throw new CircularReferenceException($id, $this->resolving);
}
// We mark service as being resolved to detect circular references through out the resolution chain.
$this->resolving[$id] = $id;... | [
"protected",
"function",
"resolving",
"(",
"string",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"resolving",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"CircularReferenceException",
"(",
"$",
"id",
",",
"$",
"this",
"->... | Detects circular references.
@param string $id
@return void
@throws CircularReferenceException | [
"Detects",
"circular",
"references",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/AbstractContainer.php#L207-L215 |
venta/framework | src/Container/src/AbstractContainer.php | AbstractContainer.createServiceFactoryFromCallable | private function createServiceFactoryFromCallable(Invokable $invokable): Closure
{
return function (array $arguments = []) use ($invokable) {
return $this->invoker->invoke($invokable, $arguments);
};
} | php | private function createServiceFactoryFromCallable(Invokable $invokable): Closure
{
return function (array $arguments = []) use ($invokable) {
return $this->invoker->invoke($invokable, $arguments);
};
} | [
"private",
"function",
"createServiceFactoryFromCallable",
"(",
"Invokable",
"$",
"invokable",
")",
":",
"Closure",
"{",
"return",
"function",
"(",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"use",
"(",
"$",
"invokable",
")",
"{",
"return",
"$",
"this",
... | Create callable factory with resolved arguments from callable.
@param Invokable $invokable
@return Closure | [
"Create",
"callable",
"factory",
"with",
"resolved",
"arguments",
"from",
"callable",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/AbstractContainer.php#L241-L246 |
venta/framework | src/Container/src/AbstractContainer.php | AbstractContainer.createServiceFactoryFromClass | private function createServiceFactoryFromClass(string $class): Closure
{
$reflection = new ReflectionClass($class);
if (!$reflection->isInstantiable()) {
throw new UninstantiableServiceException($class, $this->resolving);
}
$constructor = $reflection->getConstructor();
... | php | private function createServiceFactoryFromClass(string $class): Closure
{
$reflection = new ReflectionClass($class);
if (!$reflection->isInstantiable()) {
throw new UninstantiableServiceException($class, $this->resolving);
}
$constructor = $reflection->getConstructor();
... | [
"private",
"function",
"createServiceFactoryFromClass",
"(",
"string",
"$",
"class",
")",
":",
"Closure",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"$",
"reflection",
"->",
"isInstantiable",
"(",
")",... | Create callable factory with resolved arguments from class name.
@param string $class
@return Closure
@throws UninstantiableServiceException | [
"Create",
"callable",
"factory",
"with",
"resolved",
"arguments",
"from",
"class",
"name",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/AbstractContainer.php#L255-L278 |
thienhungho/yii2-customer-management | src/modules/CustomerManage/controllers/CustomerController.php | CustomerController.actionIndex | public function actionIndex()
{
$searchModel = new CustomerSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
} | php | public function actionIndex()
{
$searchModel = new CustomerSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
} | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"searchModel",
"=",
"new",
"CustomerSearch",
"(",
")",
";",
"$",
"dataProvider",
"=",
"$",
"searchModel",
"->",
"search",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"queryParams",
")",
";... | Lists all Customer models.
@return mixed | [
"Lists",
"all",
"Customer",
"models",
"."
] | train | https://github.com/thienhungho/yii2-customer-management/blob/9283027541b34a86be85df592248909014968688/src/modules/CustomerManage/controllers/CustomerController.php#L34-L43 |
thienhungho/yii2-customer-management | src/modules/CustomerManage/controllers/CustomerController.php | CustomerController.actionUpdate | public function actionUpdate($id)
{
if (Yii::$app->request->post('_asnew') == '1') {
$model = new Customer();
} else {
$model = $this->findModel($id);
}
if ($model->loadAll(Yii::$app->request->post()) && $model->saveAll()) {
return $this->r... | php | public function actionUpdate($id)
{
if (Yii::$app->request->post('_asnew') == '1') {
$model = new Customer();
} else {
$model = $this->findModel($id);
}
if ($model->loadAll(Yii::$app->request->post()) && $model->saveAll()) {
return $this->r... | [
"public",
"function",
"actionUpdate",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
"'_asnew'",
")",
"==",
"'1'",
")",
"{",
"$",
"model",
"=",
"new",
"Customer",
"(",
")",
";",
"}",
"else",
"{",... | @param $id
@return string|\yii\web\Response
@throws NotFoundHttpException
@throws \yii\db\Exception | [
"@param",
"$id"
] | train | https://github.com/thienhungho/yii2-customer-management/blob/9283027541b34a86be85df592248909014968688/src/modules/CustomerManage/controllers/CustomerController.php#L108-L125 |
thienhungho/yii2-customer-management | src/modules/CustomerManage/controllers/CustomerController.php | CustomerController.actionPdf | public function actionPdf($id)
{
$model = $this->findModel($id);
$providerCustomerBillingAddress = new \yii\data\ArrayDataProvider([
'allModels' => $model->customerBillingAddresses,
]);
$providerCustomerNote = new \yii\data\ArrayDataProvider([
'allModel... | php | public function actionPdf($id)
{
$model = $this->findModel($id);
$providerCustomerBillingAddress = new \yii\data\ArrayDataProvider([
'allModels' => $model->customerBillingAddresses,
]);
$providerCustomerNote = new \yii\data\ArrayDataProvider([
'allModel... | [
"public",
"function",
"actionPdf",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"$",
"providerCustomerBillingAddress",
"=",
"new",
"\\",
"yii",
"\\",
"data",
"\\",
"ArrayDataProvider",
"(",
"[",
... | @param $id
@return mixed
@throws NotFoundHttpException | [
"@param",
"$id"
] | train | https://github.com/thienhungho/yii2-customer-management/blob/9283027541b34a86be85df592248909014968688/src/modules/CustomerManage/controllers/CustomerController.php#L153-L191 |
thienhungho/yii2-customer-management | src/modules/CustomerManage/controllers/CustomerController.php | CustomerController.actionCreateUser | public function actionCreateUser($id)
{
$model = $this->findModel($id);
if (empty($model->user)) {
$user = new User([
'status' => User::STATUS_ACTIVE,
'username' => date('Ymdhis'),
'full_name' => $model->first_name . ' ' . $mo... | php | public function actionCreateUser($id)
{
$model = $this->findModel($id);
if (empty($model->user)) {
$user = new User([
'status' => User::STATUS_ACTIVE,
'username' => date('Ymdhis'),
'full_name' => $model->first_name . ' ' . $mo... | [
"public",
"function",
"actionCreateUser",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"model",
"->",
"user",
")",
")",
"{",
"$",
"user",
"=",
"new",
"User",
... | @param $id
@return \yii\web\Response
@throws NotFoundHttpException
@throws \yii\db\Exception | [
"@param",
"$id"
] | train | https://github.com/thienhungho/yii2-customer-management/blob/9283027541b34a86be85df592248909014968688/src/modules/CustomerManage/controllers/CustomerController.php#L225-L247 |
wshafer/assetmanager-core | src/Service/AssetManager.php | AssetManager.resolvesToAsset | public function resolvesToAsset(ServerRequestInterface $request)
{
if (null === $this->asset) {
$this->asset = $this->resolve($request);
}
return (bool)$this->asset;
} | php | public function resolvesToAsset(ServerRequestInterface $request)
{
if (null === $this->asset) {
$this->asset = $this->resolve($request);
}
return (bool)$this->asset;
} | [
"public",
"function",
"resolvesToAsset",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"asset",
")",
"{",
"$",
"this",
"->",
"asset",
"=",
"$",
"this",
"->",
"resolve",
"(",
"$",
"request",
")",
"... | Check if the request resolves to an asset.
@param ServerRequestInterface $request
@return boolean | [
"Check",
"if",
"the",
"request",
"resolves",
"to",
"an",
"asset",
"."
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Service/AssetManager.php#L82-L89 |
wshafer/assetmanager-core | src/Service/AssetManager.php | AssetManager.setAssetOnResponse | public function setAssetOnResponse(ResponseInterface $response)
{
if (!$this->asset instanceof AssetInterface) {
throw new Exception\RuntimeException(
'Unable to set asset on response. Request has not been resolved to an asset.'
);
}
// @todo: Create ... | php | public function setAssetOnResponse(ResponseInterface $response)
{
if (!$this->asset instanceof AssetInterface) {
throw new Exception\RuntimeException(
'Unable to set asset on response. Request has not been resolved to an asset.'
);
}
// @todo: Create ... | [
"public",
"function",
"setAssetOnResponse",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"asset",
"instanceof",
"AssetInterface",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Unable to set asset... | Set the asset on the response, including headers and content.
@param ResponseInterface $response
@return ResponseInterface
@throws Exception\RuntimeException | [
"Set",
"the",
"asset",
"on",
"the",
"response",
"including",
"headers",
"and",
"content",
"."
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Service/AssetManager.php#L128-L183 |
wshafer/assetmanager-core | src/Service/AssetManager.php | AssetManager.resolve | protected function resolve(ServerRequestInterface $request)
{
$uri = $request->getUri();
$path = $this->normalizePath($uri->getPath());
$this->path = $path;
$asset = $this->getResolver()->resolve($path);
if (!$asset instanceof AssetInterface) {
... | php | protected function resolve(ServerRequestInterface $request)
{
$uri = $request->getUri();
$path = $this->normalizePath($uri->getPath());
$this->path = $path;
$asset = $this->getResolver()->resolve($path);
if (!$asset instanceof AssetInterface) {
... | [
"protected",
"function",
"resolve",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUri",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"uri",
"->",
"getPath",
"(",
")... | Resolve the request to a file.
@param ServerRequestInterface $request
@return mixed false when not found, AssetInterface when resolved. | [
"Resolve",
"the",
"request",
"to",
"a",
"file",
"."
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Service/AssetManager.php#L192-L204 |
cauditor/php-analyzer | src/Config.php | Config.offsetGet | public function offsetGet($offset)
{
$path = $this->config['config_path'];
$config = $this->config + $this->readConfig($path) + $this->defaults;
// *always* exclude some folders - they're not project-specific code and
// could easily be overlooked when overriding excludes
$c... | php | public function offsetGet($offset)
{
$path = $this->config['config_path'];
$config = $this->config + $this->readConfig($path) + $this->defaults;
// *always* exclude some folders - they're not project-specific code and
// could easily be overlooked when overriding excludes
$c... | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"config",
"[",
"'config_path'",
"]",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"+",
"$",
"this",
"->",
"readConfig",
"(",
"$",
"path",
... | {@inheritdoc. | [
"{"
] | train | https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Config.php#L59-L73 |
cauditor/php-analyzer | src/Config.php | Config.readConfig | protected function readConfig($path)
{
if (!file_exists($path) || !is_file($path) || !is_readable($path)) {
return array();
}
$yaml = new Parser();
try {
$config = (array) $yaml->parse(file_get_contents($path));
} catch (ParseException $e) {
... | php | protected function readConfig($path)
{
if (!file_exists($path) || !is_file($path) || !is_readable($path)) {
return array();
}
$yaml = new Parser();
try {
$config = (array) $yaml->parse(file_get_contents($path));
} catch (ParseException $e) {
... | [
"protected",
"function",
"readConfig",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
"||",
"!",
"is_file",
"(",
"$",
"path",
")",
"||",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"return",
"array",
"(",... | @param string $path Path to config file.
@return array | [
"@param",
"string",
"$path",
"Path",
"to",
"config",
"file",
"."
] | train | https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Config.php#L96-L118 |
cauditor/php-analyzer | src/Config.php | Config.normalizePath | protected function normalizePath($value)
{
// array of paths = recursive
if (is_array($value)) {
foreach ($value as $i => $val) {
$value[$i] = $this->normalizePath($val);
}
return $value;
}
$converter = new PathConverter(dirname($... | php | protected function normalizePath($value)
{
// array of paths = recursive
if (is_array($value)) {
foreach ($value as $i => $val) {
$value[$i] = $this->normalizePath($val);
}
return $value;
}
$converter = new PathConverter(dirname($... | [
"protected",
"function",
"normalizePath",
"(",
"$",
"value",
")",
"{",
"// array of paths = recursive",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"i",
"=>",
"$",
"val",
")",
"{",
"$",
"value",
"["... | Normalize all relative paths by prefixing them with the project path.
@param string|string[] $value
@return string|string[] | [
"Normalize",
"all",
"relative",
"paths",
"by",
"prefixing",
"them",
"with",
"the",
"project",
"path",
"."
] | train | https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Config.php#L127-L141 |
Im0rtality/Underscore | src/Mutator.php | Mutator.copyCollectionWith | protected function copyCollectionWith(Collection $collection, array $values)
{
$collection = clone $collection;
$collection->exchangeArray($values);
return $collection;
} | php | protected function copyCollectionWith(Collection $collection, array $values)
{
$collection = clone $collection;
$collection->exchangeArray($values);
return $collection;
} | [
"protected",
"function",
"copyCollectionWith",
"(",
"Collection",
"$",
"collection",
",",
"array",
"$",
"values",
")",
"{",
"$",
"collection",
"=",
"clone",
"$",
"collection",
";",
"$",
"collection",
"->",
"exchangeArray",
"(",
"$",
"values",
")",
";",
"retu... | Get a copy of a collection with new values.
@param Collection $collection
@param array $values
@return Collection | [
"Get",
"a",
"copy",
"of",
"a",
"collection",
"with",
"new",
"values",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Mutator.php#L14-L21 |
bantenprov/tanara | app/Http/Controllers/Settings/ProfileController.php | ProfileController.update | public function update(Request $request)
{
$user = $request->user();
$this->validate($request, [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.$user->id,
]);
return tap($user)->update($request->only('name', 'email'));
} | php | public function update(Request $request)
{
$user = $request->user();
$this->validate($request, [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.$user->id,
]);
return tap($user)->update($request->only('name', 'email'));
} | [
"public",
"function",
"update",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"$",
"this",
"->",
"validate",
"(",
"$",
"request",
",",
"[",
"'name'",
"=>",
"'required'",
",",
"'email'",
"=>",... | Update the user's profile information.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response | [
"Update",
"the",
"user",
"s",
"profile",
"information",
"."
] | train | https://github.com/bantenprov/tanara/blob/e70b027cbbc59bb57a31fa3c7347e7eae87671c3/app/Http/Controllers/Settings/ProfileController.php#L16-L26 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/AttrValidator.php | HTMLPurifier_AttrValidator.validateToken | public function validateToken(&$token, &$config, $context) {
$definition = $config->getHTMLDefinition();
$e =& $context->get('ErrorCollector', true);
// initialize IDAccumulator if necessary
$ok =& $context->get('IDAccumulator', true);
if (!$ok) {
$id_accumulator = ... | php | public function validateToken(&$token, &$config, $context) {
$definition = $config->getHTMLDefinition();
$e =& $context->get('ErrorCollector', true);
// initialize IDAccumulator if necessary
$ok =& $context->get('IDAccumulator', true);
if (!$ok) {
$id_accumulator = ... | [
"public",
"function",
"validateToken",
"(",
"&",
"$",
"token",
",",
"&",
"$",
"config",
",",
"$",
"context",
")",
"{",
"$",
"definition",
"=",
"$",
"config",
"->",
"getHTMLDefinition",
"(",
")",
";",
"$",
"e",
"=",
"&",
"$",
"context",
"->",
"get",
... | Validates the attributes of a token, returning a modified token
that has valid tokens
@param $token Reference to token to validate. We require a reference
because the operation this class performs on the token are
not atomic, so the context CurrentToken to be updated
throughout
@param $config Instance of HTMLPurifier_C... | [
"Validates",
"the",
"attributes",
"of",
"a",
"token",
"returning",
"a",
"modified",
"token",
"that",
"has",
"valid",
"tokens"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/AttrValidator.php#L21-L157 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertyStorageHelper.php | PropertyStorageHelper.storageById | public static function storageById($id)
{
$handlers = self::storageHandlers();
if (isset($handlers[$id])) {
return $handlers[$id];
} else {
throw new ServerErrorHttpException("Storage handler with id $id not found.");
}
} | php | public static function storageById($id)
{
$handlers = self::storageHandlers();
if (isset($handlers[$id])) {
return $handlers[$id];
} else {
throw new ServerErrorHttpException("Storage handler with id $id not found.");
}
} | [
"public",
"static",
"function",
"storageById",
"(",
"$",
"id",
")",
"{",
"$",
"handlers",
"=",
"self",
"::",
"storageHandlers",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"handlers",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"$",
"handlers",
... | Returns AbstractPropertyStorage instance by PropertyStorage.id
@param integer $id
@return \DevGroup\DataStructure\propertyStorage\AbstractPropertyStorage
@throws ServerErrorHttpException | [
"Returns",
"AbstractPropertyStorage",
"instance",
"by",
"PropertyStorage",
".",
"id"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertyStorageHelper.php#L110-L118 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertyStorageHelper.php | PropertyStorageHelper.storageIdByClass | public static function storageIdByClass($className)
{
foreach (self::storageHandlers() as $id => $handler) {
if ($handler instanceof $className) {
return $id;
}
}
return null;
} | php | public static function storageIdByClass($className)
{
foreach (self::storageHandlers() as $id => $handler) {
if ($handler instanceof $className) {
return $id;
}
}
return null;
} | [
"public",
"static",
"function",
"storageIdByClass",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"self",
"::",
"storageHandlers",
"(",
")",
"as",
"$",
"id",
"=>",
"$",
"handler",
")",
"{",
"if",
"(",
"$",
"handler",
"instanceof",
"$",
"className",
")... | Return a property storage id by storage class name.
@param string $className
@return int|null|string | [
"Return",
"a",
"property",
"storage",
"id",
"by",
"storage",
"class",
"name",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertyStorageHelper.php#L125-L133 |
dphn/ScContent | src/ScContent/Controller/Back/GarbageController.php | GarbageController.collectAction | public function collectAction()
{
// @todo json
$service = $this->getGarbageCollector();
if ($service->collect()) {
return $this->redirect()->toRoute('sc-admin/content-manager');
}
return $this->redirect()
->toRoute(
'sc-admin/file/dele... | php | public function collectAction()
{
// @todo json
$service = $this->getGarbageCollector();
if ($service->collect()) {
return $this->redirect()->toRoute('sc-admin/content-manager');
}
return $this->redirect()
->toRoute(
'sc-admin/file/dele... | [
"public",
"function",
"collectAction",
"(",
")",
"{",
"// @todo json",
"$",
"service",
"=",
"$",
"this",
"->",
"getGarbageCollector",
"(",
")",
";",
"if",
"(",
"$",
"service",
"->",
"collect",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirect",
... | Collects garbage - removes files from the file system.
@return \Zend\Stdlib\ResponseInterface | [
"Collects",
"garbage",
"-",
"removes",
"files",
"from",
"the",
"file",
"system",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Controller/Back/GarbageController.php#L32-L45 |
ipunkt/social-auth | src/controllers/SocialRegisterController.php | SocialRegisterController.auth | public function auth($provider_name, &$profile = null) {
$identifier = null;
try {
$provider = $this->hybrid_auth->authenticate($provider_name);
$userProfile = $provider->getUserProfile();
$identifier = $userProfile->identifier;
$profile = $userProfile;
... | php | public function auth($provider_name, &$profile = null) {
$identifier = null;
try {
$provider = $this->hybrid_auth->authenticate($provider_name);
$userProfile = $provider->getUserProfile();
$identifier = $userProfile->identifier;
$profile = $userProfile;
... | [
"public",
"function",
"auth",
"(",
"$",
"provider_name",
",",
"&",
"$",
"profile",
"=",
"null",
")",
"{",
"$",
"identifier",
"=",
"null",
";",
"try",
"{",
"$",
"provider",
"=",
"$",
"this",
"->",
"hybrid_auth",
"->",
"authenticate",
"(",
"$",
"provider... | Prompt the User to authenticate with a social-auth provider
@param $provider_name
@param null $profile
@return null | [
"Prompt",
"the",
"User",
"to",
"authenticate",
"with",
"a",
"social",
"-",
"auth",
"provider"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/controllers/SocialRegisterController.php#L56-L68 |
ipunkt/social-auth | src/controllers/SocialRegisterController.php | SocialRegisterController.checkRegistered | public function checkRegistered($provider_name, $identifier) {
$user = $this->user_repository->findbyAuth($provider_name, $identifier);
return ($user !== null);
} | php | public function checkRegistered($provider_name, $identifier) {
$user = $this->user_repository->findbyAuth($provider_name, $identifier);
return ($user !== null);
} | [
"public",
"function",
"checkRegistered",
"(",
"$",
"provider_name",
",",
"$",
"identifier",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"user_repository",
"->",
"findbyAuth",
"(",
"$",
"provider_name",
",",
"$",
"identifier",
")",
";",
"return",
"(",
"$... | Check if we already have a user attached to $identifer on $provider_name
returns true if there is a user attached, false otherwise
@param $provider_name
@param $identifier
@return bool | [
"Check",
"if",
"we",
"already",
"have",
"a",
"user",
"attached",
"to",
"$identifer",
"on",
"$provider_name",
"returns",
"true",
"if",
"there",
"is",
"a",
"user",
"attached",
"false",
"otherwise"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/controllers/SocialRegisterController.php#L78-L81 |
ipunkt/social-auth | src/controllers/SocialRegisterController.php | SocialRegisterController.attach | public function attach($provider_name) {
$response = null;
$profile = null;
$identifier = $this->auth($provider_name, $profile);
if(!$this->checkRegistered($provider_name, $identifier)) {
$id = Auth::user()->getAuthIdentifier();
$login = $this->login_repositor... | php | public function attach($provider_name) {
$response = null;
$profile = null;
$identifier = $this->auth($provider_name, $profile);
if(!$this->checkRegistered($provider_name, $identifier)) {
$id = Auth::user()->getAuthIdentifier();
$login = $this->login_repositor... | [
"public",
"function",
"attach",
"(",
"$",
"provider_name",
")",
"{",
"$",
"response",
"=",
"null",
";",
"$",
"profile",
"=",
"null",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"auth",
"(",
"$",
"provider_name",
",",
"$",
"profile",
")",
";",
"if... | Attempt to login to a social-auth provider
If successful, attach the social-auth user to the currently logged in user on this system
@param $provider_name
@return \Illuminate\Http\RedirectResponse|null | [
"Attempt",
"to",
"login",
"to",
"a",
"social",
"-",
"auth",
"provider",
"If",
"successful",
"attach",
"the",
"social",
"-",
"auth",
"user",
"to",
"the",
"currently",
"logged",
"in",
"user",
"on",
"this",
"system"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/controllers/SocialRegisterController.php#L90-L120 |
ipunkt/social-auth | src/controllers/SocialRegisterController.php | SocialRegisterController.register | public function register($provider_name) {
$response = null;
$profile = null;
$route = Config::get('social-auth::register_route');
$identifier = $this->auth($provider_name, $profile);
if(!$this->checkRegistered($provider_name, $identifier)) {
$register_info = App::ma... | php | public function register($provider_name) {
$response = null;
$profile = null;
$route = Config::get('social-auth::register_route');
$identifier = $this->auth($provider_name, $profile);
if(!$this->checkRegistered($provider_name, $identifier)) {
$register_info = App::ma... | [
"public",
"function",
"register",
"(",
"$",
"provider_name",
")",
"{",
"$",
"response",
"=",
"null",
";",
"$",
"profile",
"=",
"null",
";",
"$",
"route",
"=",
"Config",
"::",
"get",
"(",
"'social-auth::register_route'",
")",
";",
"$",
"identifier",
"=",
... | Login into a social-auth account intending to register a new user with it
It is considered successful if the user logs into the social-auth account and the account is not yet attached to
a different Account on this system.
If Successful it will redirect back to the register page as set in the config and flash a new
re... | [
"Login",
"into",
"a",
"social",
"-",
"auth",
"account",
"intending",
"to",
"register",
"a",
"new",
"user",
"with",
"it",
"It",
"is",
"considered",
"successful",
"if",
"the",
"user",
"logs",
"into",
"the",
"social",
"-",
"auth",
"account",
"and",
"the",
"... | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/controllers/SocialRegisterController.php#L136-L158 |
mimmi20/Wurfl | src/Handlers/Normalizer/Specific/Safari.php | Safari.normalize | public function normalize($userAgent)
{
$safariVersion = SafariHandler::getSafariVersion($userAgent);
if (!$safariVersion) {
return $userAgent;
}
$prefix = 'Safari ' . $safariVersion . WurflConstants::RIS_DELIMITER;
return $prefix . $userAgent;
} | php | public function normalize($userAgent)
{
$safariVersion = SafariHandler::getSafariVersion($userAgent);
if (!$safariVersion) {
return $userAgent;
}
$prefix = 'Safari ' . $safariVersion . WurflConstants::RIS_DELIMITER;
return $prefix . $userAgent;
} | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"$",
"safariVersion",
"=",
"SafariHandler",
"::",
"getSafariVersion",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"!",
"$",
"safariVersion",
")",
"{",
"return",
"$",
"userAgent",
";",
"}",... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/Safari.php#L41-L52 |
incraigulous/contentful-sdk | src/PayloadBuilders/Asset.php | Asset.objectifyFields | protected function objectifyFields($fields) {
$new = array();
foreach($fields as $name => $field) {
if (is_object($field)) {
$new[] = $field;
} else {
if (array_key_exists('fileName', $field)) {
$new[] = new File($field['content... | php | protected function objectifyFields($fields) {
$new = array();
foreach($fields as $name => $field) {
if (is_object($field)) {
$new[] = $field;
} else {
if (array_key_exists('fileName', $field)) {
$new[] = new File($field['content... | [
"protected",
"function",
"objectifyFields",
"(",
"$",
"fields",
")",
"{",
"$",
"new",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"name",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"field",
")",
")",
... | Convert the field to an object to get the language formatting.
@param $fields
@return array | [
"Convert",
"the",
"field",
"to",
"an",
"object",
"to",
"get",
"the",
"language",
"formatting",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/Asset.php#L19-L33 |
LIN3S/WPFoundation | src/LIN3S/WPFoundation/PostTypes/PostType.php | PostType.serialize | public static function serialize($postTypes)
{
if (is_array($postTypes)) {
foreach ($postTypes as $key => $postType) {
$postTypes[$key] = static::singleSerialize($postType);
}
return $postTypes;
}
$postType = $postTypes;
return st... | php | public static function serialize($postTypes)
{
if (is_array($postTypes)) {
foreach ($postTypes as $key => $postType) {
$postTypes[$key] = static::singleSerialize($postType);
}
return $postTypes;
}
$postType = $postTypes;
return st... | [
"public",
"static",
"function",
"serialize",
"(",
"$",
"postTypes",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"postTypes",
")",
")",
"{",
"foreach",
"(",
"$",
"postTypes",
"as",
"$",
"key",
"=>",
"$",
"postType",
")",
"{",
"$",
"postTypes",
"[",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/PostTypes/PostType.php#L72-L84 |
LIN3S/WPFoundation | src/LIN3S/WPFoundation/PostTypes/PostType.php | PostType.postType | public function postType()
{
if ($this->name !== null && $this->options !== null) {
register_post_type($this->name, $this->options);
}
} | php | public function postType()
{
if ($this->name !== null && $this->options !== null) {
register_post_type($this->name, $this->options);
}
} | [
"public",
"function",
"postType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
"!==",
"null",
"&&",
"$",
"this",
"->",
"options",
"!==",
"null",
")",
"{",
"register_post_type",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"options"... | {@inheritdoc} | [
"{"
] | train | https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/PostTypes/PostType.php#L112-L117 |
guillaumemonet/Rad | src/Rad/Http/Uri.php | Uri.isURL | public static function isURL(string $url): bool {
return (boolean) !(filter_var($url, FILTER_SANITIZE_URL | FILTER_VALIDATE_URL) === false);
} | php | public static function isURL(string $url): bool {
return (boolean) !(filter_var($url, FILTER_SANITIZE_URL | FILTER_VALIDATE_URL) === false);
} | [
"public",
"static",
"function",
"isURL",
"(",
"string",
"$",
"url",
")",
":",
"bool",
"{",
"return",
"(",
"boolean",
")",
"!",
"(",
"filter_var",
"(",
"$",
"url",
",",
"FILTER_SANITIZE_URL",
"|",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
")",
";",
"}"
... | Valid if current provided string is an URL
@param string $url
@return bool | [
"Valid",
"if",
"current",
"provided",
"string",
"is",
"an",
"URL"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Http/Uri.php#L51-L53 |
andylolz/everypolitician-popolo-php | src/Collections/PopoloCollection.php | PopoloCollection.filter | public function filter($filters)
{
$filtered = [];
foreach ($this->objectArr as $obj) {
$success = true;
foreach ($filters as $prop => $value) {
if ($obj->$prop !== $value) {
$success = false;
break;
}
... | php | public function filter($filters)
{
$filtered = [];
foreach ($this->objectArr as $obj) {
$success = true;
foreach ($filters as $prop => $value) {
if ($obj->$prop !== $value) {
$success = false;
break;
}
... | [
"public",
"function",
"filter",
"(",
"$",
"filters",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"objectArr",
"as",
"$",
"obj",
")",
"{",
"$",
"success",
"=",
"true",
";",
"foreach",
"(",
"$",
"filters",
"as",
... | Gets an array of matching items, according to the
array of filters provided. Filters are key-value pairs
that are ANDed together, i.e. returned items match all
the criteria
@param string[] $filters key-value set of criteria
@return object[] | [
"Gets",
"an",
"array",
"of",
"matching",
"items",
"according",
"to",
"the",
"array",
"of",
"filters",
"provided",
".",
"Filters",
"are",
"key",
"-",
"value",
"pairs",
"that",
"are",
"ANDed",
"together",
"i",
".",
"e",
".",
"returned",
"items",
"match",
"... | train | https://github.com/andylolz/everypolitician-popolo-php/blob/701fca91b782871d463cfb56f3c1c7afb121eb9f/src/Collections/PopoloCollection.php#L83-L99 |
andylolz/everypolitician-popolo-php | src/Collections/PopoloCollection.php | PopoloCollection.get | public function get($filters)
{
$matches = $this->filter($filters);
$n = count($matches);
if ($n == 0) {
$msg = "No ".$this->objectClass." found matching ".json_encode($filters);
throw new Exceptions\ObjectDoesNotExistException($msg);
} elseif ($n > 1) {
... | php | public function get($filters)
{
$matches = $this->filter($filters);
$n = count($matches);
if ($n == 0) {
$msg = "No ".$this->objectClass." found matching ".json_encode($filters);
throw new Exceptions\ObjectDoesNotExistException($msg);
} elseif ($n > 1) {
... | [
"public",
"function",
"get",
"(",
"$",
"filters",
")",
"{",
"$",
"matches",
"=",
"$",
"this",
"->",
"filter",
"(",
"$",
"filters",
")",
";",
"$",
"n",
"=",
"count",
"(",
"$",
"matches",
")",
";",
"if",
"(",
"$",
"n",
"==",
"0",
")",
"{",
"$",... | Gets a single matching item, according to the
array of filters provided. Filters are key-value pairs
that are ANDed together, i.e. returned items match all
the criteria. If more or less than one item matches,
an exception is thrown
@param string[] $filters key-value set of criteria
@return object | [
"Gets",
"a",
"single",
"matching",
"item",
"according",
"to",
"the",
"array",
"of",
"filters",
"provided",
".",
"Filters",
"are",
"key",
"-",
"value",
"pairs",
"that",
"are",
"ANDed",
"together",
"i",
".",
"e",
".",
"returned",
"items",
"match",
"all",
"... | train | https://github.com/andylolz/everypolitician-popolo-php/blob/701fca91b782871d463cfb56f3c1c7afb121eb9f/src/Collections/PopoloCollection.php#L112-L124 |
attm2x/m2x-php | src/StreamCollection.php | StreamCollection.setResource | protected function setResource($i, $data) {
$this->resources[$i] = new static::$resourceClass($this->client, $this->parent, $data);
} | php | protected function setResource($i, $data) {
$this->resources[$i] = new static::$resourceClass($this->client, $this->parent, $data);
} | [
"protected",
"function",
"setResource",
"(",
"$",
"i",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"resources",
"[",
"$",
"i",
"]",
"=",
"new",
"static",
"::",
"$",
"resourceClass",
"(",
"$",
"this",
"->",
"client",
",",
"$",
"this",
"->",
"pare... | Initialize and add a resource to the collection
@param integer $i
@param array $data | [
"Initialize",
"and",
"add",
"a",
"resource",
"to",
"the",
"collection"
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/StreamCollection.php#L68-L70 |
dpu/edu-sdk-php | src/Education/Service/EducationService.php | EducationService.getTimetable | public function getTimetable($token, $semester, $week = '')
{
return $this->bizImpl->getTimetable($token, $semester, $week);
} | php | public function getTimetable($token, $semester, $week = '')
{
return $this->bizImpl->getTimetable($token, $semester, $week);
} | [
"public",
"function",
"getTimetable",
"(",
"$",
"token",
",",
"$",
"semester",
",",
"$",
"week",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"bizImpl",
"->",
"getTimetable",
"(",
"$",
"token",
",",
"$",
"semester",
",",
"$",
"week",
")",
";",
... | 获取学期理论课表
@param string $token 用户身份令牌
@param string $semester 学年学期, e.g. 2015-2016-1
@param string $week 周次
@return array | [
"获取学期理论课表"
] | train | https://github.com/dpu/edu-sdk-php/blob/a2994e89c6222021a62b5d2fa125680905146527/src/Education/Service/EducationService.php#L25-L28 |
dpu/edu-sdk-php | src/Education/Service/EducationService.php | EducationService.getCoursesScores | public function getCoursesScores($token, $kksj = '', $kcxz = '', $kcmc = '', $xsfs = 'all')
{
return $this->bizImpl->getCoursesScores($token, $kksj, $kcxz, $kcmc, $xsfs);
} | php | public function getCoursesScores($token, $kksj = '', $kcxz = '', $kcmc = '', $xsfs = 'all')
{
return $this->bizImpl->getCoursesScores($token, $kksj, $kcxz, $kcmc, $xsfs);
} | [
"public",
"function",
"getCoursesScores",
"(",
"$",
"token",
",",
"$",
"kksj",
"=",
"''",
",",
"$",
"kcxz",
"=",
"''",
",",
"$",
"kcmc",
"=",
"''",
",",
"$",
"xsfs",
"=",
"'all'",
")",
"{",
"return",
"$",
"this",
"->",
"bizImpl",
"->",
"getCoursesS... | 获取学期成绩
@param string $token 用户身份令牌
@param string $kksj 开课时间即查询某学期的成绩 默认为空查询所有学期 查询格式为 2014-2015-2(2014-2015学年第二学期)
@param string $kcxz 课程性质 默认为空查询所有
@param string $kcmc 课程名称 默认为空查询所有 指定某一课程名称进行查询
@param string $xsfs 查询结果显示方式,已知有 all(显示全部成绩)和 max(显示最好成绩),并没有区别
@return array | [
"获取学期成绩"
] | train | https://github.com/dpu/edu-sdk-php/blob/a2994e89c6222021a62b5d2fa125680905146527/src/Education/Service/EducationService.php#L61-L64 |
dpu/edu-sdk-php | src/Education/Service/EducationService.php | EducationService.getExamInfo | public function getExamInfo($token, $semester, $category = '3')
{
return $this->bizImpl->getExamInfo($token, $semester, $category);
} | php | public function getExamInfo($token, $semester, $category = '3')
{
return $this->bizImpl->getExamInfo($token, $semester, $category);
} | [
"public",
"function",
"getExamInfo",
"(",
"$",
"token",
",",
"$",
"semester",
",",
"$",
"category",
"=",
"'3'",
")",
"{",
"return",
"$",
"this",
"->",
"bizImpl",
"->",
"getExamInfo",
"(",
"$",
"token",
",",
"$",
"semester",
",",
"$",
"category",
")",
... | 获取考试安排
@param string $token 用户身份令牌
@param string $semester 学年学期, e.g. 2015-2016-1
@param string $category 考试类别, 1 => 期初, 2 => 期中, 3 => 期末
@return array | [
"获取考试安排"
] | train | https://github.com/dpu/edu-sdk-php/blob/a2994e89c6222021a62b5d2fa125680905146527/src/Education/Service/EducationService.php#L85-L88 |
cpliakas/search-framework | src/Search/Framework/SearchEngineAbstract.php | SearchEngineAbstract.getNormalizer | public function getNormalizer($data_type)
{
if (!isset($this->_normalizers[$data_type])) {
$message = 'Normalizer not attached for data type: ' . $data_type;
throw new \InvalidArgumentException($message);
}
return $this->_normalizers[$data_type];
} | php | public function getNormalizer($data_type)
{
if (!isset($this->_normalizers[$data_type])) {
$message = 'Normalizer not attached for data type: ' . $data_type;
throw new \InvalidArgumentException($message);
}
return $this->_normalizers[$data_type];
} | [
"public",
"function",
"getNormalizer",
"(",
"$",
"data_type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_normalizers",
"[",
"$",
"data_type",
"]",
")",
")",
"{",
"$",
"message",
"=",
"'Normalizer not attached for data type: '",
".",
"$",
... | Returns a mormalizer that is applied to fields of the given data type.
@param string $data_type
The data type the normalizer is applied to.
@return NormalizerInterface | [
"Returns",
"a",
"mormalizer",
"that",
"is",
"applied",
"to",
"fields",
"of",
"the",
"given",
"data",
"type",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/SearchEngineAbstract.php#L149-L156 |
phpnt/youtube | components/YouTubeData.php | YouTubeData.getVideoID | public function getVideoID($video_link = null, $video_id = null) {
$result = $this->checkVideo($video_link, $video_id, $part = 'snippet');
return $result['items'][0]['id'];
} | php | public function getVideoID($video_link = null, $video_id = null) {
$result = $this->checkVideo($video_link, $video_id, $part = 'snippet');
return $result['items'][0]['id'];
} | [
"public",
"function",
"getVideoID",
"(",
"$",
"video_link",
"=",
"null",
",",
"$",
"video_id",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"checkVideo",
"(",
"$",
"video_link",
",",
"$",
"video_id",
",",
"$",
"part",
"=",
"'snippet'",... | /* Получить ID видео. | [
"/",
"*",
"Получить",
"ID",
"видео",
"."
] | train | https://github.com/phpnt/youtube/blob/ee8d33f7dacf5ca1b511ddb24efe2a527b40b201/components/YouTubeData.php#L28-L31 |
phpnt/youtube | components/YouTubeData.php | YouTubeData.getFullData | public function getFullData($video_link = null, $video_id = null) {
return $this->checkVideo($video_link, $video_id, $part = 'snippet');
} | php | public function getFullData($video_link = null, $video_id = null) {
return $this->checkVideo($video_link, $video_id, $part = 'snippet');
} | [
"public",
"function",
"getFullData",
"(",
"$",
"video_link",
"=",
"null",
",",
"$",
"video_id",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"checkVideo",
"(",
"$",
"video_link",
",",
"$",
"video_id",
",",
"$",
"part",
"=",
"'snippet'",
")",
";"... | /* Общая информация о видео. | [
"/",
"*",
"Общая",
"информация",
"о",
"видео",
"."
] | train | https://github.com/phpnt/youtube/blob/ee8d33f7dacf5ca1b511ddb24efe2a527b40b201/components/YouTubeData.php#L34-L36 |
phpnt/youtube | components/YouTubeData.php | YouTubeData.getPreview | public function getPreview($video_link = null, $video_id = null, $size = 'default') {
$result = $this->checkVideo($video_link, $video_id, $part = 'snippet');
return $result['items'][0]['snippet']['thumbnails'][$size];
} | php | public function getPreview($video_link = null, $video_id = null, $size = 'default') {
$result = $this->checkVideo($video_link, $video_id, $part = 'snippet');
return $result['items'][0]['snippet']['thumbnails'][$size];
} | [
"public",
"function",
"getPreview",
"(",
"$",
"video_link",
"=",
"null",
",",
"$",
"video_id",
"=",
"null",
",",
"$",
"size",
"=",
"'default'",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"checkVideo",
"(",
"$",
"video_link",
",",
"$",
"video_id",... | /* Общая превью видео. $size может быть: default, medium, high, standard, maxres | [
"/",
"*",
"Общая",
"превью",
"видео",
".",
"$size",
"может",
"быть",
":",
"default",
"medium",
"high",
"standard",
"maxres"
] | train | https://github.com/phpnt/youtube/blob/ee8d33f7dacf5ca1b511ddb24efe2a527b40b201/components/YouTubeData.php#L39-L42 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.