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 |
|---|---|---|---|---|---|---|---|---|---|---|
dancryer/PHPCI | PHPCI/Helper/Lang.php | Lang.getLanguageOptions | public static function getLanguageOptions()
{
$languages = array();
foreach (self::$languages as $language) {
$strings = array();
require(PHPCI_DIR . 'PHPCI/Languages/lang.' . $language . '.php');
$languages[$language] = $strings['language_name'];
}
... | php | public static function getLanguageOptions()
{
$languages = array();
foreach (self::$languages as $language) {
$strings = array();
require(PHPCI_DIR . 'PHPCI/Languages/lang.' . $language . '.php');
$languages[$language] = $strings['language_name'];
}
... | [
"public",
"static",
"function",
"getLanguageOptions",
"(",
")",
"{",
"$",
"languages",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"languages",
"as",
"$",
"language",
")",
"{",
"$",
"strings",
"=",
"array",
"(",
")",
";",
"require",... | Return a list of available languages and their names.
@return array | [
"Return",
"a",
"list",
"of",
"available",
"languages",
"and",
"their",
"names",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Lang.php#L84-L95 |
dancryer/PHPCI | PHPCI/Helper/Lang.php | Lang.init | public static function init(Config $config)
{
self::loadAvailableLanguages();
// Try cookies first:
if (isset($_COOKIE) && array_key_exists('phpcilang', $_COOKIE) && self::setLanguage($_COOKIE['phpcilang'])) {
return;
}
// Try user language:
if (isset($_... | php | public static function init(Config $config)
{
self::loadAvailableLanguages();
// Try cookies first:
if (isset($_COOKIE) && array_key_exists('phpcilang', $_COOKIE) && self::setLanguage($_COOKIE['phpcilang'])) {
return;
}
// Try user language:
if (isset($_... | [
"public",
"static",
"function",
"init",
"(",
"Config",
"$",
"config",
")",
"{",
"self",
"::",
"loadAvailableLanguages",
"(",
")",
";",
"// Try cookies first:",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
")",
"&&",
"array_key_exists",
"(",
"'phpcilang'",
",",
"... | Initialise the Language helper, try load the language file for the user's browser or the configured default.
@param Config $config | [
"Initialise",
"the",
"Language",
"helper",
"try",
"load",
"the",
"language",
"file",
"for",
"the",
"user",
"s",
"browser",
"or",
"the",
"configured",
"default",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Lang.php#L112-L144 |
dancryer/PHPCI | PHPCI/Helper/Lang.php | Lang.loadLanguage | protected static function loadLanguage()
{
$langFile = PHPCI_DIR . 'PHPCI/Languages/lang.' . self::$language . '.php';
if (!file_exists($langFile)) {
return null;
}
require($langFile);
if (is_null($strings) || !is_array($strings) || !count($strings)) {
... | php | protected static function loadLanguage()
{
$langFile = PHPCI_DIR . 'PHPCI/Languages/lang.' . self::$language . '.php';
if (!file_exists($langFile)) {
return null;
}
require($langFile);
if (is_null($strings) || !is_array($strings) || !count($strings)) {
... | [
"protected",
"static",
"function",
"loadLanguage",
"(",
")",
"{",
"$",
"langFile",
"=",
"PHPCI_DIR",
".",
"'PHPCI/Languages/lang.'",
".",
"self",
"::",
"$",
"language",
".",
"'.php'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"langFile",
")",
")",
"{",... | Load a specific language file.
@return string[]|null | [
"Load",
"a",
"specific",
"language",
"file",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Lang.php#L151-L166 |
dancryer/PHPCI | PHPCI/Helper/Lang.php | Lang.loadAvailableLanguages | protected static function loadAvailableLanguages()
{
$matches = array();
foreach (glob(PHPCI_DIR . 'PHPCI/Languages/lang.*.php') as $file) {
if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) {
self::$languages[] = $matches[1];
}
}
... | php | protected static function loadAvailableLanguages()
{
$matches = array();
foreach (glob(PHPCI_DIR . 'PHPCI/Languages/lang.*.php') as $file) {
if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) {
self::$languages[] = $matches[1];
}
}
... | [
"protected",
"static",
"function",
"loadAvailableLanguages",
"(",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"glob",
"(",
"PHPCI_DIR",
".",
"'PHPCI/Languages/lang.*.php'",
")",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"preg_match",... | Load the names of all available languages. | [
"Load",
"the",
"names",
"of",
"all",
"available",
"languages",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Lang.php#L171-L179 |
dancryer/PHPCI | PHPCI/Helper/Lang.php | Lang.formatDateTime | public static function formatDateTime(\DateTime $dateTime, $format = 'lll')
{
return sprintf(
'<time datetime="%s" data-format="%s">%s</time>',
$dateTime->format(\DateTime::ISO8601),
$format,
$dateTime->format(\DateTime::RFC2822)
);
} | php | public static function formatDateTime(\DateTime $dateTime, $format = 'lll')
{
return sprintf(
'<time datetime="%s" data-format="%s">%s</time>',
$dateTime->format(\DateTime::ISO8601),
$format,
$dateTime->format(\DateTime::RFC2822)
);
} | [
"public",
"static",
"function",
"formatDateTime",
"(",
"\\",
"DateTime",
"$",
"dateTime",
",",
"$",
"format",
"=",
"'lll'",
")",
"{",
"return",
"sprintf",
"(",
"'<time datetime=\"%s\" data-format=\"%s\">%s</time>'",
",",
"$",
"dateTime",
"->",
"format",
"(",
"\\",... | Create a time tag for localization.
See http://momentjs.com/docs/#/displaying/format/ for a list of supported formats.
@param \DateTime $dateTime The dateTime to represent.
@param string $format The moment.js format to use.
@return string The formatted tag. | [
"Create",
"a",
"time",
"tag",
"for",
"localization",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Lang.php#L191-L199 |
dancryer/PHPCI | PHPCI/Plugin/TechnicalDebt.php | TechnicalDebt.setOptions | protected function setOptions($options)
{
foreach (array('directory', 'path', 'ignore', 'allowed_errors') as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}
}
} | php | protected function setOptions($options)
{
foreach (array('directory', 'path', 'ignore', 'allowed_errors') as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}
}
} | [
"protected",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"foreach",
"(",
"array",
"(",
"'directory'",
",",
"'path'",
",",
"'ignore'",
",",
"'allowed_errors'",
")",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
"... | Handle this plugin's options.
@param $options | [
"Handle",
"this",
"plugin",
"s",
"options",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/TechnicalDebt.php#L110-L117 |
dancryer/PHPCI | PHPCI/Plugin/TechnicalDebt.php | TechnicalDebt.execute | public function execute()
{
$success = true;
$this->phpci->logExecOutput(false);
$errorCount = $this->getErrorList();
$this->phpci->log("Found $errorCount instances of " . implode(', ', $this->searches));
$this->build->storeMeta('technical_debt-warnings', $errorCount);
... | php | public function execute()
{
$success = true;
$this->phpci->logExecOutput(false);
$errorCount = $this->getErrorList();
$this->phpci->log("Found $errorCount instances of " . implode(', ', $this->searches));
$this->build->storeMeta('technical_debt-warnings', $errorCount);
... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"success",
"=",
"true",
";",
"$",
"this",
"->",
"phpci",
"->",
"logExecOutput",
"(",
"false",
")",
";",
"$",
"errorCount",
"=",
"$",
"this",
"->",
"getErrorList",
"(",
")",
";",
"$",
"this",
"->",
... | Runs the plugin | [
"Runs",
"the",
"plugin"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/TechnicalDebt.php#L122-L138 |
dancryer/PHPCI | PHPCI/Plugin/TechnicalDebt.php | TechnicalDebt.getErrorList | public function getErrorList()
{
$dirIterator = new \RecursiveDirectoryIterator($this->directory);
$iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST);
$files = array();
$ignores = $this->ignore;
$ignores[] = 'phpci.yml';
... | php | public function getErrorList()
{
$dirIterator = new \RecursiveDirectoryIterator($this->directory);
$iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST);
$files = array();
$ignores = $this->ignore;
$ignores[] = 'phpci.yml';
... | [
"public",
"function",
"getErrorList",
"(",
")",
"{",
"$",
"dirIterator",
"=",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
"this",
"->",
"directory",
")",
";",
"$",
"iterator",
"=",
"new",
"\\",
"RecursiveIteratorIterator",
"(",
"$",
"dirIterator",
","... | Gets the number and list of errors returned from the search
@return array | [
"Gets",
"the",
"number",
"and",
"list",
"of",
"errors",
"returned",
"from",
"the",
"search"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/TechnicalDebt.php#L145-L206 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.init | public function init()
{
$this->buildStore = Store\Factory::getStore('Build');
$this->projectStore = Store\Factory::getStore('Project');
$this->buildService = new BuildService($this->buildStore);
} | php | public function init()
{
$this->buildStore = Store\Factory::getStore('Build');
$this->projectStore = Store\Factory::getStore('Project');
$this->buildService = new BuildService($this->buildStore);
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"buildStore",
"=",
"Store",
"\\",
"Factory",
"::",
"getStore",
"(",
"'Build'",
")",
";",
"$",
"this",
"->",
"projectStore",
"=",
"Store",
"\\",
"Factory",
"::",
"getStore",
"(",
"'Project'",... | Initialise the controller, set up stores and services. | [
"Initialise",
"the",
"controller",
"set",
"up",
"stores",
"and",
"services",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L53-L58 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.handleAction | public function handleAction($action, $actionParams)
{
$response = new b8\Http\Response\JsonResponse();
try {
$data = parent::handleAction($action, $actionParams);
if (isset($data['responseCode'])) {
$response->setResponseCode($data['responseCode']);
... | php | public function handleAction($action, $actionParams)
{
$response = new b8\Http\Response\JsonResponse();
try {
$data = parent::handleAction($action, $actionParams);
if (isset($data['responseCode'])) {
$response->setResponseCode($data['responseCode']);
... | [
"public",
"function",
"handleAction",
"(",
"$",
"action",
",",
"$",
"actionParams",
")",
"{",
"$",
"response",
"=",
"new",
"b8",
"\\",
"Http",
"\\",
"Response",
"\\",
"JsonResponse",
"(",
")",
";",
"try",
"{",
"$",
"data",
"=",
"parent",
"::",
"handleA... | Handle the action, Ensuring to return a JsonResponse.
@param string $action
@param mixed $actionParams
@return \b8\Http\Response | [
"Handle",
"the",
"action",
"Ensuring",
"to",
"return",
"a",
"JsonResponse",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L67-L82 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.bitbucket | public function bitbucket($projectId)
{
$project = $this->fetchProject($projectId, 'bitbucket');
// Support both old services and new webhooks
if ($payload = $this->getParam('payload')) {
return $this->bitbucketService(json_decode($payload, true), $project);
}
... | php | public function bitbucket($projectId)
{
$project = $this->fetchProject($projectId, 'bitbucket');
// Support both old services and new webhooks
if ($payload = $this->getParam('payload')) {
return $this->bitbucketService(json_decode($payload, true), $project);
}
... | [
"public",
"function",
"bitbucket",
"(",
"$",
"projectId",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"fetchProject",
"(",
"$",
"projectId",
",",
"'bitbucket'",
")",
";",
"// Support both old services and new webhooks",
"if",
"(",
"$",
"payload",
"=",
"$... | Called by Bitbucket. | [
"Called",
"by",
"Bitbucket",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L87-L107 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.bitbucketWebhook | protected function bitbucketWebhook($payload, $project)
{
$results = array();
$status = 'failed';
foreach ($payload['push']['changes'] as $commit) {
try {
$email = $commit['new']['target']['author']['raw'];
$email = substr($email, 0, strpos($email,... | php | protected function bitbucketWebhook($payload, $project)
{
$results = array();
$status = 'failed';
foreach ($payload['push']['changes'] as $commit) {
try {
$email = $commit['new']['target']['author']['raw'];
$email = substr($email, 0, strpos($email,... | [
"protected",
"function",
"bitbucketWebhook",
"(",
"$",
"payload",
",",
"$",
"project",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"status",
"=",
"'failed'",
";",
"foreach",
"(",
"$",
"payload",
"[",
"'push'",
"]",
"[",
"'changes'",
"]"... | Bitbucket webhooks. | [
"Bitbucket",
"webhooks",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L112-L136 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.bitbucketService | protected function bitbucketService($payload, $project)
{
$payload = json_decode($this->getParam('payload'), true);
$results = array();
$status = 'failed';
foreach ($payload['commits'] as $commit) {
try {
$email = $commit['raw_author'];
$e... | php | protected function bitbucketService($payload, $project)
{
$payload = json_decode($this->getParam('payload'), true);
$results = array();
$status = 'failed';
foreach ($payload['commits'] as $commit) {
try {
$email = $commit['raw_author'];
$e... | [
"protected",
"function",
"bitbucketService",
"(",
"$",
"payload",
",",
"$",
"project",
")",
"{",
"$",
"payload",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"getParam",
"(",
"'payload'",
")",
",",
"true",
")",
";",
"$",
"results",
"=",
"array",
"(",
")... | Bitbucket POST service. | [
"Bitbucket",
"POST",
"service",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L141-L167 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.git | public function git($projectId)
{
$project = $this->fetchProject($projectId, array('local', 'remote'));
$branch = $this->getParam('branch', $project->getBranch());
$commit = $this->getParam('commit');
$commitMessage = $this->getParam('message');
$committer = $this->getParam('... | php | public function git($projectId)
{
$project = $this->fetchProject($projectId, array('local', 'remote'));
$branch = $this->getParam('branch', $project->getBranch());
$commit = $this->getParam('commit');
$commitMessage = $this->getParam('message');
$committer = $this->getParam('... | [
"public",
"function",
"git",
"(",
"$",
"projectId",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"fetchProject",
"(",
"$",
"projectId",
",",
"array",
"(",
"'local'",
",",
"'remote'",
")",
")",
";",
"$",
"branch",
"=",
"$",
"this",
"->",
"getPara... | Called by POSTing to /webhook/git/<project_id>?branch=<branch>&commit=<commit>
@param string $projectId | [
"Called",
"by",
"POSTing",
"to",
"/",
"webhook",
"/",
"git",
"/",
"<project_id",
">",
"?branch",
"=",
"<branch",
">",
"&commit",
"=",
"<commit",
">"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L174-L184 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.github | public function github($projectId)
{
$project = $this->fetchProject($projectId, 'github');
switch ($_SERVER['CONTENT_TYPE']) {
case 'application/json':
$payload = json_decode(file_get_contents('php://input'), true);
break;
case 'application/x-... | php | public function github($projectId)
{
$project = $this->fetchProject($projectId, 'github');
switch ($_SERVER['CONTENT_TYPE']) {
case 'application/json':
$payload = json_decode(file_get_contents('php://input'), true);
break;
case 'application/x-... | [
"public",
"function",
"github",
"(",
"$",
"projectId",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"fetchProject",
"(",
"$",
"projectId",
",",
"'github'",
")",
";",
"switch",
"(",
"$",
"_SERVER",
"[",
"'CONTENT_TYPE'",
"]",
")",
"{",
"case",
"'ap... | Called by Github Webhooks: | [
"Called",
"by",
"Github",
"Webhooks",
":"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L189-L215 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.githubCommitRequest | protected function githubCommitRequest(Project $project, array $payload)
{
// Github sends a payload when you close a pull request with a
// non-existent commit. We don't want this.
if (array_key_exists('after', $payload) && $payload['after'] === '0000000000000000000000000000000000000000') {... | php | protected function githubCommitRequest(Project $project, array $payload)
{
// Github sends a payload when you close a pull request with a
// non-existent commit. We don't want this.
if (array_key_exists('after', $payload) && $payload['after'] === '0000000000000000000000000000000000000000') {... | [
"protected",
"function",
"githubCommitRequest",
"(",
"Project",
"$",
"project",
",",
"array",
"$",
"payload",
")",
"{",
"// Github sends a payload when you close a pull request with a",
"// non-existent commit. We don't want this.",
"if",
"(",
"array_key_exists",
"(",
"'after'"... | Handle the payload when Github sends a commit webhook.
@param Project $project
@param array $payload
@param b8\Http\Response\JsonResponse $response
@return b8\Http\Response\JsonResponse | [
"Handle",
"the",
"payload",
"when",
"Github",
"sends",
"a",
"commit",
"webhook",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L226-L272 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.githubPullRequest | protected function githubPullRequest(Project $project, array $payload)
{
// We only want to know about open pull requests:
if (!in_array($payload['action'], array('opened', 'synchronize', 'reopened'))) {
return array('status' => 'ok');
}
$headers = array();
$toke... | php | protected function githubPullRequest(Project $project, array $payload)
{
// We only want to know about open pull requests:
if (!in_array($payload['action'], array('opened', 'synchronize', 'reopened'))) {
return array('status' => 'ok');
}
$headers = array();
$toke... | [
"protected",
"function",
"githubPullRequest",
"(",
"Project",
"$",
"project",
",",
"array",
"$",
"payload",
")",
"{",
"// We only want to know about open pull requests:",
"if",
"(",
"!",
"in_array",
"(",
"$",
"payload",
"[",
"'action'",
"]",
",",
"array",
"(",
"... | Handle the payload when Github sends a Pull Request webhook.
@param Project $project
@param array $payload | [
"Handle",
"the",
"payload",
"when",
"Github",
"sends",
"a",
"Pull",
"Request",
"webhook",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L280-L337 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.gitlab | public function gitlab($projectId)
{
$project = $this->fetchProject($projectId, 'gitlab');
$payloadString = file_get_contents("php://input");
$payload = json_decode($payloadString, true);
// build on merge request events
if (isset($payload['object_kind']) && $payload['objec... | php | public function gitlab($projectId)
{
$project = $this->fetchProject($projectId, 'gitlab');
$payloadString = file_get_contents("php://input");
$payload = json_decode($payloadString, true);
// build on merge request events
if (isset($payload['object_kind']) && $payload['objec... | [
"public",
"function",
"gitlab",
"(",
"$",
"projectId",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"fetchProject",
"(",
"$",
"projectId",
",",
"'gitlab'",
")",
";",
"$",
"payloadString",
"=",
"file_get_contents",
"(",
"\"php://input\"",
")",
";",
"$"... | Called by Gitlab Webhooks: | [
"Called",
"by",
"Gitlab",
"Webhooks",
":"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L342-L387 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.svn | public function svn($projectId)
{
$project = $this->fetchProject($projectId, 'svn');
$branch = $this->getParam('branch', $project->getBranch());
$commit = $this->getParam('commit');
$commitMessage = $this->getParam('message');
$committer = $this->getParam('committer');
... | php | public function svn($projectId)
{
$project = $this->fetchProject($projectId, 'svn');
$branch = $this->getParam('branch', $project->getBranch());
$commit = $this->getParam('commit');
$commitMessage = $this->getParam('message');
$committer = $this->getParam('committer');
... | [
"public",
"function",
"svn",
"(",
"$",
"projectId",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"fetchProject",
"(",
"$",
"projectId",
",",
"'svn'",
")",
";",
"$",
"branch",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'branch'",
",",
"$",
"projec... | Called by POSTing to /webhook/svn/<project_id>?branch=<branch>&commit=<commit>
@author Sylvain Lévesque <slevesque@gezere.com>
@param string $projectId | [
"Called",
"by",
"POSTing",
"to",
"/",
"webhook",
"/",
"svn",
"/",
"<project_id",
">",
"?branch",
"=",
"<branch",
">",
"&commit",
"=",
"<commit",
">"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L396-L405 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.createBuild | protected function createBuild(
Project $project,
$commitId,
$branch,
$committer,
$commitMessage,
bool $rebuild = false,
array $extra = null
) {
// Check if a build already exists for this commit ID when not rebuilding:
if (!$rebuild) {
... | php | protected function createBuild(
Project $project,
$commitId,
$branch,
$committer,
$commitMessage,
bool $rebuild = false,
array $extra = null
) {
// Check if a build already exists for this commit ID when not rebuilding:
if (!$rebuild) {
... | [
"protected",
"function",
"createBuild",
"(",
"Project",
"$",
"project",
",",
"$",
"commitId",
",",
"$",
"branch",
",",
"$",
"committer",
",",
"$",
"commitMessage",
",",
"bool",
"$",
"rebuild",
"=",
"false",
",",
"array",
"$",
"extra",
"=",
"null",
")",
... | Wrapper for creating a new build.
@param Project $project
@param string $commitId
@param string $branch
@param string $committer
@param string $commitMessage
@param bool $rebuild
@param array $extra
@return array
@throws Exception | [
"Wrapper",
"for",
"creating",
"a",
"new",
"build",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L422-L447 |
dancryer/PHPCI | PHPCI/Controller/WebhookController.php | WebhookController.fetchProject | protected function fetchProject($projectId, $expectedType)
{
$project = $this->projectStore->getById($projectId);
if (empty($project)) {
throw new Exception('Project does not exist: ' . $projectId);
}
if (is_array($expectedType)
? !in_array($project->getType... | php | protected function fetchProject($projectId, $expectedType)
{
$project = $this->projectStore->getById($projectId);
if (empty($project)) {
throw new Exception('Project does not exist: ' . $projectId);
}
if (is_array($expectedType)
? !in_array($project->getType... | [
"protected",
"function",
"fetchProject",
"(",
"$",
"projectId",
",",
"$",
"expectedType",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"projectStore",
"->",
"getById",
"(",
"$",
"projectId",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"project",
")",
... | Fetch a project and check its type.
@param int $projectId
@param array|string $expectedType
@return Project
@throws Exception If the project does not exist or is not of the expected type. | [
"Fetch",
"a",
"project",
"and",
"check",
"its",
"type",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/WebhookController.php#L459-L475 |
dancryer/PHPCI | PHPCI/Command/CreateAdminCommand.php | CreateAdminCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$userService = new UserService($this->userStore);
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
// Function to validate mail address.
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$userService = new UserService($this->userStore);
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
// Function to validate mail address.
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"userService",
"=",
"new",
"UserService",
"(",
"$",
"this",
"->",
"userStore",
")",
";",
"/** @var $dialog \\Symfony\\Component\\Console\\H... | Creates an admin user in the existing PHPCI database
{@inheritDoc} | [
"Creates",
"an",
"admin",
"user",
"in",
"the",
"existing",
"PHPCI",
"database"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Command/CreateAdminCommand.php#L54-L81 |
dancryer/PHPCI | PHPCI/Store/Base/BuildStoreBase.php | BuildStoreBase.getById | public function getById($value, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `build` WHERE `id` = :id LIMIT 1';
$stmt = Database::getConnection($useConnection)... | php | public function getById($value, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `build` WHERE `id` = :id LIMIT 1';
$stmt = Database::getConnection($useConnection)... | [
"public",
"function",
"getById",
"(",
"$",
"value",
",",
"$",
"useConnection",
"=",
"'read'",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"HttpException",
"(",
"'Value passed to '",
".",
"__FUNCTION__",
".",
"' cannot ... | Get a single Build by Id.
@return null|Build | [
"Get",
"a",
"single",
"Build",
"by",
"Id",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/Base/BuildStoreBase.php#L35-L52 |
dancryer/PHPCI | PHPCI/Store/Base/BuildStoreBase.php | BuildStoreBase.getByProjectId | public function getByProjectId($value, $limit = 1000, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `build` WHERE `project_id` = :project_id LIMIT :limit';
$st... | php | public function getByProjectId($value, $limit = 1000, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `build` WHERE `project_id` = :project_id LIMIT :limit';
$st... | [
"public",
"function",
"getByProjectId",
"(",
"$",
"value",
",",
"$",
"limit",
"=",
"1000",
",",
"$",
"useConnection",
"=",
"'read'",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"HttpException",
"(",
"'Value passed to... | Get multiple Build by ProjectId.
@return array | [
"Get",
"multiple",
"Build",
"by",
"ProjectId",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/Base/BuildStoreBase.php#L58-L84 |
dancryer/PHPCI | PHPCI/Plugin/SlackNotify.php | SlackNotify.execute | public function execute()
{
$body = $this->phpci->interpolate($this->message);
$client = new \Maknz\Slack\Client($this->webHook);
$message = $client->createMessage();
if (!empty($this->room)) {
$message->setChannel($this->room);
}
if (!empty($this->use... | php | public function execute()
{
$body = $this->phpci->interpolate($this->message);
$client = new \Maknz\Slack\Client($this->webHook);
$message = $client->createMessage();
if (!empty($this->room)) {
$message->setChannel($this->room);
}
if (!empty($this->use... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"body",
"=",
"$",
"this",
"->",
"phpci",
"->",
"interpolate",
"(",
"$",
"this",
"->",
"message",
")",
";",
"$",
"client",
"=",
"new",
"\\",
"Maknz",
"\\",
"Slack",
"\\",
"Client",
"(",
"$",
"this... | Run the Slack plugin.
@return bool | [
"Run",
"the",
"Slack",
"plugin",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/SlackNotify.php#L82-L136 |
dancryer/PHPCI | PHPCI/Plugin/HipchatNotify.php | HipchatNotify.execute | public function execute()
{
$hipChat = new \HipChat\HipChat($this->authToken);
$message = $this->phpci->interpolate($this->message);
$result = true;
if (is_array($this->room)) {
foreach ($this->room as $room) {
if (!$hipChat->message_room($room, 'PHPCI', ... | php | public function execute()
{
$hipChat = new \HipChat\HipChat($this->authToken);
$message = $this->phpci->interpolate($this->message);
$result = true;
if (is_array($this->room)) {
foreach ($this->room as $room) {
if (!$hipChat->message_room($room, 'PHPCI', ... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"hipChat",
"=",
"new",
"\\",
"HipChat",
"\\",
"HipChat",
"(",
"$",
"this",
"->",
"authToken",
")",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"phpci",
"->",
"interpolate",
"(",
"$",
"this",
"->",... | Run the HipChat plugin.
@return bool | [
"Run",
"the",
"HipChat",
"plugin",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/HipchatNotify.php#L74-L93 |
dancryer/PHPCI | PHPCI/Model/Base/BuildMetaBase.php | BuildMetaBase.setMetaKey | public function setMetaKey($value)
{
$this->_validateNotNull('MetaKey', $value);
$this->_validateString('MetaKey', $value);
if ($this->data['meta_key'] === $value) {
return;
}
$this->data['meta_key'] = $value;
$this->_setModified('meta_key');
} | php | public function setMetaKey($value)
{
$this->_validateNotNull('MetaKey', $value);
$this->_validateString('MetaKey', $value);
if ($this->data['meta_key'] === $value) {
return;
}
$this->data['meta_key'] = $value;
$this->_setModified('meta_key');
} | [
"public",
"function",
"setMetaKey",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_validateNotNull",
"(",
"'MetaKey'",
",",
"$",
"value",
")",
";",
"$",
"this",
"->",
"_validateString",
"(",
"'MetaKey'",
",",
"$",
"value",
")",
";",
"if",
"(",
"$",
... | Set the value of MetaKey / meta_key.
Must not be null.
@param $value string | [
"Set",
"the",
"value",
"of",
"MetaKey",
"/",
"meta_key",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Base/BuildMetaBase.php#L262-L274 |
dancryer/PHPCI | PHPCI/Model/Base/BuildMetaBase.php | BuildMetaBase.setMetaValue | public function setMetaValue($value)
{
$this->_validateNotNull('MetaValue', $value);
$this->_validateString('MetaValue', $value);
if ($this->data['meta_value'] === $value) {
return;
}
$this->data['meta_value'] = $value;
$this->_setModified('meta_value')... | php | public function setMetaValue($value)
{
$this->_validateNotNull('MetaValue', $value);
$this->_validateString('MetaValue', $value);
if ($this->data['meta_value'] === $value) {
return;
}
$this->data['meta_value'] = $value;
$this->_setModified('meta_value')... | [
"public",
"function",
"setMetaValue",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_validateNotNull",
"(",
"'MetaValue'",
",",
"$",
"value",
")",
";",
"$",
"this",
"->",
"_validateString",
"(",
"'MetaValue'",
",",
"$",
"value",
")",
";",
"if",
"(",
... | Set the value of MetaValue / meta_value.
Must not be null.
@param $value string | [
"Set",
"the",
"value",
"of",
"MetaValue",
"/",
"meta_value",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Base/BuildMetaBase.php#L282-L294 |
dancryer/PHPCI | PHPCI/Plugin/Behat.php | Behat.execute | public function execute()
{
$curdir = getcwd();
chdir($this->phpci->buildPath);
$behat = $this->executable;
if (!$behat) {
$this->phpci->logFailure(Lang::get('could_not_find', 'behat'));
return false;
}
$success = $this->phpci->executeComma... | php | public function execute()
{
$curdir = getcwd();
chdir($this->phpci->buildPath);
$behat = $this->executable;
if (!$behat) {
$this->phpci->logFailure(Lang::get('could_not_find', 'behat'));
return false;
}
$success = $this->phpci->executeComma... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"curdir",
"=",
"getcwd",
"(",
")",
";",
"chdir",
"(",
"$",
"this",
"->",
"phpci",
"->",
"buildPath",
")",
";",
"$",
"behat",
"=",
"$",
"this",
"->",
"executable",
";",
"if",
"(",
"!",
"$",
"beh... | Runs Behat tests. | [
"Runs",
"Behat",
"tests",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Behat.php#L61-L83 |
dancryer/PHPCI | PHPCI/Plugin/Behat.php | Behat.parseBehatOutput | public function parseBehatOutput()
{
$output = $this->phpci->getLastOutput();
$parts = explode('---', $output);
if (count($parts) <= 1) {
return array(0, array());
}
$lines = explode(PHP_EOL, $parts[1]);
$storeFailures = false;
$data = array();... | php | public function parseBehatOutput()
{
$output = $this->phpci->getLastOutput();
$parts = explode('---', $output);
if (count($parts) <= 1) {
return array(0, array());
}
$lines = explode(PHP_EOL, $parts[1]);
$storeFailures = false;
$data = array();... | [
"public",
"function",
"parseBehatOutput",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"phpci",
"->",
"getLastOutput",
"(",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"'---'",
",",
"$",
"output",
")",
";",
"if",
"(",
"count",
"(",
"$",
"... | Parse the behat output and return details on failures
@return array | [
"Parse",
"the",
"behat",
"output",
"and",
"return",
"details",
"on",
"failures"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Behat.php#L90-L137 |
dancryer/PHPCI | PHPCI/Model/Project.php | Project.getPreviousBuild | public function getPreviousBuild($branch = 'master')
{
$criteria = array('branch' => $branch, 'project_id' => $this->getId());
$order = array('id' => 'DESC');
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order);
if (is_array... | php | public function getPreviousBuild($branch = 'master')
{
$criteria = array('branch' => $branch, 'project_id' => $this->getId());
$order = array('id' => 'DESC');
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order);
if (is_array... | [
"public",
"function",
"getPreviousBuild",
"(",
"$",
"branch",
"=",
"'master'",
")",
"{",
"$",
"criteria",
"=",
"array",
"(",
"'branch'",
"=>",
"$",
"branch",
",",
"'project_id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
")",
";",
"$",
"order",
"=",
... | Return the previous build from a specific branch, for this project.
@param string $branch
@return mixed|null | [
"Return",
"the",
"previous",
"build",
"from",
"a",
"specific",
"branch",
"for",
"this",
"project",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Project.php#L58-L74 |
dancryer/PHPCI | PHPCI/Model/Project.php | Project.setAccessInformation | public function setAccessInformation($value)
{
if (is_array($value)) {
$value = json_encode($value);
}
parent::setAccessInformation($value);
} | php | public function setAccessInformation($value)
{
if (is_array($value)) {
$value = json_encode($value);
}
parent::setAccessInformation($value);
} | [
"public",
"function",
"setAccessInformation",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"json_encode",
"(",
"$",
"value",
")",
";",
"}",
"parent",
"::",
"setAccessInformation",
"(",
"$",
"v... | Store this project's access_information data
@param string|array $value | [
"Store",
"this",
"project",
"s",
"access_information",
"data"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Project.php#L80-L87 |
dancryer/PHPCI | PHPCI/Model/Project.php | Project.getAccessInformation | public function getAccessInformation($key = null)
{
$info = $this->data['access_information'];
// Handle old-format (serialized) access information first:
if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) {
$data = unserialize($info);
} else {
... | php | public function getAccessInformation($key = null)
{
$info = $this->data['access_information'];
// Handle old-format (serialized) access information first:
if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) {
$data = unserialize($info);
} else {
... | [
"public",
"function",
"getAccessInformation",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"info",
"=",
"$",
"this",
"->",
"data",
"[",
"'access_information'",
"]",
";",
"// Handle old-format (serialized) access information first:",
"if",
"(",
"!",
"empty",
"(",
... | Get this project's access_information data. Pass a specific key or null for all data.
@param string|null $key
@return mixed|null|string | [
"Get",
"this",
"project",
"s",
"access_information",
"data",
".",
"Pass",
"a",
"specific",
"key",
"or",
"null",
"for",
"all",
"data",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Project.php#L94-L114 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.init | public function init()
{
$this->response->disableLayout();
$this->userStore = b8\Store\Factory::getStore('User');
} | php | public function init()
{
$this->response->disableLayout();
$this->userStore = b8\Store\Factory::getStore('User');
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"response",
"->",
"disableLayout",
"(",
")",
";",
"$",
"this",
"->",
"userStore",
"=",
"b8",
"\\",
"Store",
"\\",
"Factory",
"::",
"getStore",
"(",
"'User'",
")",
";",
"}"
] | Initialise the controller, set up stores and services. | [
"Initialise",
"the",
"controller",
"set",
"up",
"stores",
"and",
"services",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L32-L36 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.login | public function login()
{
$isLoginFailure = false;
if ($this->request->getMethod() == 'POST') {
$token = $this->getParam('token');
if (!isset($token, $_SESSION['login_token']) || $token !== $_SESSION['login_token']) {
$isLoginFailure = true;
} els... | php | public function login()
{
$isLoginFailure = false;
if ($this->request->getMethod() == 'POST') {
$token = $this->getParam('token');
if (!isset($token, $_SESSION['login_token']) || $token !== $_SESSION['login_token']) {
$isLoginFailure = true;
} els... | [
"public",
"function",
"login",
"(",
")",
"{",
"$",
"isLoginFailure",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"getMethod",
"(",
")",
"==",
"'POST'",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'token'",
... | Handles user login (form and processing) | [
"Handles",
"user",
"login",
"(",
"form",
"and",
"processing",
")"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L41-L99 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.logout | public function logout()
{
unset($_SESSION['phpci_user']);
unset($_SESSION['phpci_user_id']);
session_destroy();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL);
return $response;
} | php | public function logout()
{
unset($_SESSION['phpci_user']);
unset($_SESSION['phpci_user_id']);
session_destroy();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL);
return $response;
} | [
"public",
"function",
"logout",
"(",
")",
"{",
"unset",
"(",
"$",
"_SESSION",
"[",
"'phpci_user'",
"]",
")",
";",
"unset",
"(",
"$",
"_SESSION",
"[",
"'phpci_user_id'",
"]",
")",
";",
"session_destroy",
"(",
")",
";",
"$",
"response",
"=",
"new",
"b8",... | Handles user logout. | [
"Handles",
"user",
"logout",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L104-L114 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.forgotPassword | public function forgotPassword()
{
if ($this->request->getMethod() == 'POST') {
$email = $this->getParam('email', null);
$user = $this->userStore->getByEmail($email);
if (empty($user)) {
$this->view->error = Lang::get('reset_no_user_exists');
... | php | public function forgotPassword()
{
if ($this->request->getMethod() == 'POST') {
$email = $this->getParam('email', null);
$user = $this->userStore->getByEmail($email);
if (empty($user)) {
$this->view->error = Lang::get('reset_no_user_exists');
... | [
"public",
"function",
"forgotPassword",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"getMethod",
"(",
")",
"==",
"'POST'",
")",
"{",
"$",
"email",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'email'",
",",
"null",
")",
";",
"$",
"us... | Allows the user to request a password reset email.
@return string | [
"Allows",
"the",
"user",
"to",
"request",
"a",
"password",
"reset",
"email",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L120-L146 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.resetPassword | public function resetPassword($userId, $key)
{
$user = $this->userStore->getById($userId);
$userKey = md5(date('Y-m-d') . $user->getHash());
if (empty($user) || $key != $userKey) {
$this->view->error = Lang::get('reset_invalid');
return $this->view->render();
... | php | public function resetPassword($userId, $key)
{
$user = $this->userStore->getById($userId);
$userKey = md5(date('Y-m-d') . $user->getHash());
if (empty($user) || $key != $userKey) {
$this->view->error = Lang::get('reset_invalid');
return $this->view->render();
... | [
"public",
"function",
"resetPassword",
"(",
"$",
"userId",
",",
"$",
"key",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userStore",
"->",
"getById",
"(",
"$",
"userId",
")",
";",
"$",
"userKey",
"=",
"md5",
"(",
"date",
"(",
"'Y-m-d'",
")",
"."... | Allows the user to change their password after a password reset email.
@param $userId
@param $key
@return string | [
"Allows",
"the",
"user",
"to",
"change",
"their",
"password",
"after",
"a",
"password",
"reset",
"email",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L154-L180 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.getLoginRedirect | protected function getLoginRedirect()
{
$rtn = PHPCI_URL;
if (!empty($_SESSION['phpci_login_redirect'])) {
$rtn .= $_SESSION['phpci_login_redirect'];
$_SESSION['phpci_login_redirect'] = null;
}
return $rtn;
} | php | protected function getLoginRedirect()
{
$rtn = PHPCI_URL;
if (!empty($_SESSION['phpci_login_redirect'])) {
$rtn .= $_SESSION['phpci_login_redirect'];
$_SESSION['phpci_login_redirect'] = null;
}
return $rtn;
} | [
"protected",
"function",
"getLoginRedirect",
"(",
")",
"{",
"$",
"rtn",
"=",
"PHPCI_URL",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SESSION",
"[",
"'phpci_login_redirect'",
"]",
")",
")",
"{",
"$",
"rtn",
".=",
"$",
"_SESSION",
"[",
"'phpci_login_redirect'... | Get the URL the user was trying to go to prior to being asked to log in.
@return string | [
"Get",
"the",
"URL",
"the",
"user",
"was",
"trying",
"to",
"go",
"to",
"prior",
"to",
"being",
"asked",
"to",
"log",
"in",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L186-L196 |
dancryer/PHPCI | PHPCI/Controller/SessionController.php | SessionController.generateToken | protected function generateToken()
{
if (function_exists('openssl_random_pseudo_bytes')) {
return bin2hex(openssl_random_pseudo_bytes(16));
}
return sprintf("%04x", mt_rand(0, 0xFFFF))
. sprintf("%04x", mt_rand(0, 0xFFFF))
. sprintf("%04x", mt_rand(0, 0xF... | php | protected function generateToken()
{
if (function_exists('openssl_random_pseudo_bytes')) {
return bin2hex(openssl_random_pseudo_bytes(16));
}
return sprintf("%04x", mt_rand(0, 0xFFFF))
. sprintf("%04x", mt_rand(0, 0xFFFF))
. sprintf("%04x", mt_rand(0, 0xF... | [
"protected",
"function",
"generateToken",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'openssl_random_pseudo_bytes'",
")",
")",
"{",
"return",
"bin2hex",
"(",
"openssl_random_pseudo_bytes",
"(",
"16",
")",
")",
";",
"}",
"return",
"sprintf",
"(",
"\"%04x\... | Generate a random token.
@return string | [
"Generate",
"a",
"random",
"token",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/SessionController.php#L202-L212 |
dancryer/PHPCI | PHPCI/Plugin/Lint.php | Lint.execute | public function execute()
{
$this->phpci->quiet = true;
$success = true;
$php = $this->phpci->findBinary('php');
foreach ($this->directories as $dir) {
if (!$this->lintDirectory($php, $dir)) {
$success = false;
}
}
$this->php... | php | public function execute()
{
$this->phpci->quiet = true;
$success = true;
$php = $this->phpci->findBinary('php');
foreach ($this->directories as $dir) {
if (!$this->lintDirectory($php, $dir)) {
$success = false;
}
}
$this->php... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"this",
"->",
"phpci",
"->",
"quiet",
"=",
"true",
";",
"$",
"success",
"=",
"true",
";",
"$",
"php",
"=",
"$",
"this",
"->",
"phpci",
"->",
"findBinary",
"(",
"'php'",
")",
";",
"foreach",
"(",
... | Executes parallel lint | [
"Executes",
"parallel",
"lint"
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Lint.php#L65-L81 |
dancryer/PHPCI | PHPCI/Plugin/Lint.php | Lint.lintItem | protected function lintItem($php, $item, $itemPath)
{
$success = true;
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
$success = false;
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTOR... | php | protected function lintItem($php, $item, $itemPath)
{
$success = true;
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
$success = false;
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTOR... | [
"protected",
"function",
"lintItem",
"(",
"$",
"php",
",",
"$",
"item",
",",
"$",
"itemPath",
")",
"{",
"$",
"success",
"=",
"true",
";",
"if",
"(",
"$",
"item",
"->",
"isFile",
"(",
")",
"&&",
"$",
"item",
"->",
"getExtension",
"(",
")",
"==",
"... | Lint an item (file or directory) by calling the appropriate method.
@param $php
@param $item
@param $itemPath
@return bool | [
"Lint",
"an",
"item",
"(",
"file",
"or",
"directory",
")",
"by",
"calling",
"the",
"appropriate",
"method",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Lint.php#L90-L101 |
dancryer/PHPCI | PHPCI/Plugin/Lint.php | Lint.lintFile | protected function lintFile($php, $path)
{
$success = true;
if (!$this->phpci->executeCommand($php . ' -l "%s"', $this->phpci->buildPath . $path)) {
$this->phpci->logFailure($path);
$success = false;
}
return $success;
} | php | protected function lintFile($php, $path)
{
$success = true;
if (!$this->phpci->executeCommand($php . ' -l "%s"', $this->phpci->buildPath . $path)) {
$this->phpci->logFailure($path);
$success = false;
}
return $success;
} | [
"protected",
"function",
"lintFile",
"(",
"$",
"php",
",",
"$",
"path",
")",
"{",
"$",
"success",
"=",
"true",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"phpci",
"->",
"executeCommand",
"(",
"$",
"php",
".",
"' -l \"%s\"'",
",",
"$",
"this",
"->",
"p... | Run php -l against a specific file.
@param $php
@param $path
@return bool | [
"Run",
"php",
"-",
"l",
"against",
"a",
"specific",
"file",
"."
] | train | https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Lint.php#L139-L149 |
dusterio/lumen-passport | src/PassportServiceProvider.php | PassportServiceProvider.boot | public function boot()
{
$this->app->singleton(Connection::class, function() {
return $this->app['db.connection'];
});
if (preg_match('/5\.[678]\.\d+/', $this->app->version())) {
$this->app->singleton(\Illuminate\Hashing\HashManager::class, function ($app) {
... | php | public function boot()
{
$this->app->singleton(Connection::class, function() {
return $this->app['db.connection'];
});
if (preg_match('/5\.[678]\.\d+/', $this->app->version())) {
$this->app->singleton(\Illuminate\Hashing\HashManager::class, function ($app) {
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"Connection",
"::",
"class",
",",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"'db.connection'",
"]",
";",
"}",
")",
";",
"if",
"... | Bootstrap any application services.
@return void | [
"Bootstrap",
"any",
"application",
"services",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/PassportServiceProvider.php#L20-L37 |
dusterio/lumen-passport | src/RouteRegistrar.php | RouteRegistrar.forAccessTokens | public function forAccessTokens()
{
$this->app->post('/token', $this->prefix('\Dusterio\LumenPassport\Http\Controllers\AccessTokenController@issueToken'));
$this->app->group(['middleware' => ['auth']], function () {
$this->app->get('/tokens', $this->prefix('AuthorizedAccessTokenControll... | php | public function forAccessTokens()
{
$this->app->post('/token', $this->prefix('\Dusterio\LumenPassport\Http\Controllers\AccessTokenController@issueToken'));
$this->app->group(['middleware' => ['auth']], function () {
$this->app->get('/tokens', $this->prefix('AuthorizedAccessTokenControll... | [
"public",
"function",
"forAccessTokens",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"post",
"(",
"'/token'",
",",
"$",
"this",
"->",
"prefix",
"(",
"'\\Dusterio\\LumenPassport\\Http\\Controllers\\AccessTokenController@issueToken'",
")",
")",
";",
"$",
"this",
... | Register the routes for retrieving and issuing access tokens.
@return void | [
"Register",
"the",
"routes",
"for",
"retrieving",
"and",
"issuing",
"access",
"tokens",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/RouteRegistrar.php#L58-L66 |
dusterio/lumen-passport | src/RouteRegistrar.php | RouteRegistrar.forClients | public function forClients()
{
$this->app->group(['middleware' => ['auth']], function () {
$this->app->get('/clients', $this->prefix('ClientController@forUser'));
$this->app->post('/clients', $this->prefix('ClientController@store'));
$this->app->put('/clients/{client_id}'... | php | public function forClients()
{
$this->app->group(['middleware' => ['auth']], function () {
$this->app->get('/clients', $this->prefix('ClientController@forUser'));
$this->app->post('/clients', $this->prefix('ClientController@store'));
$this->app->put('/clients/{client_id}'... | [
"public",
"function",
"forClients",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"group",
"(",
"[",
"'middleware'",
"=>",
"[",
"'auth'",
"]",
"]",
",",
"function",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"get",
"(",
"'/clients'",
",",
"$",... | Register the routes needed for managing clients.
@return void | [
"Register",
"the",
"routes",
"needed",
"for",
"managing",
"clients",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/RouteRegistrar.php#L86-L94 |
dusterio/lumen-passport | src/RouteRegistrar.php | RouteRegistrar.forPersonalAccessTokens | public function forPersonalAccessTokens()
{
$this->app->group(['middleware' => ['auth']], function () {
$this->app->get('/scopes', $this->prefix('ScopeController@all'));
$this->app->get('/personal-access-tokens', $this->prefix('PersonalAccessTokenController@forUser'));
$t... | php | public function forPersonalAccessTokens()
{
$this->app->group(['middleware' => ['auth']], function () {
$this->app->get('/scopes', $this->prefix('ScopeController@all'));
$this->app->get('/personal-access-tokens', $this->prefix('PersonalAccessTokenController@forUser'));
$t... | [
"public",
"function",
"forPersonalAccessTokens",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"group",
"(",
"[",
"'middleware'",
"=>",
"[",
"'auth'",
"]",
"]",
",",
"function",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"get",
"(",
"'/scopes'",
... | Register the routes needed for managing personal access tokens.
@return void | [
"Register",
"the",
"routes",
"needed",
"for",
"managing",
"personal",
"access",
"tokens",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/RouteRegistrar.php#L101-L109 |
dusterio/lumen-passport | src/LumenPassport.php | LumenPassport.tokensExpireIn | public static function tokensExpireIn(DateTimeInterface $date = null, $clientId = null)
{
if (! $clientId) return Passport::tokensExpireIn($date);
if (is_null($date)) {
return isset(static::$tokensExpireAt[$clientId])
? Carbon::now()->diff(static::$tokensExpireAt[$client... | php | public static function tokensExpireIn(DateTimeInterface $date = null, $clientId = null)
{
if (! $clientId) return Passport::tokensExpireIn($date);
if (is_null($date)) {
return isset(static::$tokensExpireAt[$clientId])
? Carbon::now()->diff(static::$tokensExpireAt[$client... | [
"public",
"static",
"function",
"tokensExpireIn",
"(",
"DateTimeInterface",
"$",
"date",
"=",
"null",
",",
"$",
"clientId",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"clientId",
")",
"return",
"Passport",
"::",
"tokensExpireIn",
"(",
"$",
"date",
")",
... | Get or set when access tokens expire.
@param \DateTimeInterface|null $date
@param int $clientId
@return \DateInterval|static | [
"Get",
"or",
"set",
"when",
"access",
"tokens",
"expire",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/LumenPassport.php#L51-L64 |
dusterio/lumen-passport | src/LumenPassport.php | LumenPassport.routes | public static function routes($callback = null, array $options = [])
{
if ($callback instanceof Application && preg_match('/5\.[5-8]\..*/', $callback->version())) $callback = $callback->router;
$callback = $callback ?: function ($router) {
$router->all();
};
$defaultOpt... | php | public static function routes($callback = null, array $options = [])
{
if ($callback instanceof Application && preg_match('/5\.[5-8]\..*/', $callback->version())) $callback = $callback->router;
$callback = $callback ?: function ($router) {
$router->all();
};
$defaultOpt... | [
"public",
"static",
"function",
"routes",
"(",
"$",
"callback",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"callback",
"instanceof",
"Application",
"&&",
"preg_match",
"(",
"'/5\\.[5-8]\\..*/'",
",",
"$",
"callback"... | Get a Passport route registrar.
@param callable|Router|Application $callback
@param array $options
@return RouteRegistrar | [
"Get",
"a",
"Passport",
"route",
"registrar",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/LumenPassport.php#L73-L92 |
dusterio/lumen-passport | src/Console/Commands/Purge.php | Purge.handle | public function handle(ClientRepository $clients)
{
$count = DB::table('oauth_refresh_tokens')->where('expires_at', '<', new DateTime())->delete();
if (Passport::$refreshTokensExpireAt && Passport::$tokensExpireAt) {
$difference = Passport::$refreshTokensExpireAt->getTimestamp() - Passp... | php | public function handle(ClientRepository $clients)
{
$count = DB::table('oauth_refresh_tokens')->where('expires_at', '<', new DateTime())->delete();
if (Passport::$refreshTokensExpireAt && Passport::$tokensExpireAt) {
$difference = Passport::$refreshTokensExpireAt->getTimestamp() - Passp... | [
"public",
"function",
"handle",
"(",
"ClientRepository",
"$",
"clients",
")",
"{",
"$",
"count",
"=",
"DB",
"::",
"table",
"(",
"'oauth_refresh_tokens'",
")",
"->",
"where",
"(",
"'expires_at'",
",",
"'<'",
",",
"new",
"DateTime",
"(",
")",
")",
"->",
"d... | Execute the console command.
@param \Laravel\Passport\ClientRepository $clients
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/Console/Commands/Purge.php#L33-L47 |
dusterio/lumen-passport | src/Http/Controllers/AccessTokenController.php | AccessTokenController.issueToken | public function issueToken(ServerRequestInterface $request)
{
$response = $this->withErrorHandling(function () use ($request) {
$input = (array) $request->getParsedBody();
$clientId = isset($input['client_id']) ? $input['client_id'] : null;
// Overwrite password grant at... | php | public function issueToken(ServerRequestInterface $request)
{
$response = $this->withErrorHandling(function () use ($request) {
$input = (array) $request->getParsedBody();
$clientId = isset($input['client_id']) ? $input['client_id'] : null;
// Overwrite password grant at... | [
"public",
"function",
"issueToken",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"withErrorHandling",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"request",
")",
"{",
"$",
"input",
"=",
"(",
"array",
"... | Authorize a client to access the user's account.
@param ServerRequestInterface $request
@return Response | [
"Authorize",
"a",
"client",
"to",
"access",
"the",
"user",
"s",
"account",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/Http/Controllers/AccessTokenController.php#L23-L55 |
dusterio/lumen-passport | src/Http/Controllers/AccessTokenController.php | AccessTokenController.makePasswordGrant | private function makePasswordGrant()
{
$grant = new \League\OAuth2\Server\Grant\PasswordGrant(
app()->make(\Laravel\Passport\Bridge\UserRepository::class),
app()->make(\Laravel\Passport\Bridge\RefreshTokenRepository::class)
);
$grant->setRefreshTokenTTL(Passport::ref... | php | private function makePasswordGrant()
{
$grant = new \League\OAuth2\Server\Grant\PasswordGrant(
app()->make(\Laravel\Passport\Bridge\UserRepository::class),
app()->make(\Laravel\Passport\Bridge\RefreshTokenRepository::class)
);
$grant->setRefreshTokenTTL(Passport::ref... | [
"private",
"function",
"makePasswordGrant",
"(",
")",
"{",
"$",
"grant",
"=",
"new",
"\\",
"League",
"\\",
"OAuth2",
"\\",
"Server",
"\\",
"Grant",
"\\",
"PasswordGrant",
"(",
"app",
"(",
")",
"->",
"make",
"(",
"\\",
"Laravel",
"\\",
"Passport",
"\\",
... | Create and configure a Password grant instance.
@return \League\OAuth2\Server\Grant\PasswordGrant | [
"Create",
"and",
"configure",
"a",
"Password",
"grant",
"instance",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/Http/Controllers/AccessTokenController.php#L62-L72 |
dusterio/lumen-passport | src/Http/Controllers/AccessTokenController.php | AccessTokenController.revokeOrDeleteAccessTokens | protected function revokeOrDeleteAccessTokens(Token $token, $tokenId)
{
$query = Token::where('user_id', $token->user_id)->where('client_id', $token->client_id);
if ($tokenId) {
$query->where('id', '<>', $tokenId);
}
if (Passport::$pruneRevokedTokens) {
$que... | php | protected function revokeOrDeleteAccessTokens(Token $token, $tokenId)
{
$query = Token::where('user_id', $token->user_id)->where('client_id', $token->client_id);
if ($tokenId) {
$query->where('id', '<>', $tokenId);
}
if (Passport::$pruneRevokedTokens) {
$que... | [
"protected",
"function",
"revokeOrDeleteAccessTokens",
"(",
"Token",
"$",
"token",
",",
"$",
"tokenId",
")",
"{",
"$",
"query",
"=",
"Token",
"::",
"where",
"(",
"'user_id'",
",",
"$",
"token",
"->",
"user_id",
")",
"->",
"where",
"(",
"'client_id'",
",",
... | Revoke the user's other access tokens for the client.
@param Token $token
@param string $tokenId
@return void | [
"Revoke",
"the",
"user",
"s",
"other",
"access",
"tokens",
"for",
"the",
"client",
"."
] | train | https://github.com/dusterio/lumen-passport/blob/4a2b2ff93c00f0b16c1a08fd43424f883a748c5f/src/Http/Controllers/AccessTokenController.php#L81-L94 |
LaravelRUS/SleepingOwlAdmin | src/Console/Commands/SectionMake.php | SectionMake.replaceClass | protected function replaceClass($stub, $name)
{
$stub = parent::replaceClass($stub, $name);
return str_replace('DummyModel', '\\'.trim((string) $this->argument('model'), '\\'), $stub);
} | php | protected function replaceClass($stub, $name)
{
$stub = parent::replaceClass($stub, $name);
return str_replace('DummyModel', '\\'.trim((string) $this->argument('model'), '\\'), $stub);
} | [
"protected",
"function",
"replaceClass",
"(",
"$",
"stub",
",",
"$",
"name",
")",
"{",
"$",
"stub",
"=",
"parent",
"::",
"replaceClass",
"(",
"$",
"stub",
",",
"$",
"name",
")",
";",
"return",
"str_replace",
"(",
"'DummyModel'",
",",
"'\\\\'",
".",
"tr... | Replace the class name for the given stub.
@param string $stub
@param string $name
@return string | [
"Replace",
"the",
"class",
"name",
"for",
"the",
"given",
"stub",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Console/Commands/SectionMake.php#L70-L75 |
LaravelRUS/SleepingOwlAdmin | src/Display/Column/Filter.php | Filter.getUrl | public function getUrl()
{
$request = clone request();
$request->merge([
$this->getName() => $this->getValue(),
'page' => 1,
]);
/** @var \SleepingOwl\Admin\Contracts\AdminInterface $so */
$so = app('sleeping_owl');
return $so->get... | php | public function getUrl()
{
$request = clone request();
$request->merge([
$this->getName() => $this->getValue(),
'page' => 1,
]);
/** @var \SleepingOwl\Admin\Contracts\AdminInterface $so */
$so = app('sleeping_owl');
return $so->get... | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"$",
"request",
"=",
"clone",
"request",
"(",
")",
";",
"$",
"request",
"->",
"merge",
"(",
"[",
"$",
"this",
"->",
"getName",
"(",
")",
"=>",
"$",
"this",
"->",
"getValue",
"(",
")",
",",
"'page'",
... | Get filter url.
@return string | [
"Get",
"filter",
"url",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/Column/Filter.php#L83-L97 |
LaravelRUS/SleepingOwlAdmin | src/Traits/Assets.php | Assets.addScript | public function addScript($handle, $script, array $dependency = [])
{
if (is_null($handle)) {
$handle = $script;
}
$this->package->js($handle, $script, $dependency, true);
return $this;
} | php | public function addScript($handle, $script, array $dependency = [])
{
if (is_null($handle)) {
$handle = $script;
}
$this->package->js($handle, $script, $dependency, true);
return $this;
} | [
"public",
"function",
"addScript",
"(",
"$",
"handle",
",",
"$",
"script",
",",
"array",
"$",
"dependency",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"handle",
")",
")",
"{",
"$",
"handle",
"=",
"$",
"script",
";",
"}",
"$",
"this"... | @param string $handle
@param string $script
@param array $dependency
@return $this | [
"@param",
"string",
"$handle",
"@param",
"string",
"$script",
"@param",
"array",
"$dependency"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Traits/Assets.php#L22-L31 |
LaravelRUS/SleepingOwlAdmin | src/Traits/Assets.php | Assets.addStyle | public function addStyle($handle, $style, array $attributes = [])
{
if (is_null($handle)) {
$handle = $style;
}
$this->package->css($handle, $style, $attributes);
return $this;
} | php | public function addStyle($handle, $style, array $attributes = [])
{
if (is_null($handle)) {
$handle = $style;
}
$this->package->css($handle, $style, $attributes);
return $this;
} | [
"public",
"function",
"addStyle",
"(",
"$",
"handle",
",",
"$",
"style",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"handle",
")",
")",
"{",
"$",
"handle",
"=",
"$",
"style",
";",
"}",
"$",
"this",
... | @param string $handle
@param string $style
@param array $attributes
@return $this | [
"@param",
"string",
"$handle",
"@param",
"string",
"$style",
"@param",
"array",
"$attributes"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Traits/Assets.php#L40-L49 |
LaravelRUS/SleepingOwlAdmin | src/Traits/Assets.php | Assets.withPackage | public function withPackage($packages)
{
$packages = is_array($packages)
? $packages
: func_get_args();
$this->package->with($packages);
return $this;
} | php | public function withPackage($packages)
{
$packages = is_array($packages)
? $packages
: func_get_args();
$this->package->with($packages);
return $this;
} | [
"public",
"function",
"withPackage",
"(",
"$",
"packages",
")",
"{",
"$",
"packages",
"=",
"is_array",
"(",
"$",
"packages",
")",
"?",
"$",
"packages",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"package",
"->",
"with",
"(",
"$",
"packages... | @param string ... $package
@return $this | [
"@param",
"string",
"...",
"$package"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Traits/Assets.php#L56-L65 |
LaravelRUS/SleepingOwlAdmin | src/Form/Buttons/Delete.php | Delete.initialize | public function initialize()
{
parent::initialize();
$this->setHtmlAttributes($this->getHtmlAttributes() + [
'name' => 'next_action',
'class' => 'btn btn-danger btn-delete',
'data-url' => $this->getModelConfiguration()->getDeleteUrl($this->g... | php | public function initialize()
{
parent::initialize();
$this->setHtmlAttributes($this->getHtmlAttributes() + [
'name' => 'next_action',
'class' => 'btn btn-danger btn-delete',
'data-url' => $this->getModelConfiguration()->getDeleteUrl($this->g... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"parent",
"::",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"setHtmlAttributes",
"(",
"$",
"this",
"->",
"getHtmlAttributes",
"(",
")",
"+",
"[",
"'name'",
"=>",
"'next_action'",
",",
"'class'",
"=>",
... | Init Delete Button. | [
"Init",
"Delete",
"Button",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Buttons/Delete.php#L22-L32 |
LaravelRUS/SleepingOwlAdmin | src/Form/Buttons/Delete.php | Delete.canShow | public function canShow()
{
if (is_null($this->getModel()->getKey())) {
return false;
}
$this->show = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel());
return parent::canShow();
} | php | public function canShow()
{
if (is_null($this->getModel()->getKey())) {
return false;
}
$this->show = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel());
return parent::canShow();
} | [
"public",
"function",
"canShow",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"getKey",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"show",
"=",
"!",
"$",
"this",
"->",
"i... | Show policy.
@return bool | [
"Show",
"policy",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Buttons/Delete.php#L38-L47 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/Custom.php | Custom.save | public function save(\Illuminate\Http\Request $request)
{
$callback = $this->getCallback();
if (is_callable($callback)) {
call_user_func_array($callback, [$this->getModel(), $request]);
}
} | php | public function save(\Illuminate\Http\Request $request)
{
$callback = $this->getCallback();
if (is_callable($callback)) {
call_user_func_array($callback, [$this->getModel(), $request]);
}
} | [
"public",
"function",
"save",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
")",
"{",
"$",
"callback",
"=",
"$",
"this",
"->",
"getCallback",
"(",
")",
";",
"if",
"(",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"cal... | @param \Illuminate\Http\Request $request
@return void | [
"@param",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$request"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/Custom.php#L101-L108 |
LaravelRUS/SleepingOwlAdmin | src/Form/Buttons/Restore.php | Restore.initialize | public function initialize()
{
parent::initialize();
$this->setHtmlAttributes($this->getHtmlAttributes() + [
'type' => 'submit',
'name' => 'next_action',
'class' => 'btn btn-warning',
'data-url'=> $this->getModelConfiguration()->getRestoreUrl($this-... | php | public function initialize()
{
parent::initialize();
$this->setHtmlAttributes($this->getHtmlAttributes() + [
'type' => 'submit',
'name' => 'next_action',
'class' => 'btn btn-warning',
'data-url'=> $this->getModelConfiguration()->getRestoreUrl($this-... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"parent",
"::",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"setHtmlAttributes",
"(",
"$",
"this",
"->",
"getHtmlAttributes",
"(",
")",
"+",
"[",
"'type'",
"=>",
"'submit'",
",",
"'name'",
"=>",
"'ne... | Init Restore Button. | [
"Init",
"Restore",
"Button",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Buttons/Restore.php#L23-L34 |
LaravelRUS/SleepingOwlAdmin | src/Http/Controllers/DisplayController.php | DisplayController.async | public function async(ModelConfigurationInterface $model, Request $request, Application $application, $name = null)
{
$payload = $request->payload ?: [];
$display = $model->fireDisplay($payload);
if ($display instanceof DisplayTabbed) {
$tabs = $display->getTabs();
... | php | public function async(ModelConfigurationInterface $model, Request $request, Application $application, $name = null)
{
$payload = $request->payload ?: [];
$display = $model->fireDisplay($payload);
if ($display instanceof DisplayTabbed) {
$tabs = $display->getTabs();
... | [
"public",
"function",
"async",
"(",
"ModelConfigurationInterface",
"$",
"model",
",",
"Request",
"$",
"request",
",",
"Application",
"$",
"application",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"payload",
"=",
"$",
"request",
"->",
"payload",
"?",
":"... | @param ModelConfigurationInterface $model
@param Request $request
@param Application $application
@param null $name
@throws NotFoundHttpException
@return JsonResponse | [
"@param",
"ModelConfigurationInterface",
"$model",
"@param",
"Request",
"$request",
"@param",
"Application",
"$application",
"@param",
"null",
"$name",
"@throws",
"NotFoundHttpException"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Http/Controllers/DisplayController.php#L29-L78 |
LaravelRUS/SleepingOwlAdmin | src/Display/Filter/FilterBase.php | FilterBase.initialize | public function initialize()
{
if (is_null($value = $this->getValue())) {
$value = request()->input($this->getAlias());
}
$this->setValue($value);
} | php | public function initialize()
{
if (is_null($value = $this->getValue())) {
$value = request()->input($this->getAlias());
}
$this->setValue($value);
} | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
")",
")",
"{",
"$",
"value",
"=",
"request",
"(",
")",
"->",
"input",
"(",
"$",
"this",
"->",
"getAlias",
"(... | Initialize filter. | [
"Initialize",
"filter",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/Filter/FilterBase.php#L46-L53 |
LaravelRUS/SleepingOwlAdmin | src/Display/DisplayDatatablesAsync.php | DisplayDatatablesAsync.registerRoutes | public static function registerRoutes(Router $router)
{
$routeName = 'admin.display.async';
if (! $router->has($routeName)) {
$router->get('{adminModel}/async/{adminDisplayName?}', [
'as' => $routeName,
'uses' => 'SleepingOwl\Admin\Http\Controllers\Displ... | php | public static function registerRoutes(Router $router)
{
$routeName = 'admin.display.async';
if (! $router->has($routeName)) {
$router->get('{adminModel}/async/{adminDisplayName?}', [
'as' => $routeName,
'uses' => 'SleepingOwl\Admin\Http\Controllers\Displ... | [
"public",
"static",
"function",
"registerRoutes",
"(",
"Router",
"$",
"router",
")",
"{",
"$",
"routeName",
"=",
"'admin.display.async'",
";",
"if",
"(",
"!",
"$",
"router",
"->",
"has",
"(",
"$",
"routeName",
")",
")",
"{",
"$",
"router",
"->",
"get",
... | Register display routes.
@param Router $router
@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException | [
"Register",
"display",
"routes",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/DisplayDatatablesAsync.php#L23-L40 |
LaravelRUS/SleepingOwlAdmin | src/Display/DisplayDatatablesAsync.php | DisplayDatatablesAsync.initialize | public function initialize()
{
parent::initialize();
$attributes = Request::all();
array_unshift($attributes, $this->getName());
array_unshift($attributes, $this->getModelConfiguration()->getAlias());
$this->setHtmlAttribute('style', 'width:100%');
$this->setHtmlAtt... | php | public function initialize()
{
parent::initialize();
$attributes = Request::all();
array_unshift($attributes, $this->getName());
array_unshift($attributes, $this->getModelConfiguration()->getAlias());
$this->setHtmlAttribute('style', 'width:100%');
$this->setHtmlAtt... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"parent",
"::",
"initialize",
"(",
")",
";",
"$",
"attributes",
"=",
"Request",
"::",
"all",
"(",
")",
";",
"array_unshift",
"(",
"$",
"attributes",
",",
"$",
"this",
"->",
"getName",
"(",
")",
")",
... | Initialize display. | [
"Initialize",
"display",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/DisplayDatatablesAsync.php#L82-L101 |
LaravelRUS/SleepingOwlAdmin | src/Display/DisplayDatatablesAsync.php | DisplayDatatablesAsync.renderAsync | public function renderAsync(\Illuminate\Http\Request $request)
{
$query = $this->getRepository()->getQuery();
$totalCount = $query->count();
$filteredCount = 0;
if (! is_null($this->distinct)) {
$filteredCount = $query->distinct()->count($this->getDistinct());
}
... | php | public function renderAsync(\Illuminate\Http\Request $request)
{
$query = $this->getRepository()->getQuery();
$totalCount = $query->count();
$filteredCount = 0;
if (! is_null($this->distinct)) {
$filteredCount = $query->distinct()->count($this->getDistinct());
}
... | [
"public",
"function",
"renderAsync",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"getQuery",
"(",
")",
";",
"$",
"totalCount",
"=",
"$",
"query... | Render async request.
@param \Illuminate\Http\Request $request
@return array | [
"Render",
"async",
"request",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/DisplayDatatablesAsync.php#L188-L211 |
LaravelRUS/SleepingOwlAdmin | src/Display/DisplayDatatablesAsync.php | DisplayDatatablesAsync.applyOffset | public function applyOffset($query, \Illuminate\Http\Request $request)
{
$offset = $request->input('start', 0);
$limit = $request->input('length', 10);
if ($limit == -1) {
return;
}
$query->offset((int) $offset)->limit((int) $limit);
} | php | public function applyOffset($query, \Illuminate\Http\Request $request)
{
$offset = $request->input('start', 0);
$limit = $request->input('length', 10);
if ($limit == -1) {
return;
}
$query->offset((int) $offset)->limit((int) $limit);
} | [
"public",
"function",
"applyOffset",
"(",
"$",
"query",
",",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
")",
"{",
"$",
"offset",
"=",
"$",
"request",
"->",
"input",
"(",
"'start'",
",",
"0",
")",
";",
"$",
"limit",
"=",
"$",
... | Apply offset and limit to the query.
@param $query
@param \Illuminate\Http\Request $request | [
"Apply",
"offset",
"and",
"limit",
"to",
"the",
"query",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/DisplayDatatablesAsync.php#L219-L229 |
LaravelRUS/SleepingOwlAdmin | src/Display/DisplayDatatablesAsync.php | DisplayDatatablesAsync.applySearch | public function applySearch(Builder $query, \Illuminate\Http\Request $request)
{
$search = $request->input('search.value');
if (empty($search)) {
return;
}
$query->where(function (Builder $query) use ($search) {
$columns = $this->getColumns()->all();
... | php | public function applySearch(Builder $query, \Illuminate\Http\Request $request)
{
$search = $request->input('search.value');
if (empty($search)) {
return;
}
$query->where(function (Builder $query) use ($search) {
$columns = $this->getColumns()->all();
... | [
"public",
"function",
"applySearch",
"(",
"Builder",
"$",
"query",
",",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
")",
"{",
"$",
"search",
"=",
"$",
"request",
"->",
"input",
"(",
"'search.value'",
")",
";",
"if",
"(",
"empty",
... | Apply search to the query.
@param Builder $query
@param \Illuminate\Http\Request $request | [
"Apply",
"search",
"to",
"the",
"query",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/DisplayDatatablesAsync.php#L237-L267 |
LaravelRUS/SleepingOwlAdmin | src/Display/DisplayDatatablesAsync.php | DisplayDatatablesAsync.prepareDatatablesStructure | protected function prepareDatatablesStructure(
\Illuminate\Http\Request $request,
Collection $collection,
$totalCount,
$filteredCount
) {
$columns = $this->getColumns();
$result = [];
$result['draw'] = $request->input('draw', 0);
$result['recordsTotal... | php | protected function prepareDatatablesStructure(
\Illuminate\Http\Request $request,
Collection $collection,
$totalCount,
$filteredCount
) {
$columns = $this->getColumns();
$result = [];
$result['draw'] = $request->input('draw', 0);
$result['recordsTotal... | [
"protected",
"function",
"prepareDatatablesStructure",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
",",
"Collection",
"$",
"collection",
",",
"$",
"totalCount",
",",
"$",
"filteredCount",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
... | Convert collection to the datatables structure.
@param \Illuminate\Http\Request $request
@param array|Collection $collection
@param int $totalCount
@param int $filteredCount
@return array | [
"Convert",
"collection",
"to",
"the",
"datatables",
"structure",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/DisplayDatatablesAsync.php#L279-L310 |
LaravelRUS/SleepingOwlAdmin | src/Display/Column/Custom.php | Custom.getModelValue | public function getModelValue()
{
if (! is_callable($callback = $this->getCallback())) {
throw new \Exception('Invalid custom column callback');
}
return call_user_func($callback, $this->getModel());
} | php | public function getModelValue()
{
if (! is_callable($callback = $this->getCallback())) {
throw new \Exception('Invalid custom column callback');
}
return call_user_func($callback, $this->getModel());
} | [
"public",
"function",
"getModelValue",
"(",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
"=",
"$",
"this",
"->",
"getCallback",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Invalid custom column callback'",
")",
";",... | Get value from callback.
@return mixed
@throws \Exception | [
"Get",
"value",
"from",
"callback",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/Column/Custom.php#L69-L76 |
LaravelRUS/SleepingOwlAdmin | src/Http/Controllers/FormElementController.php | FormElementController.dependentSelect | public function dependentSelect(Request $request, ModelConfigurationInterface $model, $field, $id = null)
{
$form = $this->getModelLogic($model, $id);
if ($form instanceof JsonResponse) {
return $form;
}
/** @var DependentSelect $element */
$element = $form->get... | php | public function dependentSelect(Request $request, ModelConfigurationInterface $model, $field, $id = null)
{
$form = $this->getModelLogic($model, $id);
if ($form instanceof JsonResponse) {
return $form;
}
/** @var DependentSelect $element */
$element = $form->get... | [
"public",
"function",
"dependentSelect",
"(",
"Request",
"$",
"request",
",",
"ModelConfigurationInterface",
"$",
"model",
",",
"$",
"field",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"getModelLogic",
"(",
"$",
"model",
... | @param Request $request
@param ModelConfigurationInterface $model
@param string $field
@param int|null $id
@return JsonResponse | [
"@param",
"Request",
"$request",
"@param",
"ModelConfigurationInterface",
"$model",
"@param",
"string",
"$field",
"@param",
"int|null",
"$id"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Http/Controllers/FormElementController.php#L49-L82 |
LaravelRUS/SleepingOwlAdmin | src/Http/Controllers/FormElementController.php | FormElementController.multiselectSearch | public function multiselectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null)
{
return $this->selectSearch($request, $model, $field, $id);
} | php | public function multiselectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null)
{
return $this->selectSearch($request, $model, $field, $id);
} | [
"public",
"function",
"multiselectSearch",
"(",
"Request",
"$",
"request",
",",
"ModelConfigurationInterface",
"$",
"model",
",",
"$",
"field",
",",
"$",
"id",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"selectSearch",
"(",
"$",
"request",
",",
"$... | @param Request $request
@param ModelConfigurationInterface $model
@param string $field
@param int|null $id
@return JsonResponse | [
"@param",
"Request",
"$request",
"@param",
"ModelConfigurationInterface",
"$model",
"@param",
"string",
"$field",
"@param",
"int|null",
"$id"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Http/Controllers/FormElementController.php#L92-L95 |
LaravelRUS/SleepingOwlAdmin | src/Http/Controllers/FormElementController.php | FormElementController.selectSearch | public function selectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null)
{
$form = $this->getModelLogic($model, $id);
if ($form instanceof JsonResponse) {
return $form;
}
/** @var DependentSelect $element */
$element = $form->getEle... | php | public function selectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null)
{
$form = $this->getModelLogic($model, $id);
if ($form instanceof JsonResponse) {
return $form;
}
/** @var DependentSelect $element */
$element = $form->getEle... | [
"public",
"function",
"selectSearch",
"(",
"Request",
"$",
"request",
",",
"ModelConfigurationInterface",
"$",
"model",
",",
"$",
"field",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"getModelLogic",
"(",
"$",
"model",
","... | @param Request $request
@param ModelConfigurationInterface $model
@param string $field
@param int|null $id
@return JsonResponse | [
"@param",
"Request",
"$request",
"@param",
"ModelConfigurationInterface",
"$model",
"@param",
"string",
"$field",
"@param",
"int|null",
"$id"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Http/Controllers/FormElementController.php#L105-L138 |
LaravelRUS/SleepingOwlAdmin | src/Display/ControlLink.php | ControlLink.getText | public function getText($model = null)
{
$text = (is_callable($this->text) && is_object($model)) ? call_user_func($this->text, $model) : $this->text;
$title = null;
if (is_callable($this->title) && is_object($model)) {
$title = call_user_func($this->title, $model);
} els... | php | public function getText($model = null)
{
$text = (is_callable($this->text) && is_object($model)) ? call_user_func($this->text, $model) : $this->text;
$title = null;
if (is_callable($this->title) && is_object($model)) {
$title = call_user_func($this->title, $model);
} els... | [
"public",
"function",
"getText",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"text",
"=",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"text",
")",
"&&",
"is_object",
"(",
"$",
"model",
")",
")",
"?",
"call_user_func",
"(",
"$",
"this",
"->",
"te... | @param Model|null $model
@return mixed | [
"@param",
"Model|null",
"$model"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/ControlLink.php#L204-L229 |
LaravelRUS/SleepingOwlAdmin | src/Display/ControlLink.php | ControlLink.toArray | public function toArray()
{
return [
'text' => $this->getText($this->getModel()),
'attributes' => $this->getConditionAttributes($this->model)->htmlAttributesToString(),
'url' => $this->getUrl($this->getModel()),
'position' => $this->getPosition(),
... | php | public function toArray()
{
return [
'text' => $this->getText($this->getModel()),
'attributes' => $this->getConditionAttributes($this->model)->htmlAttributesToString(),
'url' => $this->getUrl($this->getModel()),
'position' => $this->getPosition(),
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"[",
"'text'",
"=>",
"$",
"this",
"->",
"getText",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
")",
",",
"'attributes'",
"=>",
"$",
"this",
"->",
"getConditionAttributes",
"(",
"$",
"this",
"-... | Get the instance as an array.
@return array | [
"Get",
"the",
"instance",
"as",
"an",
"array",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/ControlLink.php#L320-L330 |
LaravelRUS/SleepingOwlAdmin | src/Display/Extension/Apply.php | Apply.set | public function set($applies)
{
if (! is_array($applies)) {
$applies = func_get_args();
}
foreach ($applies as $apply) {
$this->push($apply);
}
return $this->getDisplay();
} | php | public function set($applies)
{
if (! is_array($applies)) {
$applies = func_get_args();
}
foreach ($applies as $apply) {
$this->push($apply);
}
return $this->getDisplay();
} | [
"public",
"function",
"set",
"(",
"$",
"applies",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"applies",
")",
")",
"{",
"$",
"applies",
"=",
"func_get_args",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"applies",
"as",
"$",
"apply",
")",
"{",
"$... | @param Closure $applies
@return \SleepingOwl\Admin\Contracts\Display\DisplayInterface | [
"@param",
"Closure",
"$applies"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/Extension/Apply.php#L27-L38 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/File.php | File.getUploadPath | public function getUploadPath(UploadedFile $file)
{
if (! is_callable($this->uploadPath)) {
return $this->defaultUploadPath($file);
}
return call_user_func($this->uploadPath, $file);
} | php | public function getUploadPath(UploadedFile $file)
{
if (! is_callable($this->uploadPath)) {
return $this->defaultUploadPath($file);
}
return call_user_func($this->uploadPath, $file);
} | [
"public",
"function",
"getUploadPath",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"this",
"->",
"uploadPath",
")",
")",
"{",
"return",
"$",
"this",
"->",
"defaultUploadPath",
"(",
"$",
"file",
")",
";",
"}",
"r... | @param UploadedFile $file
@return mixed | [
"@param",
"UploadedFile",
"$file"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/File.php#L128-L135 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/File.php | File.getUploadFileName | public function getUploadFileName(UploadedFile $file)
{
if (! is_callable($this->uploadFileName)) {
return $this->defaultUploadFilename($file);
}
return call_user_func($this->uploadFileName, $file);
} | php | public function getUploadFileName(UploadedFile $file)
{
if (! is_callable($this->uploadFileName)) {
return $this->defaultUploadFilename($file);
}
return call_user_func($this->uploadFileName, $file);
} | [
"public",
"function",
"getUploadFileName",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"this",
"->",
"uploadFileName",
")",
")",
"{",
"return",
"$",
"this",
"->",
"defaultUploadFilename",
"(",
"$",
"file",
")",
";",... | @param UploadedFile $file
@return string | [
"@param",
"UploadedFile",
"$file"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/File.php#L154-L161 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/File.php | File.addValidationRule | public function addValidationRule($rule, $message = null)
{
$uploadRules = ['file', 'image', 'mime', 'size', 'dimensions', 'max', 'min', 'between'];
foreach ($uploadRules as $uploadRule) {
if (strpos($rule, $uploadRule) !== false) {
$this->uploadValidationRules[] = $rule... | php | public function addValidationRule($rule, $message = null)
{
$uploadRules = ['file', 'image', 'mime', 'size', 'dimensions', 'max', 'min', 'between'];
foreach ($uploadRules as $uploadRule) {
if (strpos($rule, $uploadRule) !== false) {
$this->uploadValidationRules[] = $rule... | [
"public",
"function",
"addValidationRule",
"(",
"$",
"rule",
",",
"$",
"message",
"=",
"null",
")",
"{",
"$",
"uploadRules",
"=",
"[",
"'file'",
",",
"'image'",
",",
"'mime'",
",",
"'size'",
",",
"'dimensions'",
",",
"'max'",
",",
"'min'",
",",
"'between... | @param string $rule
@param string|null $message
@return $this | [
"@param",
"string",
"$rule",
"@param",
"string|null",
"$message"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/File.php#L205-L222 |
LaravelRUS/SleepingOwlAdmin | src/Console/Commands/SectionGenerate.php | SectionGenerate.fire | public function fire(AdminInterface $admin)
{
foreach ($admin->getMissedSections() as $model => $section) {
$this->callSilent('sleepingowl:section:make', ['name' => $section, 'model' => $model]);
}
$this->info('Sections generated successfully!');
} | php | public function fire(AdminInterface $admin)
{
foreach ($admin->getMissedSections() as $model => $section) {
$this->callSilent('sleepingowl:section:make', ['name' => $section, 'model' => $model]);
}
$this->info('Sections generated successfully!');
} | [
"public",
"function",
"fire",
"(",
"AdminInterface",
"$",
"admin",
")",
"{",
"foreach",
"(",
"$",
"admin",
"->",
"getMissedSections",
"(",
")",
"as",
"$",
"model",
"=>",
"$",
"section",
")",
"{",
"$",
"this",
"->",
"callSilent",
"(",
"'sleepingowl:section:... | Execute the console command.
@param AdminInterface $admin
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Console/Commands/SectionGenerate.php#L31-L38 |
LaravelRUS/SleepingOwlAdmin | src/Display/Column/RelatedLink.php | RelatedLink.setModel | public function setModel(Model $model)
{
if (strpos($this->originalName, '.') !== false) {
$parts = explode('.', $this->originalName);
$name = array_pop($parts);
while ($parts) {
$part = array_shift($parts);
$relation = $model->getAttribut... | php | public function setModel(Model $model)
{
if (strpos($this->originalName, '.') !== false) {
$parts = explode('.', $this->originalName);
$name = array_pop($parts);
while ($parts) {
$part = array_shift($parts);
$relation = $model->getAttribut... | [
"public",
"function",
"setModel",
"(",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->",
"originalName",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"origi... | @param Model $model
@return Link | [
"@param",
"Model",
"$model"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/Column/RelatedLink.php#L39-L57 |
LaravelRUS/SleepingOwlAdmin | src/Traits/SqlQueryOperators.php | SqlQueryOperators.setOperator | public function setOperator($operator)
{
if (! array_key_exists($operator, $this->sqlOperators)) {
throw new FilterOperatorException("Operator [$operator] not found");
}
$this->operator = $operator;
return $this;
} | php | public function setOperator($operator)
{
if (! array_key_exists($operator, $this->sqlOperators)) {
throw new FilterOperatorException("Operator [$operator] not found");
}
$this->operator = $operator;
return $this;
} | [
"public",
"function",
"setOperator",
"(",
"$",
"operator",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"operator",
",",
"$",
"this",
"->",
"sqlOperators",
")",
")",
"{",
"throw",
"new",
"FilterOperatorException",
"(",
"\"Operator [$operator] not foun... | @param string $operator
@return $this
@throws FilterOperatorException | [
"@param",
"string",
"$operator"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Traits/SqlQueryOperators.php#L55-L64 |
LaravelRUS/SleepingOwlAdmin | src/Traits/SqlQueryOperators.php | SqlQueryOperators.prepareValue | protected function prepareValue($value)
{
$params = $this->getOperatorParams();
$method = $params['method'];
switch ($method) {
case 'where':
case 'whereNull':
case 'whereNotNull':
break;
case 'whereBetween':
case 'w... | php | protected function prepareValue($value)
{
$params = $this->getOperatorParams();
$method = $params['method'];
switch ($method) {
case 'where':
case 'whereNull':
case 'whereNotNull':
break;
case 'whereBetween':
case 'w... | [
"protected",
"function",
"prepareValue",
"(",
"$",
"value",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getOperatorParams",
"(",
")",
";",
"$",
"method",
"=",
"$",
"params",
"[",
"'method'",
"]",
";",
"switch",
"(",
"$",
"method",
")",
"{",
"ca... | @param string|array $value
@return string|array | [
"@param",
"string|array",
"$value"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Traits/SqlQueryOperators.php#L111-L135 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/Wysiwyg.php | Wysiwyg.setModelAttribute | public function setModelAttribute($value)
{
if (! empty($this->filteredFieldKey)) {
parent::setModelAttribute($value);
$this->setModelAttributeKey($this->filteredFieldKey);
parent::setModelAttribute(
$this->filterValue($value)
);
} els... | php | public function setModelAttribute($value)
{
if (! empty($this->filteredFieldKey)) {
parent::setModelAttribute($value);
$this->setModelAttributeKey($this->filteredFieldKey);
parent::setModelAttribute(
$this->filterValue($value)
);
} els... | [
"public",
"function",
"setModelAttribute",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"filteredFieldKey",
")",
")",
"{",
"parent",
"::",
"setModelAttribute",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"setModelAttr... | @param mixed $value
@return void | [
"@param",
"mixed",
"$value"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/Wysiwyg.php#L185-L199 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/Wysiwyg.php | Wysiwyg.filterValue | protected function filterValue($value)
{
if ($this->canFilterValue()) {
return app('sleeping_owl.wysiwyg')->applyFilter($this->getEditor(), $value);
}
return $value;
} | php | protected function filterValue($value)
{
if ($this->canFilterValue()) {
return app('sleeping_owl.wysiwyg')->applyFilter($this->getEditor(), $value);
}
return $value;
} | [
"protected",
"function",
"filterValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canFilterValue",
"(",
")",
")",
"{",
"return",
"app",
"(",
"'sleeping_owl.wysiwyg'",
")",
"->",
"applyFilter",
"(",
"$",
"this",
"->",
"getEditor",
"(",
"... | @param string $value
@return string | [
"@param",
"string",
"$value"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/Wysiwyg.php#L206-L213 |
LaravelRUS/SleepingOwlAdmin | src/Display/TableColumn.php | TableColumn.setWidth | public function setWidth($width)
{
if (is_int($width)) {
$width = $width.'px';
}
$this->width = $width;
return $this;
} | php | public function setWidth($width)
{
if (is_int($width)) {
$width = $width.'px';
}
$this->width = $width;
return $this;
} | [
"public",
"function",
"setWidth",
"(",
"$",
"width",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"width",
")",
")",
"{",
"$",
"width",
"=",
"$",
"width",
".",
"'px'",
";",
"}",
"$",
"this",
"->",
"width",
"=",
"$",
"width",
";",
"return",
"$",
"th... | @param int|string $width
@return $this | [
"@param",
"int|string",
"$width"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/TableColumn.php#L206-L215 |
LaravelRUS/SleepingOwlAdmin | src/Display/TableColumn.php | TableColumn.setModel | public function setModel(Model $model)
{
$this->model = $model;
$append = $this->getAppends();
if ($append instanceof WithModelInterface) {
$append->setModel($model);
}
return $this;
} | php | public function setModel(Model $model)
{
$this->model = $model;
$append = $this->getAppends();
if ($append instanceof WithModelInterface) {
$append->setModel($model);
}
return $this;
} | [
"public",
"function",
"setModel",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"$",
"append",
"=",
"$",
"this",
"->",
"getAppends",
"(",
")",
";",
"if",
"(",
"$",
"append",
"instanceof",
"WithModelInterface"... | @param Model $model
@return $this | [
"@param",
"Model",
"$model"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/TableColumn.php#L273-L283 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/DateTime.php | DateTime.setModelAttribute | public function setModelAttribute($value)
{
$value = ! empty($value)
? Carbon::createFromFormat($this->getPickerFormat(), $value, $this->getTimezone())
->timezone(config('app.timezone'))->format($this->getFormat())
: null;
parent::setModelAttribute($value... | php | public function setModelAttribute($value)
{
$value = ! empty($value)
? Carbon::createFromFormat($this->getPickerFormat(), $value, $this->getTimezone())
->timezone(config('app.timezone'))->format($this->getFormat())
: null;
parent::setModelAttribute($value... | [
"public",
"function",
"setModelAttribute",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"!",
"empty",
"(",
"$",
"value",
")",
"?",
"Carbon",
"::",
"createFromFormat",
"(",
"$",
"this",
"->",
"getPickerFormat",
"(",
")",
",",
"$",
"value",
",",
"$",
... | @param mixed $value
@return void | [
"@param",
"mixed",
"$value"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/DateTime.php#L112-L120 |
LaravelRUS/SleepingOwlAdmin | src/Form/Element/DateTime.php | DateTime.setCurrentDate | public function setCurrentDate()
{
$this->defaultValue = Carbon::now()->timezone($this->getTimezone())->format($this->getFormat());
return $this;
} | php | public function setCurrentDate()
{
$this->defaultValue = Carbon::now()->timezone($this->getTimezone())->format($this->getFormat());
return $this;
} | [
"public",
"function",
"setCurrentDate",
"(",
")",
"{",
"$",
"this",
"->",
"defaultValue",
"=",
"Carbon",
"::",
"now",
"(",
")",
"->",
"timezone",
"(",
"$",
"this",
"->",
"getTimezone",
"(",
")",
")",
"->",
"format",
"(",
"$",
"this",
"->",
"getFormat",... | @return $this
SMELLS This function does more than it says. | [
"@return",
"$this"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Element/DateTime.php#L156-L161 |
LaravelRUS/SleepingOwlAdmin | src/Display/Tree/OrderTreeType.php | OrderTreeType.getTree | public function getTree(\Illuminate\Database\Eloquent\Collection $collection)
{
$collection = $collection->sortBy($this->repository->getOrderField());
return $collection;
} | php | public function getTree(\Illuminate\Database\Eloquent\Collection $collection)
{
$collection = $collection->sortBy($this->repository->getOrderField());
return $collection;
} | [
"public",
"function",
"getTree",
"(",
"\\",
"Illuminate",
"\\",
"Database",
"\\",
"Eloquent",
"\\",
"Collection",
"$",
"collection",
")",
"{",
"$",
"collection",
"=",
"$",
"collection",
"->",
"sortBy",
"(",
"$",
"this",
"->",
"repository",
"->",
"getOrderFie... | Get tree structure.
@param \Illuminate\Database\Eloquent\Collection $collection
@return mixed | [
"Get",
"tree",
"structure",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Display/Tree/OrderTreeType.php#L38-L43 |
LaravelRUS/SleepingOwlAdmin | src/Form/Columns/Columns.php | Columns.addElement | public function addElement($element, $width = null)
{
if (is_callable($element)) {
$element = new Column($element());
} elseif (is_array($element)) {
$element = new Column($element);
}
if (! ($element instanceof ColumnInterface)) {
throw new \Exce... | php | public function addElement($element, $width = null)
{
if (is_callable($element)) {
$element = new Column($element());
} elseif (is_array($element)) {
$element = new Column($element);
}
if (! ($element instanceof ColumnInterface)) {
throw new \Exce... | [
"public",
"function",
"addElement",
"(",
"$",
"element",
",",
"$",
"width",
"=",
"null",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"element",
")",
")",
"{",
"$",
"element",
"=",
"new",
"Column",
"(",
"$",
"element",
"(",
")",
")",
";",
"}",
"... | @param \SleepingOwl\Admin\Contracts\Form\FormElementInterface[]|\Closure|ColumnInterface $element
@param int|null $width
@return $this
@throws \Exception | [
"@param",
"\\",
"SleepingOwl",
"\\",
"Admin",
"\\",
"Contracts",
"\\",
"Form",
"\\",
"FormElementInterface",
"[]",
"|",
"\\",
"Closure|ColumnInterface",
"$element",
"@param",
"int|null",
"$width"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Columns/Columns.php#L65-L82 |
LaravelRUS/SleepingOwlAdmin | src/Form/Columns/Columns.php | Columns.setSize | public function setSize($size)
{
$this->getColumns()->each(function (ColumnInterface $column) use ($size) {
$column->setSize($size);
});
} | php | public function setSize($size)
{
$this->getColumns()->each(function (ColumnInterface $column) use ($size) {
$column->setSize($size);
});
} | [
"public",
"function",
"setSize",
"(",
"$",
"size",
")",
"{",
"$",
"this",
"->",
"getColumns",
"(",
")",
"->",
"each",
"(",
"function",
"(",
"ColumnInterface",
"$",
"column",
")",
"use",
"(",
"$",
"size",
")",
"{",
"$",
"column",
"->",
"setSize",
"(",... | @param string $size
@return $this | [
"@param",
"string",
"$size"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/Columns/Columns.php#L135-L140 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.initialize | public function initialize()
{
if ($this->initialized) {
return;
}
$this->initialized = true;
$this->repository = app(RepositoryInterface::class);
$this->repository->setClass($this->class);
$model = $this->makeModel();
parent::setModel($model);
... | php | public function initialize()
{
if ($this->initialized) {
return;
}
$this->initialized = true;
$this->repository = app(RepositoryInterface::class);
$this->repository->setClass($this->class);
$model = $this->makeModel();
parent::setModel($model);
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"initialized",
"=",
"true",
";",
"$",
"this",
"->",
"repository",
"=",
"app",
"(",
"RepositoryInterface",
"... | Initialize form. | [
"Initialize",
"form",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L87-L119 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.setId | public function setId($id)
{
if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) {
$this->id = $id;
parent::setModel($model);
$this->getButtons()->setModel($model);
$this->setModelClass(get_class($model));
}
} | php | public function setId($id)
{
if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) {
$this->id = $id;
parent::setModel($model);
$this->getButtons()->setModel($model);
$this->setModelClass(get_class($model));
}
} | [
"public",
"function",
"setId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"id",
")",
"&&",
"!",
"is_null",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"model",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"find... | Set currently loaded model id.
@param int $id | [
"Set",
"currently",
"loaded",
"model",
"id",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L252-L261 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.getModelConfiguration | public function getModelConfiguration()
{
$class = $this->class;
if (is_null($class) && $this->getModel() instanceof Model) {
$class = $this->getModel();
}
return app('sleeping_owl')->getModel($class);
} | php | public function getModelConfiguration()
{
$class = $this->class;
if (is_null($class) && $this->getModel() instanceof Model) {
$class = $this->getModel();
}
return app('sleeping_owl')->getModel($class);
} | [
"public",
"function",
"getModelConfiguration",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"class",
";",
"if",
"(",
"is_null",
"(",
"$",
"class",
")",
"&&",
"$",
"this",
"->",
"getModel",
"(",
")",
"instanceof",
"Model",
")",
"{",
"$",
"clas... | Get related form model configuration.
@return ModelConfigurationInterface | [
"Get",
"related",
"form",
"model",
"configuration",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L267-L276 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.saveForm | public function saveForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null)
{
if (! $this->validModelConfiguration($modelConfiguration)) {
return false;
}
$model = $this->getModel();
$loaded = $model->exists;
if ($this->ge... | php | public function saveForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null)
{
if (! $this->validModelConfiguration($modelConfiguration)) {
return false;
}
$model = $this->getModel();
$loaded = $model->exists;
if ($this->ge... | [
"public",
"function",
"saveForm",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
",",
"ModelConfigurationInterface",
"$",
"modelConfiguration",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validModelConfiguration",
"(",
"... | Save instance.
@param \Illuminate\Http\Request $request
@param ModelConfigurationInterface $modelConfiguration
@return bool | [
"Save",
"instance",
"."
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L313-L343 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.saveBelongsToRelations | protected function saveBelongsToRelations(Model $model)
{
foreach ($model->getRelations() as $name => $relation) {
if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) {
$relation->save();
$model->{$name}()->associate($relation);
}
... | php | protected function saveBelongsToRelations(Model $model)
{
foreach ($model->getRelations() as $name => $relation) {
if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) {
$relation->save();
$model->{$name}()->associate($relation);
}
... | [
"protected",
"function",
"saveBelongsToRelations",
"(",
"Model",
"$",
"model",
")",
"{",
"foreach",
"(",
"$",
"model",
"->",
"getRelations",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"relation",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"{",
"$",
"name",
... | @param Model $model
@return void | [
"@param",
"Model",
"$model"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L350-L358 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.saveHasOneRelations | protected function saveHasOneRelations(Model $model)
{
foreach ($model->getRelations() as $name => $relation) {
if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) {
if (is_array($relation) || $relation instanceof \Traversable) {
$model->{$n... | php | protected function saveHasOneRelations(Model $model)
{
foreach ($model->getRelations() as $name => $relation) {
if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) {
if (is_array($relation) || $relation instanceof \Traversable) {
$model->{$n... | [
"protected",
"function",
"saveHasOneRelations",
"(",
"Model",
"$",
"model",
")",
"{",
"foreach",
"(",
"$",
"model",
"->",
"getRelations",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"relation",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"{",
"$",
"name",
"... | @param Model $model
@return void | [
"@param",
"Model",
"$model"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L365-L376 |
LaravelRUS/SleepingOwlAdmin | src/Form/FormDefault.php | FormDefault.validateForm | public function validateForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null)
{
if (! $this->validModelConfiguration($modelConfiguration)) {
return;
}
$verifier = app('validation.presence');
$verifier->setConnection($this->getMo... | php | public function validateForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null)
{
if (! $this->validModelConfiguration($modelConfiguration)) {
return;
}
$verifier = app('validation.presence');
$verifier->setConnection($this->getMo... | [
"public",
"function",
"validateForm",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
",",
"ModelConfigurationInterface",
"$",
"modelConfiguration",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validModelConfiguration",
"(",... | @param \Illuminate\Http\Request $request
@param ModelConfigurationInterface $modelConfiguration
@throws ValidationException | [
"@param",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$request",
"@param",
"ModelConfigurationInterface",
"$modelConfiguration"
] | train | https://github.com/LaravelRUS/SleepingOwlAdmin/blob/b91cde14fcf523cd3bdd71051212c162e2c9b7ea/src/Form/FormDefault.php#L384-L408 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.