id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
221,000 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/Support.php | Support.checkUserGroup | public function checkUserGroup( \Illuminate\Foundation\Auth\User $user, $groupcodes )
{
$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
if( isset( $this->cache[$user->id][$groups] ) ) {
return $this->cache[$user->id][$groups];
}
$this->cache[$user->id][$groups] = false;
... | php | public function checkUserGroup( \Illuminate\Foundation\Auth\User $user, $groupcodes )
{
$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
if( isset( $this->cache[$user->id][$groups] ) ) {
return $this->cache[$user->id][$groups];
}
$this->cache[$user->id][$groups] = false;
... | [
"public",
"function",
"checkUserGroup",
"(",
"\\",
"Illuminate",
"\\",
"Foundation",
"\\",
"Auth",
"\\",
"User",
"$",
"user",
",",
"$",
"groupcodes",
")",
"{",
"$",
"groups",
"=",
"(",
"is_array",
"(",
"$",
"groupcodes",
")",
"?",
"implode",
"(",
"','",
... | Checks if the user is in the specified group and associatied to the site
@param \Illuminate\Foundation\Auth\User $user Authenticated user
@param string|array $groupcodes Unique user/customer group codes that are allowed
@return boolean True if user is part of the group, false if not | [
"Checks",
"if",
"the",
"user",
"is",
"in",
"the",
"specified",
"group",
"and",
"associatied",
"to",
"the",
"site"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/Support.php#L61-L88 |
221,001 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/Support.php | Support.checkGroup | public function checkGroup( $userid, $groupcodes )
{
$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
if( isset( $this->cache[$userid][$groups] ) ) {
return $this->cache[$userid][$groups];
}
$site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ... | php | public function checkGroup( $userid, $groupcodes )
{
$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
if( isset( $this->cache[$userid][$groups] ) ) {
return $this->cache[$userid][$groups];
}
$site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ... | [
"public",
"function",
"checkGroup",
"(",
"$",
"userid",
",",
"$",
"groupcodes",
")",
"{",
"$",
"groups",
"=",
"(",
"is_array",
"(",
"$",
"groupcodes",
")",
"?",
"implode",
"(",
"','",
",",
"$",
"groupcodes",
")",
":",
"$",
"groupcodes",
")",
";",
"if... | Checks if the user with the given ID is in the specified group
@param string $userid Unique user ID
@param string|array $groupcodes Unique user/customer group codes that are allowed
@return boolean True if user is part of the group, false if not
@deprecated Use checkUserGroup() instead | [
"Checks",
"if",
"the",
"user",
"with",
"the",
"given",
"ID",
"is",
"in",
"the",
"specified",
"group"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/Support.php#L99-L113 |
221,002 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/Support.php | Support.getGroups | public function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
$list = array();
$manager = \Aimeos\MShop::create( $context, 'customer/group' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
foreach( $manager->... | php | public function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
$list = array();
$manager = \Aimeos\MShop::create( $context, 'customer/group' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
foreach( $manager->... | [
"public",
"function",
"getGroups",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create... | Returns the available group codes
@param \Aimeos\MShop\Context\Item\Iface $context Context item
@return string[] List of group codes | [
"Returns",
"the",
"available",
"group",
"codes"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/Support.php#L122-L135 |
221,003 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/Support.php | Support.checkGroups | protected function checkGroups( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupcodes )
{
$manager = \Aimeos\MShop::create( $context, 'customer/group' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'customer.group.code', (array) $groupcodes ) );
$groupItems = ... | php | protected function checkGroups( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupcodes )
{
$manager = \Aimeos\MShop::create( $context, 'customer/group' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'customer.group.code', (array) $groupcodes ) );
$groupItems = ... | [
"protected",
"function",
"checkGroups",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"$",
"userid",
",",
"$",
"groupcodes",
")",
"{",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"c... | Checks if one of the groups is associated to the given user ID
@param \Aimeos\MShop\Context\Item\Iface $context Context item
@param string $userid ID of the logged in user
@param string[] $groupcodes List of group codes to check against
@return boolean True if the user is in one of the groups, false if not | [
"Checks",
"if",
"one",
"of",
"the",
"groups",
"is",
"associated",
"to",
"the",
"given",
"user",
"ID"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/Support.php#L146-L167 |
221,004 | deployphp/deployer | src/Deployer.php | Deployer.init | public function init()
{
$this->addConsoleCommands();
$this->getConsole()->add(new WorkerCommand($this));
$this->getConsole()->add($this['init_command']);
$this->getConsole()->add(new SshCommand($this));
$this->getConsole()->add(new RunCommand($this));
$this->getConso... | php | public function init()
{
$this->addConsoleCommands();
$this->getConsole()->add(new WorkerCommand($this));
$this->getConsole()->add($this['init_command']);
$this->getConsole()->add(new SshCommand($this));
$this->getConsole()->add(new RunCommand($this));
$this->getConso... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"addConsoleCommands",
"(",
")",
";",
"$",
"this",
"->",
"getConsole",
"(",
")",
"->",
"add",
"(",
"new",
"WorkerCommand",
"(",
"$",
"this",
")",
")",
";",
"$",
"this",
"->",
"getConsole"... | Init console application | [
"Init",
"console",
"application"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Deployer.php#L221-L231 |
221,005 | deployphp/deployer | src/Deployer.php | Deployer.addConsoleCommands | public function addConsoleCommands()
{
$this->getConsole()->addUserArgumentsAndOptions();
foreach ($this->tasks as $name => $task) {
if ($task->isPrivate()) {
continue;
}
$this->getConsole()->add(new TaskCommand($name, $task->getDescription(), $t... | php | public function addConsoleCommands()
{
$this->getConsole()->addUserArgumentsAndOptions();
foreach ($this->tasks as $name => $task) {
if ($task->isPrivate()) {
continue;
}
$this->getConsole()->add(new TaskCommand($name, $task->getDescription(), $t... | [
"public",
"function",
"addConsoleCommands",
"(",
")",
"{",
"$",
"this",
"->",
"getConsole",
"(",
")",
"->",
"addUserArgumentsAndOptions",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"tasks",
"as",
"$",
"name",
"=>",
"$",
"task",
")",
"{",
"if",
"... | Transform tasks to console commands. | [
"Transform",
"tasks",
"to",
"console",
"commands",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Deployer.php#L236-L247 |
221,006 | deployphp/deployer | src/Deployer.php | Deployer.collectAnonymousStats | public function collectAnonymousStats(CommandEvent $commandEvent)
{
if ($this->config->has('allow_anonymous_stats') && $this->config['allow_anonymous_stats'] === false) {
return;
}
$stats = [
'status' => 'success',
'command_name' => $commandEvent->getComm... | php | public function collectAnonymousStats(CommandEvent $commandEvent)
{
if ($this->config->has('allow_anonymous_stats') && $this->config['allow_anonymous_stats'] === false) {
return;
}
$stats = [
'status' => 'success',
'command_name' => $commandEvent->getComm... | [
"public",
"function",
"collectAnonymousStats",
"(",
"CommandEvent",
"$",
"commandEvent",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"->",
"has",
"(",
"'allow_anonymous_stats'",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'allow_anonymous_stats'",
"]",
... | Collect anonymous stats about Deployer usage for improving developer experience.
If you are not comfortable with this, you will always be able to disable this
by setting `allow_anonymous_stats` to false in your deploy.php file.
@param CommandEvent $commandEvent
@codeCoverageIgnore | [
"Collect",
"anonymous",
"stats",
"about",
"Deployer",
"usage",
"for",
"improving",
"developer",
"experience",
".",
"If",
"you",
"are",
"not",
"comfortable",
"with",
"this",
"you",
"will",
"always",
"be",
"able",
"to",
"disable",
"this",
"by",
"setting",
"allow... | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Deployer.php#L342-L376 |
221,007 | deployphp/deployer | src/Configuration/ConfigurationAccessor.php | ConfigurationAccessor.set | public function set(string $name, $value)
{
$this->config->set($name, $value);
return $this;
} | php | public function set(string $name, $value)
{
$this->config->set($name, $value);
return $this;
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"config",
"->",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set configuration option
@param mixed $value
@return static | [
"Set",
"configuration",
"option"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Configuration/ConfigurationAccessor.php#L47-L51 |
221,008 | deployphp/deployer | src/Configuration/ConfigurationAccessor.php | ConfigurationAccessor.add | public function add(string $name, array $value)
{
$this->config->add($name, $value);
return $this;
} | php | public function add(string $name, array $value)
{
$this->config->add($name, $value);
return $this;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"config",
"->",
"add",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add configuration option
@param mixed[] $value
@return static | [
"Add",
"configuration",
"option"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Configuration/ConfigurationAccessor.php#L59-L63 |
221,009 | deployphp/deployer | src/Console/InitCommand.php | InitCommand.createInitializer | private function createInitializer()
{
$initializer = new Initializer();
$initializer->addTemplate('Common', new CommonTemplate());
$initializer->addTemplate('Laravel', new LaravelTemplate());
$initializer->addTemplate('Symfony', new SymfonyTemplate());
$initializer->addTemp... | php | private function createInitializer()
{
$initializer = new Initializer();
$initializer->addTemplate('Common', new CommonTemplate());
$initializer->addTemplate('Laravel', new LaravelTemplate());
$initializer->addTemplate('Symfony', new SymfonyTemplate());
$initializer->addTemp... | [
"private",
"function",
"createInitializer",
"(",
")",
"{",
"$",
"initializer",
"=",
"new",
"Initializer",
"(",
")",
";",
"$",
"initializer",
"->",
"addTemplate",
"(",
"'Common'",
",",
"new",
"CommonTemplate",
"(",
")",
")",
";",
"$",
"initializer",
"->",
"... | Create a initializer system
@return Initializer | [
"Create",
"a",
"initializer",
"system"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Console/InitCommand.php#L158-L175 |
221,010 | deployphp/deployer | src/Support/Unix.php | Unix.parseHomeDir | public static function parseHomeDir(string $path): string
{
if (isset($_SERVER['HOME'])) {
$path = str_replace('~', $_SERVER['HOME'], $path);
} elseif (isset($_SERVER['HOMEDRIVE'], $_SERVER['HOMEPATH'])) {
$path = str_replace('~', $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'],... | php | public static function parseHomeDir(string $path): string
{
if (isset($_SERVER['HOME'])) {
$path = str_replace('~', $_SERVER['HOME'], $path);
} elseif (isset($_SERVER['HOMEDRIVE'], $_SERVER['HOMEPATH'])) {
$path = str_replace('~', $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'],... | [
"public",
"static",
"function",
"parseHomeDir",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HOME'",
"]",
")",
")",
"{",
"$",
"path",
"=",
"str_replace",
"(",
"'~'",
",",
"$",
"_SERVER",
"[",
... | Parse "~" symbol from path.
@param string $path
@return string | [
"Parse",
"~",
"symbol",
"from",
"path",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Support/Unix.php#L18-L27 |
221,011 | deployphp/deployer | src/Initializer/Initializer.php | Initializer.initialize | public function initialize($template, $directory, $file = 'deploy.php', $params = [])
{
if (!isset($this->templates[$template])) {
throw TemplateNotFoundException::create($template, array_keys($this->templates));
}
$this->checkDirectoryBeforeInitialize($directory);
$this... | php | public function initialize($template, $directory, $file = 'deploy.php', $params = [])
{
if (!isset($this->templates[$template])) {
throw TemplateNotFoundException::create($template, array_keys($this->templates));
}
$this->checkDirectoryBeforeInitialize($directory);
$this... | [
"public",
"function",
"initialize",
"(",
"$",
"template",
",",
"$",
"directory",
",",
"$",
"file",
"=",
"'deploy.php'",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"templates",
"[",
"$",
"template",
... | Initialize deployer in project
@param string $template
@param string $directory
@param string $file
@param array $params
@return string The configuration file path
@throws TemplateNotFoundException | [
"Initialize",
"deployer",
"in",
"project"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Initializer/Initializer.php#L62-L76 |
221,012 | deployphp/deployer | src/Initializer/Initializer.php | Initializer.checkDirectoryBeforeInitialize | private function checkDirectoryBeforeInitialize($directory)
{
if (!file_exists($directory)) {
set_error_handler(function ($errCode, $errStr) use ($directory) {
$parts = explode(':', $errStr, 2);
$errorMessage = isset($parts[1]) ? trim($parts[1]) : 'Undefined';
... | php | private function checkDirectoryBeforeInitialize($directory)
{
if (!file_exists($directory)) {
set_error_handler(function ($errCode, $errStr) use ($directory) {
$parts = explode(':', $errStr, 2);
$errorMessage = isset($parts[1]) ? trim($parts[1]) : 'Undefined';
... | [
"private",
"function",
"checkDirectoryBeforeInitialize",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"directory",
")",
")",
"{",
"set_error_handler",
"(",
"function",
"(",
"$",
"errCode",
",",
"$",
"errStr",
")",
"use",
"(",
"... | Check the directory before initialize
@param string $directory
@throws IOException | [
"Check",
"the",
"directory",
"before",
"initialize"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Initializer/Initializer.php#L85-L113 |
221,013 | deployphp/deployer | src/Initializer/Initializer.php | Initializer.checkFileBeforeInitialize | private function checkFileBeforeInitialize($directory, $file)
{
$filePath = $directory . '/' . $file;
if (file_exists($filePath)) {
throw new IOException(sprintf(
'The file "%s" already exist.',
$filePath
));
}
touch($filePath... | php | private function checkFileBeforeInitialize($directory, $file)
{
$filePath = $directory . '/' . $file;
if (file_exists($filePath)) {
throw new IOException(sprintf(
'The file "%s" already exist.',
$filePath
));
}
touch($filePath... | [
"private",
"function",
"checkFileBeforeInitialize",
"(",
"$",
"directory",
",",
"$",
"file",
")",
"{",
"$",
"filePath",
"=",
"$",
"directory",
".",
"'/'",
".",
"$",
"file",
";",
"if",
"(",
"file_exists",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"n... | Check the file before initialize
@param string $directory
@param string $file
@throws IOException | [
"Check",
"the",
"file",
"before",
"initialize"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Initializer/Initializer.php#L123-L135 |
221,014 | deployphp/deployer | src/Ssh/Arguments.php | Arguments.generateControlPath | private function generateControlPath(Host $host)
{
$port = empty($host->getPort()) ? '' : ':' . $host->getPort();
$connectionData = "$host$port";
$tryLongestPossible = 0;
$controlPath = '';
do {
switch ($tryLongestPossible) {
case 1:
... | php | private function generateControlPath(Host $host)
{
$port = empty($host->getPort()) ? '' : ':' . $host->getPort();
$connectionData = "$host$port";
$tryLongestPossible = 0;
$controlPath = '';
do {
switch ($tryLongestPossible) {
case 1:
... | [
"private",
"function",
"generateControlPath",
"(",
"Host",
"$",
"host",
")",
"{",
"$",
"port",
"=",
"empty",
"(",
"$",
"host",
"->",
"getPort",
"(",
")",
")",
"?",
"''",
":",
"':'",
".",
"$",
"host",
"->",
"getPort",
"(",
")",
";",
"$",
"connection... | Return SSH multiplexing control path
When ControlPath is longer than 104 chars we can get:
SSH Error: unix_listener: too long for Unix domain socket
So try to get as descriptive path as possible.
%C is for creating hash out of connection attributes.
@param Host $host
@return string ControlPath
@throws Exception | [
"Return",
"SSH",
"multiplexing",
"control",
"path"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Ssh/Arguments.php#L128-L157 |
221,015 | deployphp/deployer | src/Task/ScriptManager.php | ScriptManager.getTasks | public function getTasks($name, array $hosts = [], $hooksEnabled = true)
{
$collect = function ($name) use (&$collect, $hosts, $hooksEnabled) {
$task = $this->tasks->get($name);
if (!$task->shouldBePerformed(...array_values($hosts))) {
return [];
}
... | php | public function getTasks($name, array $hosts = [], $hooksEnabled = true)
{
$collect = function ($name) use (&$collect, $hosts, $hooksEnabled) {
$task = $this->tasks->get($name);
if (!$task->shouldBePerformed(...array_values($hosts))) {
return [];
}
... | [
"public",
"function",
"getTasks",
"(",
"$",
"name",
",",
"array",
"$",
"hosts",
"=",
"[",
"]",
",",
"$",
"hooksEnabled",
"=",
"true",
")",
"{",
"$",
"collect",
"=",
"function",
"(",
"$",
"name",
")",
"use",
"(",
"&",
"$",
"collect",
",",
"$",
"ho... | Return tasks to run
@param string $name
@param Host[] $hosts
@param bool $hooksEnabled
@return Task[] | [
"Return",
"tasks",
"to",
"run"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Task/ScriptManager.php#L36-L69 |
221,016 | deployphp/deployer | src/Utility/Rsync.php | Rsync.call | public function call($hostname, $source, $destination, array $config = [])
{
$defaults = [
'timeout' => null,
'options' => [],
];
$config = array_merge($defaults, $config);
$escapedSource = escapeshellarg($source);
$escapedDestination = escapeshellarg... | php | public function call($hostname, $source, $destination, array $config = [])
{
$defaults = [
'timeout' => null,
'options' => [],
];
$config = array_merge($defaults, $config);
$escapedSource = escapeshellarg($source);
$escapedDestination = escapeshellarg... | [
"public",
"function",
"call",
"(",
"$",
"hostname",
",",
"$",
"source",
",",
"$",
"destination",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'timeout'",
"=>",
"null",
",",
"'options'",
"=>",
"[",
"]",
",",
"]",... | Start rsync process
@param $hostname
@param $source
@param $destination
@param array $config | [
"Start",
"rsync",
"process"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Utility/Rsync.php#L32-L50 |
221,017 | deployphp/deployer | src/Console/DebugCommand.php | DebugCommand.createTreeFromTaskName | private function createTreeFromTaskName($taskName, $postfix = '', $isLast = false)
{
$task = $this->tasks->get($taskName);
if ($task->getBefore()) {
$beforePostfix = sprintf(' [before:%s]', $task->getName());
foreach ($task->getBefore() as $beforeTask) {
$th... | php | private function createTreeFromTaskName($taskName, $postfix = '', $isLast = false)
{
$task = $this->tasks->get($taskName);
if ($task->getBefore()) {
$beforePostfix = sprintf(' [before:%s]', $task->getName());
foreach ($task->getBefore() as $beforeTask) {
$th... | [
"private",
"function",
"createTreeFromTaskName",
"(",
"$",
"taskName",
",",
"$",
"postfix",
"=",
"''",
",",
"$",
"isLast",
"=",
"false",
")",
"{",
"$",
"task",
"=",
"$",
"this",
"->",
"tasks",
"->",
"get",
"(",
"$",
"taskName",
")",
";",
"if",
"(",
... | Create a tree from the given taskname
@param string $taskName
@param string $postfix
@param bool $isLast
@return void | [
"Create",
"a",
"tree",
"from",
"the",
"given",
"taskname"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Console/DebugCommand.php#L107-L152 |
221,018 | deployphp/deployer | src/Executor/ParallelExecutor.php | ParallelExecutor.runTask | private function runTask(array $hosts, Task $task): int
{
$processes = [];
foreach ($hosts as $host) {
if ($task->shouldBePerformed($host)) {
$processes[$host->getHostname()] = $this->getProcess($host, $task);
if ($task->isOnce()) {
$t... | php | private function runTask(array $hosts, Task $task): int
{
$processes = [];
foreach ($hosts as $host) {
if ($task->shouldBePerformed($host)) {
$processes[$host->getHostname()] = $this->getProcess($host, $task);
if ($task->isOnce()) {
$t... | [
"private",
"function",
"runTask",
"(",
"array",
"$",
"hosts",
",",
"Task",
"$",
"task",
")",
":",
"int",
"{",
"$",
"processes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"hosts",
"as",
"$",
"host",
")",
"{",
"if",
"(",
"$",
"task",
"->",
"shouldBe... | Run task on hosts.
@param Host[] $hosts | [
"Run",
"task",
"on",
"hosts",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Executor/ParallelExecutor.php#L123-L152 |
221,019 | deployphp/deployer | src/Executor/ParallelExecutor.php | ParallelExecutor.getProcess | protected function getProcess(Host $host, Task $task): Process
{
$dep = PHP_BINARY.' '.DEPLOYER_BIN;
$options = $this->generateOptions();
$arguments = $this->generateArguments();
$hostname = $host->getHostname();
$taskName = $task->getName();
$configFile = $host->get(... | php | protected function getProcess(Host $host, Task $task): Process
{
$dep = PHP_BINARY.' '.DEPLOYER_BIN;
$options = $this->generateOptions();
$arguments = $this->generateArguments();
$hostname = $host->getHostname();
$taskName = $task->getName();
$configFile = $host->get(... | [
"protected",
"function",
"getProcess",
"(",
"Host",
"$",
"host",
",",
"Task",
"$",
"task",
")",
":",
"Process",
"{",
"$",
"dep",
"=",
"PHP_BINARY",
".",
"' '",
".",
"DEPLOYER_BIN",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"generateOptions",
"(",
")... | Get process for task on host. | [
"Get",
"process",
"for",
"task",
"on",
"host",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Executor/ParallelExecutor.php#L157-L180 |
221,020 | deployphp/deployer | src/Executor/ParallelExecutor.php | ParallelExecutor.areRunning | protected function areRunning(array $processes): bool
{
foreach ($processes as $process) {
if ($process->isRunning()) {
return true;
}
}
return false;
} | php | protected function areRunning(array $processes): bool
{
foreach ($processes as $process) {
if ($process->isRunning()) {
return true;
}
}
return false;
} | [
"protected",
"function",
"areRunning",
"(",
"array",
"$",
"processes",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"processes",
"as",
"$",
"process",
")",
"{",
"if",
"(",
"$",
"process",
"->",
"isRunning",
"(",
")",
")",
"{",
"return",
"true",
";",
"... | Determine if any of the processes are running.
@param Process[] $processes | [
"Determine",
"if",
"any",
"of",
"the",
"processes",
"are",
"running",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Executor/ParallelExecutor.php#L201-L210 |
221,021 | deployphp/deployer | src/Executor/ParallelExecutor.php | ParallelExecutor.generateOptions | private function generateOptions(): string
{
/** @var string[] $inputs */
$inputs = [
(string) (new VerbosityString($this->output)),
];
$userDefinition = $this->console->getUserDefinition();
// Get user arguments
foreach ($userDefinition->getArguments() a... | php | private function generateOptions(): string
{
/** @var string[] $inputs */
$inputs = [
(string) (new VerbosityString($this->output)),
];
$userDefinition = $this->console->getUserDefinition();
// Get user arguments
foreach ($userDefinition->getArguments() a... | [
"private",
"function",
"generateOptions",
"(",
")",
":",
"string",
"{",
"/** @var string[] $inputs */",
"$",
"inputs",
"=",
"[",
"(",
"string",
")",
"(",
"new",
"VerbosityString",
"(",
"$",
"this",
"->",
"output",
")",
")",
",",
"]",
";",
"$",
"userDefinit... | Generate options and arguments string. | [
"Generate",
"options",
"and",
"arguments",
"string",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Executor/ParallelExecutor.php#L253-L274 |
221,022 | deployphp/deployer | src/Initializer/Exception/TemplateNotFoundException.php | TemplateNotFoundException.create | public static function create($template, array $availableTemplates, $code = 0, \Exception $prev = null)
{
return new static(sprintf(
'Not found template with name "%s". Available templates: "%s"',
$template,
implode('", "', $availableTemplates)
), $code, $prev);
... | php | public static function create($template, array $availableTemplates, $code = 0, \Exception $prev = null)
{
return new static(sprintf(
'Not found template with name "%s". Available templates: "%s"',
$template,
implode('", "', $availableTemplates)
), $code, $prev);
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"template",
",",
"array",
"$",
"availableTemplates",
",",
"$",
"code",
"=",
"0",
",",
"\\",
"Exception",
"$",
"prev",
"=",
"null",
")",
"{",
"return",
"new",
"static",
"(",
"sprintf",
"(",
"'Not found t... | Create a new exception via template name
@param string $template
@param array $availableTemplates
@param int $code
@param \Exception $prev
@return TemplateNotFoundException | [
"Create",
"a",
"new",
"exception",
"via",
"template",
"name"
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Initializer/Exception/TemplateNotFoundException.php#L27-L34 |
221,023 | deployphp/deployer | src/Console/Application.php | Application.addUserArgumentsAndOptions | public function addUserArgumentsAndOptions()
{
$this->getDefinition()->addArguments($this->getUserDefinition()->getArguments());
$this->getDefinition()->addOptions($this->getUserDefinition()->getOptions());
} | php | public function addUserArgumentsAndOptions()
{
$this->getDefinition()->addArguments($this->getUserDefinition()->getArguments());
$this->getDefinition()->addOptions($this->getUserDefinition()->getOptions());
} | [
"public",
"function",
"addUserArgumentsAndOptions",
"(",
")",
"{",
"$",
"this",
"->",
"getDefinition",
"(",
")",
"->",
"addArguments",
"(",
"$",
"this",
"->",
"getUserDefinition",
"(",
")",
"->",
"getArguments",
"(",
")",
")",
";",
"$",
"this",
"->",
"getD... | Add user definition arguments and options to definition. | [
"Add",
"user",
"definition",
"arguments",
"and",
"options",
"to",
"definition",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Console/Application.php#L106-L110 |
221,024 | deployphp/deployer | src/Task/Task.php | Task.shouldBePerformed | public function shouldBePerformed(...$hosts)
{
// don't allow to run again it the task has been marked to run only once
if ($this->once && $this->hasRun) {
return false;
}
foreach ($hosts as $host) {
$onHost = empty($this->on['hosts']) || in_array($host->getH... | php | public function shouldBePerformed(...$hosts)
{
// don't allow to run again it the task has been marked to run only once
if ($this->once && $this->hasRun) {
return false;
}
foreach ($hosts as $host) {
$onHost = empty($this->on['hosts']) || in_array($host->getH... | [
"public",
"function",
"shouldBePerformed",
"(",
"...",
"$",
"hosts",
")",
"{",
"// don't allow to run again it the task has been marked to run only once",
"if",
"(",
"$",
"this",
"->",
"once",
"&&",
"$",
"this",
"->",
"hasRun",
")",
"{",
"return",
"false",
";",
"}... | Checks what task should be performed on one of hosts.
@param Host[] $hosts
@return bool | [
"Checks",
"what",
"task",
"should",
"be",
"performed",
"on",
"one",
"of",
"hosts",
"."
] | eec02040d23d5bde05c9be843d17f961b9374102 | https://github.com/deployphp/deployer/blob/eec02040d23d5bde05c9be843d17f961b9374102/src/Task/Task.php#L211-L241 |
221,025 | tenancy/multi-tenant | src/Commands/RecreateCommand.php | RecreateCommand.tenantDatabaseExists | protected function tenantDatabaseExists(Website $website) : bool
{
try {
$this->connection->set($website);
$schema = $this->connection->get()->getSchemaBuilder();
if ($schema->hasTable($this->table)) {
return true;
}
} catch (\Excepti... | php | protected function tenantDatabaseExists(Website $website) : bool
{
try {
$this->connection->set($website);
$schema = $this->connection->get()->getSchemaBuilder();
if ($schema->hasTable($this->table)) {
return true;
}
} catch (\Excepti... | [
"protected",
"function",
"tenantDatabaseExists",
"(",
"Website",
"$",
"website",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"this",
"->",
"connection",
"->",
"set",
"(",
"$",
"website",
")",
";",
"$",
"schema",
"=",
"$",
"this",
"->",
"connection",
"->",
... | Checks if tenant database exists.
@param Website $website
@return bool | [
"Checks",
"if",
"tenant",
"database",
"exists",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Commands/RecreateCommand.php#L82-L97 |
221,026 | tenancy/multi-tenant | src/Generators/Filesystem/DirectoryGenerator.php | DirectoryGenerator.created | public function created(Events\Created $event): bool
{
if (config('tenancy.website.auto-create-tenant-directory')) {
$stat = $this->filesystem()->makeDirectory($event->website->uuid);
if ($stat) {
$this->emitEvent(
new DirectoryCreated($event->web... | php | public function created(Events\Created $event): bool
{
if (config('tenancy.website.auto-create-tenant-directory')) {
$stat = $this->filesystem()->makeDirectory($event->website->uuid);
if ($stat) {
$this->emitEvent(
new DirectoryCreated($event->web... | [
"public",
"function",
"created",
"(",
"Events",
"\\",
"Created",
"$",
"event",
")",
":",
"bool",
"{",
"if",
"(",
"config",
"(",
"'tenancy.website.auto-create-tenant-directory'",
")",
")",
"{",
"$",
"stat",
"=",
"$",
"this",
"->",
"filesystem",
"(",
")",
"-... | Mutates the service based on a website being enabled.
@param Events\Created $event
@return bool | [
"Mutates",
"the",
"service",
"based",
"on",
"a",
"website",
"being",
"enabled",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Generators/Filesystem/DirectoryGenerator.php#L54-L69 |
221,027 | tenancy/multi-tenant | src/Generators/Filesystem/DirectoryGenerator.php | DirectoryGenerator.deleted | public function deleted(Events\Deleted $event): bool
{
if (config('tenancy.website.auto-delete-tenant-directory')) {
$stat = $this->filesystem()->deleteDirectory($event->website->uuid);
if ($stat) {
$this->emitEvent(
new DirectoryDeleted($event->w... | php | public function deleted(Events\Deleted $event): bool
{
if (config('tenancy.website.auto-delete-tenant-directory')) {
$stat = $this->filesystem()->deleteDirectory($event->website->uuid);
if ($stat) {
$this->emitEvent(
new DirectoryDeleted($event->w... | [
"public",
"function",
"deleted",
"(",
"Events",
"\\",
"Deleted",
"$",
"event",
")",
":",
"bool",
"{",
"if",
"(",
"config",
"(",
"'tenancy.website.auto-delete-tenant-directory'",
")",
")",
"{",
"$",
"stat",
"=",
"$",
"this",
"->",
"filesystem",
"(",
")",
"-... | Acts on this service whenever a website is disabled.
@param Events\Deleted $event
@return bool | [
"Acts",
"on",
"this",
"service",
"whenever",
"a",
"website",
"is",
"disabled",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Generators/Filesystem/DirectoryGenerator.php#L103-L118 |
221,028 | tenancy/multi-tenant | src/Environment.php | Environment.hostname | public function hostname(Hostname $hostname = null): ?Hostname
{
if ($hostname !== null) {
$this->app->instance(CurrentHostname::class, $hostname);
$this->emitEvent(new Events\Hostnames\Switched($hostname));
return $hostname;
}
return $this->app->make(C... | php | public function hostname(Hostname $hostname = null): ?Hostname
{
if ($hostname !== null) {
$this->app->instance(CurrentHostname::class, $hostname);
$this->emitEvent(new Events\Hostnames\Switched($hostname));
return $hostname;
}
return $this->app->make(C... | [
"public",
"function",
"hostname",
"(",
"Hostname",
"$",
"hostname",
"=",
"null",
")",
":",
"?",
"Hostname",
"{",
"if",
"(",
"$",
"hostname",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"instance",
"(",
"CurrentHostname",
"::",
"class",
","... | Get or set the current hostname.
@param Hostname|null $hostname
@return Hostname|null | [
"Get",
"or",
"set",
"the",
"current",
"hostname",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Environment.php#L94-L105 |
221,029 | tenancy/multi-tenant | src/Environment.php | Environment.tenant | public function tenant(Website $website = null): ?Website
{
if ($website !== null) {
$this->app->instance(Tenant::class, $website);
$this->emitEvent(new Events\Websites\Switched($website));
return $website;
}
return $this->app->make(Tenant::class);
... | php | public function tenant(Website $website = null): ?Website
{
if ($website !== null) {
$this->app->instance(Tenant::class, $website);
$this->emitEvent(new Events\Websites\Switched($website));
return $website;
}
return $this->app->make(Tenant::class);
... | [
"public",
"function",
"tenant",
"(",
"Website",
"$",
"website",
"=",
"null",
")",
":",
"?",
"Website",
"{",
"if",
"(",
"$",
"website",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"instance",
"(",
"Tenant",
"::",
"class",
",",
"$",
"web... | Get or set current tenant.
@param Website|null $website
@return Tenant|null | [
"Get",
"or",
"set",
"current",
"tenant",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Environment.php#L120-L131 |
221,030 | tenancy/multi-tenant | src/Abstracts/AbstractTenantDirectoryListener.php | AbstractTenantDirectoryListener.proxy | public function proxy(WebsiteEvent $event)
{
if ($event->website) {
$this->directory($event->website);
} elseif ($this->requiresWebsite) {
return;
}
if ($this->requiresPath && !$this->exists()) {
return;
}
$result = $this->load($e... | php | public function proxy(WebsiteEvent $event)
{
if ($event->website) {
$this->directory($event->website);
} elseif ($this->requiresWebsite) {
return;
}
if ($this->requiresPath && !$this->exists()) {
return;
}
$result = $this->load($e... | [
"public",
"function",
"proxy",
"(",
"WebsiteEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"website",
")",
"{",
"$",
"this",
"->",
"directory",
"(",
"$",
"event",
"->",
"website",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"re... | Proxies fired events to configure the handler.
@param WebsiteEvent $event | [
"Proxies",
"fired",
"events",
"to",
"configure",
"the",
"handler",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Abstracts/AbstractTenantDirectoryListener.php#L84-L101 |
221,031 | tenancy/multi-tenant | src/Database/Connection.php | Connection.exists | public function exists(string $connection = null): bool
{
$connection = $connection ?? $this->tenantName();
return Arr::has($this->db->getConnections(), $connection);
} | php | public function exists(string $connection = null): bool
{
$connection = $connection ?? $this->tenantName();
return Arr::has($this->db->getConnections(), $connection);
} | [
"public",
"function",
"exists",
"(",
"string",
"$",
"connection",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"connection",
"=",
"$",
"connection",
"??",
"$",
"this",
"->",
"tenantName",
"(",
")",
";",
"return",
"Arr",
"::",
"has",
"(",
"$",
"this",
"->... | Checks whether a connection has been set up.
@param string|null $connection
@return bool | [
"Checks",
"whether",
"a",
"connection",
"has",
"been",
"set",
"up",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Database/Connection.php#L127-L132 |
221,032 | tenancy/multi-tenant | src/Database/Connection.php | Connection.system | public function system($for = null): \Illuminate\Database\Connection
{
$website = $this->convertWebsiteOrHostnameToWebsite($for);
return $this->db->connection(
$website && $website->managed_by_database_connection ?
$website->managed_by_database_connection :
... | php | public function system($for = null): \Illuminate\Database\Connection
{
$website = $this->convertWebsiteOrHostnameToWebsite($for);
return $this->db->connection(
$website && $website->managed_by_database_connection ?
$website->managed_by_database_connection :
... | [
"public",
"function",
"system",
"(",
"$",
"for",
"=",
"null",
")",
":",
"\\",
"Illuminate",
"\\",
"Database",
"\\",
"Connection",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"convertWebsiteOrHostnameToWebsite",
"(",
"$",
"for",
")",
";",
"return",
"$",
... | Gets the system connection.
@param Hostname|Website|null $for The hostname or website for which to retrieve a system connection.
@return \Illuminate\Database\Connection | [
"Gets",
"the",
"system",
"connection",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Database/Connection.php#L197-L206 |
221,033 | tenancy/multi-tenant | src/Database/Connection.php | Connection.purge | public function purge($connection = null)
{
$connection = $connection ?? $this->tenantName();
$this->db->purge(
$connection
);
$this->config->set(
sprintf('database.connections.%s', $connection),
[]
);
} | php | public function purge($connection = null)
{
$connection = $connection ?? $this->tenantName();
$this->db->purge(
$connection
);
$this->config->set(
sprintf('database.connections.%s', $connection),
[]
);
} | [
"public",
"function",
"purge",
"(",
"$",
"connection",
"=",
"null",
")",
"{",
"$",
"connection",
"=",
"$",
"connection",
"??",
"$",
"this",
"->",
"tenantName",
"(",
")",
";",
"$",
"this",
"->",
"db",
"->",
"purge",
"(",
"$",
"connection",
")",
";",
... | Purges the current tenant connection.
@param null $connection | [
"Purges",
"the",
"current",
"tenant",
"connection",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Database/Connection.php#L228-L240 |
221,034 | tenancy/multi-tenant | src/Website/Directory.php | Directory.copy | public function copy($from, $to)
{
return $this->filesystem->copy(
$this->path($from),
$this->path($to)
);
} | php | public function copy($from, $to)
{
return $this->filesystem->copy(
$this->path($from),
$this->path($to)
);
} | [
"public",
"function",
"copy",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"return",
"$",
"this",
"->",
"filesystem",
"->",
"copy",
"(",
"$",
"this",
"->",
"path",
"(",
"$",
"from",
")",
",",
"$",
"this",
"->",
"path",
"(",
"$",
"to",
")",
")",
... | Copy a file to a new location.
@param string $from
@param string $to
@return bool | [
"Copy",
"a",
"file",
"to",
"a",
"new",
"location",
"."
] | 5628006169368a33caf97b9d6788283c832a8a82 | https://github.com/tenancy/multi-tenant/blob/5628006169368a33caf97b9d6788283c832a8a82/src/Website/Directory.php#L217-L223 |
221,035 | Sylius/Sylius | src/Sylius/Bundle/CoreBundle/Routing/Matcher/Dumper/PhpMatcherDumper.php | PhpMatcherDumper.generateMatchMethod | private function generateMatchMethod(bool $supportsRedirections): string
{
// Group hosts by same-suffix, re-order when possible
$matchHost = false;
$routes = new StaticPrefixCollection();
foreach ($this->getRoutes()->all() as $name => $route) {
if ($host = $route->getHos... | php | private function generateMatchMethod(bool $supportsRedirections): string
{
// Group hosts by same-suffix, re-order when possible
$matchHost = false;
$routes = new StaticPrefixCollection();
foreach ($this->getRoutes()->all() as $name => $route) {
if ($host = $route->getHos... | [
"private",
"function",
"generateMatchMethod",
"(",
"bool",
"$",
"supportsRedirections",
")",
":",
"string",
"{",
"// Group hosts by same-suffix, re-order when possible",
"$",
"matchHost",
"=",
"false",
";",
"$",
"routes",
"=",
"new",
"StaticPrefixCollection",
"(",
")",
... | Generates the code for the match method implementing UrlMatcherInterface. | [
"Generates",
"the",
"code",
"for",
"the",
"match",
"method",
"implementing",
"UrlMatcherInterface",
"."
] | 8b26d4188fa81bb488612f59d2418b9472be1c79 | https://github.com/Sylius/Sylius/blob/8b26d4188fa81bb488612f59d2418b9472be1c79/src/Sylius/Bundle/CoreBundle/Routing/Matcher/Dumper/PhpMatcherDumper.php#L93-L170 |
221,036 | Sylius/Sylius | src/Sylius/Bundle/CoreBundle/Routing/Matcher/Dumper/PhpMatcherDumper.php | PhpMatcherDumper.compileRoutes | private function compileRoutes(RouteCollection $routes, bool $matchHost): string
{
[$staticRoutes, $dynamicRoutes] = $this->groupStaticRoutes($routes);
$code = $this->compileStaticRoutes($staticRoutes, $matchHost);
$chunkLimit = \count($dynamicRoutes);
while (true) {
tr... | php | private function compileRoutes(RouteCollection $routes, bool $matchHost): string
{
[$staticRoutes, $dynamicRoutes] = $this->groupStaticRoutes($routes);
$code = $this->compileStaticRoutes($staticRoutes, $matchHost);
$chunkLimit = \count($dynamicRoutes);
while (true) {
tr... | [
"private",
"function",
"compileRoutes",
"(",
"RouteCollection",
"$",
"routes",
",",
"bool",
"$",
"matchHost",
")",
":",
"string",
"{",
"[",
"$",
"staticRoutes",
",",
"$",
"dynamicRoutes",
"]",
"=",
"$",
"this",
"->",
"groupStaticRoutes",
"(",
"$",
"routes",
... | Generates PHP code to match a RouteCollection with all its routes. | [
"Generates",
"PHP",
"code",
"to",
"match",
"a",
"RouteCollection",
"with",
"all",
"its",
"routes",
"."
] | 8b26d4188fa81bb488612f59d2418b9472be1c79 | https://github.com/Sylius/Sylius/blob/8b26d4188fa81bb488612f59d2418b9472be1c79/src/Sylius/Bundle/CoreBundle/Routing/Matcher/Dumper/PhpMatcherDumper.php#L175-L205 |
221,037 | Sylius/Sylius | src/Sylius/Bundle/CoreBundle/Routing/Matcher/Dumper/PhpMatcherDumper.php | PhpMatcherDumper.compileSwitchDefault | private function compileSwitchDefault(bool $hasVars, bool $matchHost): string
{
if ($hasVars) {
$code = <<<EOF
foreach (\$vars as \$i => \$v) {
if (isset(\$matches[1 + \$i])) {
\$ret[\$v] = \$matches[1 + \$i];
}
}
EOF;... | php | private function compileSwitchDefault(bool $hasVars, bool $matchHost): string
{
if ($hasVars) {
$code = <<<EOF
foreach (\$vars as \$i => \$v) {
if (isset(\$matches[1 + \$i])) {
\$ret[\$v] = \$matches[1 + \$i];
}
}
EOF;... | [
"private",
"function",
"compileSwitchDefault",
"(",
"bool",
"$",
"hasVars",
",",
"bool",
"$",
"matchHost",
")",
":",
"string",
"{",
"if",
"(",
"$",
"hasVars",
")",
"{",
"$",
"code",
"=",
" <<<EOF\n\n foreach (\\$vars as \\$i => \\$v) {\n if (... | A simple helper to compiles the switch's "default" for both static and dynamic routes. | [
"A",
"simple",
"helper",
"to",
"compiles",
"the",
"switch",
"s",
"default",
"for",
"both",
"static",
"and",
"dynamic",
"routes",
"."
] | 8b26d4188fa81bb488612f59d2418b9472be1c79 | https://github.com/Sylius/Sylius/blob/8b26d4188fa81bb488612f59d2418b9472be1c79/src/Sylius/Bundle/CoreBundle/Routing/Matcher/Dumper/PhpMatcherDumper.php#L542-L591 |
221,038 | leighmacdonald/php_rbac | src/RBAC/Permission.php | Permission.create | public static function create($name, $description = "", $permission_id = null)
{
$perm = new self();
$perm->name = $name;
$perm->description = $description;
$perm->permission_id = $permission_id;
return $perm;
} | php | public static function create($name, $description = "", $permission_id = null)
{
$perm = new self();
$perm->name = $name;
$perm->description = $description;
$perm->permission_id = $permission_id;
return $perm;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"description",
"=",
"\"\"",
",",
"$",
"permission_id",
"=",
"null",
")",
"{",
"$",
"perm",
"=",
"new",
"self",
"(",
")",
";",
"$",
"perm",
"->",
"name",
"=",
"$",
"name",
";",
... | Configure and return a new Permission instance ready to be saved to the backend data store
@param string $name Name if the permission, this is treated as a key and must be unique
@param string $description Optional description.
@param null|int $permission_id Optional permission ID
@return Permission | [
"Configure",
"and",
"return",
"a",
"new",
"Permission",
"instance",
"ready",
"to",
"be",
"saved",
"to",
"the",
"backend",
"data",
"store"
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Permission.php#L47-L54 |
221,039 | ARCANEDEV/LaravelTracker | src/Trackers/QueryTracker.php | QueryTracker.track | public function track(array $queries)
{
if (count($queries) == 0)
return null;
$data = [
'query' => $this->prepareQuery($queries),
'arguments' => $this->prepareArguments($queries),
];
return $this->getModel()
->newQuery()
... | php | public function track(array $queries)
{
if (count($queries) == 0)
return null;
$data = [
'query' => $this->prepareQuery($queries),
'arguments' => $this->prepareArguments($queries),
];
return $this->getModel()
->newQuery()
... | [
"public",
"function",
"track",
"(",
"array",
"$",
"queries",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"queries",
")",
"==",
"0",
")",
"return",
"null",
";",
"$",
"data",
"=",
"[",
"'query'",
"=>",
"$",
"this",
"->",
"prepareQuery",
"(",
"$",
"querie... | Track the query.
@param array $queries
@return int|null | [
"Track",
"the",
"query",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/QueryTracker.php#L42-L56 |
221,040 | leighmacdonald/php_rbac | src/RBAC/Subject/Subject.php | Subject.hasPermission | public function hasPermission($permission)
{
if ($permission instanceof Permission) {
$permission = $permission->name;
}
return $this->getRoleSet()->has_permission($permission);
} | php | public function hasPermission($permission)
{
if ($permission instanceof Permission) {
$permission = $permission->name;
}
return $this->getRoleSet()->has_permission($permission);
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"permission",
"instanceof",
"Permission",
")",
"{",
"$",
"permission",
"=",
"$",
"permission",
"->",
"name",
";",
"}",
"return",
"$",
"this",
"->",
"getRoleSet",
"(",
... | Check if a user has access to the permission requested
@param string|Permission $permission name of the permission or Permission instance
@return bool | [
"Check",
"if",
"a",
"user",
"has",
"access",
"to",
"the",
"permission",
"requested"
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Subject/Subject.php#L79-L85 |
221,041 | ARCANEDEV/LaravelTracker | src/Detectors/GeoIpDetector.php | GeoIpDetector.search | public function search($ipAddress)
{
try {
if ($location = $this->geoIp->location($ipAddress)) {
return $this->transform($location);
}
}
catch (\Exception $e) {
// do nothing
}
return null;
} | php | public function search($ipAddress)
{
try {
if ($location = $this->geoIp->location($ipAddress)) {
return $this->transform($location);
}
}
catch (\Exception $e) {
// do nothing
}
return null;
} | [
"public",
"function",
"search",
"(",
"$",
"ipAddress",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"location",
"=",
"$",
"this",
"->",
"geoIp",
"->",
"location",
"(",
"$",
"ipAddress",
")",
")",
"{",
"return",
"$",
"this",
"->",
"transform",
"(",
"$",
"l... | Get the geoip data.
@param string $ipAddress
@return array|null | [
"Get",
"the",
"geoip",
"data",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Detectors/GeoIpDetector.php#L51-L63 |
221,042 | ARCANEDEV/LaravelTracker | src/Detectors/GeoIpDetector.php | GeoIpDetector.transform | private function transform($location)
{
return [
'iso_code' => $location->iso_code,
'country' => $location->country,
'city' => $location->city,
'state' => $location->state,
'state_code' => $location->state_code,
'po... | php | private function transform($location)
{
return [
'iso_code' => $location->iso_code,
'country' => $location->country,
'city' => $location->city,
'state' => $location->state,
'state_code' => $location->state_code,
'po... | [
"private",
"function",
"transform",
"(",
"$",
"location",
")",
"{",
"return",
"[",
"'iso_code'",
"=>",
"$",
"location",
"->",
"iso_code",
",",
"'country'",
"=>",
"$",
"location",
"->",
"country",
",",
"'city'",
"=>",
"$",
"location",
"->",
"city",
",",
"... | Render the data.
@param \Arcanedev\GeoIP\Location $location
@return array | [
"Render",
"the",
"data",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Detectors/GeoIpDetector.php#L77-L92 |
221,043 | ARCANEDEV/LaravelTracker | src/LaravelTrackerServiceProvider.php | LaravelTrackerServiceProvider.registerDetectors | private function registerDetectors()
{
$this->singleton(Contracts\Detectors\CrawlerDetector::class, function (AppContract $app) {
/** @var \Illuminate\Http\Request $request */
$request = $app['request'];
return new Detectors\CrawlerDetector(
new \Jaybiz... | php | private function registerDetectors()
{
$this->singleton(Contracts\Detectors\CrawlerDetector::class, function (AppContract $app) {
/** @var \Illuminate\Http\Request $request */
$request = $app['request'];
return new Detectors\CrawlerDetector(
new \Jaybiz... | [
"private",
"function",
"registerDetectors",
"(",
")",
"{",
"$",
"this",
"->",
"singleton",
"(",
"Contracts",
"\\",
"Detectors",
"\\",
"CrawlerDetector",
"::",
"class",
",",
"function",
"(",
"AppContract",
"$",
"app",
")",
"{",
"/** @var \\Illuminate\\Http\\Reques... | Register the detectors. | [
"Register",
"the",
"detectors",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/LaravelTrackerServiceProvider.php#L97-L114 |
221,044 | ARCANEDEV/LaravelTracker | src/LaravelTrackerServiceProvider.php | LaravelTrackerServiceProvider.registerParsers | private function registerParsers()
{
$this->singleton(Contracts\Parsers\RefererParser::class, function () {
return new Parsers\RefererParser(
new \Snowplow\RefererParser\Parser
);
});
$this->singleton(Contracts\Parsers\UserAgentParser::class, function... | php | private function registerParsers()
{
$this->singleton(Contracts\Parsers\RefererParser::class, function () {
return new Parsers\RefererParser(
new \Snowplow\RefererParser\Parser
);
});
$this->singleton(Contracts\Parsers\UserAgentParser::class, function... | [
"private",
"function",
"registerParsers",
"(",
")",
"{",
"$",
"this",
"->",
"singleton",
"(",
"Contracts",
"\\",
"Parsers",
"\\",
"RefererParser",
"::",
"class",
",",
"function",
"(",
")",
"{",
"return",
"new",
"Parsers",
"\\",
"RefererParser",
"(",
"new",
... | Register the parsers. | [
"Register",
"the",
"parsers",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/LaravelTrackerServiceProvider.php#L119-L132 |
221,045 | leighmacdonald/php_rbac | src/RBAC/Role/RoleSet.php | RoleSet.addRole | public function addRole(Role $role)
{
if (!in_array($role, $this->roles)) {
$this->roles[] = $role;
return true;
}
return false;
} | php | public function addRole(Role $role)
{
if (!in_array($role, $this->roles)) {
$this->roles[] = $role;
return true;
}
return false;
} | [
"public",
"function",
"addRole",
"(",
"Role",
"$",
"role",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"role",
",",
"$",
"this",
"->",
"roles",
")",
")",
"{",
"$",
"this",
"->",
"roles",
"[",
"]",
"=",
"$",
"role",
";",
"return",
"true",
";... | Add a new role to the role set
@param Role $role
@return bool | [
"Add",
"a",
"new",
"role",
"to",
"the",
"role",
"set"
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Role/RoleSet.php#L40-L47 |
221,046 | leighmacdonald/php_rbac | src/RBAC/Role/RoleSet.php | RoleSet.getPermissions | public function getPermissions()
{
$permissions = [];
foreach ($this->roles as $role) {
$permissions = array_merge($permissions, $role->getPermissions());
}
return array_unique($permissions);
} | php | public function getPermissions()
{
$permissions = [];
foreach ($this->roles as $role) {
$permissions = array_merge($permissions, $role->getPermissions());
}
return array_unique($permissions);
} | [
"public",
"function",
"getPermissions",
"(",
")",
"{",
"$",
"permissions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"roles",
"as",
"$",
"role",
")",
"{",
"$",
"permissions",
"=",
"array_merge",
"(",
"$",
"permissions",
",",
"$",
"role",
... | Fetch a complete set of unique permissions assigned to the users roles
@return Permission[] | [
"Fetch",
"a",
"complete",
"set",
"of",
"unique",
"permissions",
"assigned",
"to",
"the",
"users",
"roles"
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Role/RoleSet.php#L79-L86 |
221,047 | ARCANEDEV/LaravelTracker | src/Exceptions/ExceptionFactory.php | ExceptionFactory.make | public static function make($errorCode, $errorMessage)
{
$exception = Arr::get(self::$supported, $errorCode, Errors\Error::class);
return new $exception($errorMessage, $errorCode);
} | php | public static function make($errorCode, $errorMessage)
{
$exception = Arr::get(self::$supported, $errorCode, Errors\Error::class);
return new $exception($errorMessage, $errorCode);
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"errorCode",
",",
"$",
"errorMessage",
")",
"{",
"$",
"exception",
"=",
"Arr",
"::",
"get",
"(",
"self",
"::",
"$",
"supported",
",",
"$",
"errorCode",
",",
"Errors",
"\\",
"Error",
"::",
"class",
")",
... | Make exception.
@param int $errorCode
@param string $errorMessage
@return mixed | [
"Make",
"exception",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Exceptions/ExceptionFactory.php#L54-L59 |
221,048 | ARCANEDEV/LaravelTracker | src/Trackers/CookieTracker.php | CookieTracker.track | public function track($cookie)
{
if ( ! $cookie) {
$this->cookie()->queue(
$this->cookie()->make($this->getConfig('cookie.name'), $cookie = (string) Uuid::uuid4())
);
}
return $this->getModel()
->newQuery()
->fi... | php | public function track($cookie)
{
if ( ! $cookie) {
$this->cookie()->queue(
$this->cookie()->make($this->getConfig('cookie.name'), $cookie = (string) Uuid::uuid4())
);
}
return $this->getModel()
->newQuery()
->fi... | [
"public",
"function",
"track",
"(",
"$",
"cookie",
")",
"{",
"if",
"(",
"!",
"$",
"cookie",
")",
"{",
"$",
"this",
"->",
"cookie",
"(",
")",
"->",
"queue",
"(",
"$",
"this",
"->",
"cookie",
"(",
")",
"->",
"make",
"(",
"$",
"this",
"->",
"getCo... | Track the cookie.
@param mixed $cookie
@return int | [
"Track",
"the",
"cookie",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/CookieTracker.php#L43-L55 |
221,049 | ARCANEDEV/LaravelTracker | src/Trackers/GeoIpTracker.php | GeoIpTracker.track | public function track($ipAddress)
{
if ($data = $this->getGeoIpDetector()->search($ipAddress)) {
return $this->getModel()
->newQuery()
->firstOrCreate(Arr::only($data, ['latitude', 'longitude']), $data)
->getKey();
}
return null;
... | php | public function track($ipAddress)
{
if ($data = $this->getGeoIpDetector()->search($ipAddress)) {
return $this->getModel()
->newQuery()
->firstOrCreate(Arr::only($data, ['latitude', 'longitude']), $data)
->getKey();
}
return null;
... | [
"public",
"function",
"track",
"(",
"$",
"ipAddress",
")",
"{",
"if",
"(",
"$",
"data",
"=",
"$",
"this",
"->",
"getGeoIpDetector",
"(",
")",
"->",
"search",
"(",
"$",
"ipAddress",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getModel",
"(",
")",
"... | Track the ip address.
@param string $ipAddress
@return int|null | [
"Track",
"the",
"ip",
"address",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/GeoIpTracker.php#L51-L61 |
221,050 | ARCANEDEV/LaravelTracker | src/Parsers/UserAgentParser.php | UserAgentParser.getOperatingSystemVersion | public function getOperatingSystemVersion()
{
$os = $this->getOperatingSystem();
return $this->prepareVersion([$os->major, $os->minor, $os->patch]);
} | php | public function getOperatingSystemVersion()
{
$os = $this->getOperatingSystem();
return $this->prepareVersion([$os->major, $os->minor, $os->patch]);
} | [
"public",
"function",
"getOperatingSystemVersion",
"(",
")",
"{",
"$",
"os",
"=",
"$",
"this",
"->",
"getOperatingSystem",
"(",
")",
";",
"return",
"$",
"this",
"->",
"prepareVersion",
"(",
"[",
"$",
"os",
"->",
"major",
",",
"$",
"os",
"->",
"minor",
... | Get the OS version.
@return string | [
"Get",
"the",
"OS",
"version",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Parsers/UserAgentParser.php#L56-L61 |
221,051 | ARCANEDEV/LaravelTracker | src/Parsers/UserAgentParser.php | UserAgentParser.getUserAgentVersion | public function getUserAgentVersion()
{
$ua = $this->getUserAgent();
return $this->prepareVersion([$ua->major, $ua->minor, $ua->patch]);
} | php | public function getUserAgentVersion()
{
$ua = $this->getUserAgent();
return $this->prepareVersion([$ua->major, $ua->minor, $ua->patch]);
} | [
"public",
"function",
"getUserAgentVersion",
"(",
")",
"{",
"$",
"ua",
"=",
"$",
"this",
"->",
"getUserAgent",
"(",
")",
";",
"return",
"$",
"this",
"->",
"prepareVersion",
"(",
"[",
"$",
"ua",
"->",
"major",
",",
"$",
"ua",
"->",
"minor",
",",
"$",
... | Get the user agent version.
@return string | [
"Get",
"the",
"user",
"agent",
"version",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Parsers/UserAgentParser.php#L93-L98 |
221,052 | ARCANEDEV/LaravelTracker | src/Trackers/DeviceTracker.php | DeviceTracker.getCurrentDeviceProperties | private function getCurrentDeviceProperties()
{
if ($properties = $this->getDeviceDetector()->detect()) {
$parser = $this->getUserAgentParser();
$properties['platform'] = $parser->getOperatingSystemFamily();
$properties['platform_version'] = $parser->getOperating... | php | private function getCurrentDeviceProperties()
{
if ($properties = $this->getDeviceDetector()->detect()) {
$parser = $this->getUserAgentParser();
$properties['platform'] = $parser->getOperatingSystemFamily();
$properties['platform_version'] = $parser->getOperating... | [
"private",
"function",
"getCurrentDeviceProperties",
"(",
")",
"{",
"if",
"(",
"$",
"properties",
"=",
"$",
"this",
"->",
"getDeviceDetector",
"(",
")",
"->",
"detect",
"(",
")",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"getUserAgentParser",
"(",
... | Get the current device properties.
@return array | [
"Get",
"the",
"current",
"device",
"properties",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/DeviceTracker.php#L75-L85 |
221,053 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.checkData | public function checkData(array $currentData, array $newData)
{
return ($currentData && $newData && $currentData !== $newData)
? $this->updateData($newData)
: $newData;
} | php | public function checkData(array $currentData, array $newData)
{
return ($currentData && $newData && $currentData !== $newData)
? $this->updateData($newData)
: $newData;
} | [
"public",
"function",
"checkData",
"(",
"array",
"$",
"currentData",
",",
"array",
"$",
"newData",
")",
"{",
"return",
"(",
"$",
"currentData",
"&&",
"$",
"newData",
"&&",
"$",
"currentData",
"!==",
"$",
"newData",
")",
"?",
"$",
"this",
"->",
"updateDat... | Check the visitor data.
@param array $currentData
@param array $newData
@return array | [
"Check",
"the",
"visitor",
"data",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L111-L116 |
221,054 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.getVisitorData | private function getVisitorData($column = null)
{
$data = $this->session()->get($this->getSessionKey());
return is_null($column) ? $data : Arr::get($data, $column, null);
} | php | private function getVisitorData($column = null)
{
$data = $this->session()->get($this->getSessionKey());
return is_null($column) ? $data : Arr::get($data, $column, null);
} | [
"private",
"function",
"getVisitorData",
"(",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"session",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"getSessionKey",
"(",
")",
")",
";",
"return",
"is_null",
"(",
"$",
"... | Get the visitor data.
@param string|null $column
@return mixed | [
"Get",
"the",
"visitor",
"data",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L144-L149 |
221,055 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.checkIfUserChanged | private function checkIfUserChanged(array $data)
{
$model = $this->getModel()->newQuery()->find($this->getVisitorData('id'));
if (
! is_null($model) &&
! is_null($model->user_id) &&
! is_null($data['user_id']) &&
$data['user_id'] !== $model->user_id
... | php | private function checkIfUserChanged(array $data)
{
$model = $this->getModel()->newQuery()->find($this->getVisitorData('id'));
if (
! is_null($model) &&
! is_null($model->user_id) &&
! is_null($data['user_id']) &&
$data['user_id'] !== $model->user_id
... | [
"private",
"function",
"checkIfUserChanged",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"newQuery",
"(",
")",
"->",
"find",
"(",
"$",
"this",
"->",
"getVisitorData",
"(",
"'id'",
")",
")",
"... | Check if user changed.
@param array $data | [
"Check",
"if",
"user",
"changed",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L156-L170 |
221,056 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.regenerateSystemVisitor | private function regenerateSystemVisitor($data = null)
{
$data = $data ?: $this->getVisitorData();
if ($data) {
$this->resetVisitorUuid($data);
$this->createVisitorIfIsUnknown();
}
return $this->visitorInfo;
} | php | private function regenerateSystemVisitor($data = null)
{
$data = $data ?: $this->getVisitorData();
if ($data) {
$this->resetVisitorUuid($data);
$this->createVisitorIfIsUnknown();
}
return $this->visitorInfo;
} | [
"private",
"function",
"regenerateSystemVisitor",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"$",
"data",
"?",
":",
"$",
"this",
"->",
"getVisitorData",
"(",
")",
";",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"resetVisitor... | Regenerate visitor data for the system.
@param array|null $data
@return array | [
"Regenerate",
"visitor",
"data",
"for",
"the",
"system",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L179-L189 |
221,057 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.resetVisitorUuid | private function resetVisitorUuid($data = null)
{
$this->visitorInfo['uuid'] = null;
$data = $data ?: $this->visitorInfo;
unset($data['uuid']);
$this->putSessionData($data);
$this->checkVisitorUuid();
return $data;
} | php | private function resetVisitorUuid($data = null)
{
$this->visitorInfo['uuid'] = null;
$data = $data ?: $this->visitorInfo;
unset($data['uuid']);
$this->putSessionData($data);
$this->checkVisitorUuid();
return $data;
} | [
"private",
"function",
"resetVisitorUuid",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"visitorInfo",
"[",
"'uuid'",
"]",
"=",
"null",
";",
"$",
"data",
"=",
"$",
"data",
"?",
":",
"$",
"this",
"->",
"visitorInfo",
";",
"unset",
"(",
... | Reset the visitor uuid.
@param array|null $data
@return array|null | [
"Reset",
"the",
"visitor",
"uuid",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L198-L210 |
221,058 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.checkVisitorUuid | private function checkVisitorUuid()
{
if ( ! isset($this->visitorInfo['uuid']) || ! $this->visitorInfo['uuid'])
$this->visitorInfo['uuid'] = $this->getVisitorIdFromSystem();
} | php | private function checkVisitorUuid()
{
if ( ! isset($this->visitorInfo['uuid']) || ! $this->visitorInfo['uuid'])
$this->visitorInfo['uuid'] = $this->getVisitorIdFromSystem();
} | [
"private",
"function",
"checkVisitorUuid",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"visitorInfo",
"[",
"'uuid'",
"]",
")",
"||",
"!",
"$",
"this",
"->",
"visitorInfo",
"[",
"'uuid'",
"]",
")",
"$",
"this",
"->",
"visitorInfo",
... | Check the visitor uuid. | [
"Check",
"the",
"visitor",
"uuid",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L227-L231 |
221,059 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.createVisitorIfIsUnknown | private function createVisitorIfIsUnknown()
{
$model = $this->getModel();
/** @var \Arcanedev\LaravelTracker\Models\Visitor $visitor */
if ($this->isVisitorKnown()) {
$visitor = $model->newQuery()->find($id = $this->getVisitorData($model->getKeyName()));
$visitor->... | php | private function createVisitorIfIsUnknown()
{
$model = $this->getModel();
/** @var \Arcanedev\LaravelTracker\Models\Visitor $visitor */
if ($this->isVisitorKnown()) {
$visitor = $model->newQuery()->find($id = $this->getVisitorData($model->getKeyName()));
$visitor->... | [
"private",
"function",
"createVisitorIfIsUnknown",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getModel",
"(",
")",
";",
"/** @var \\Arcanedev\\LaravelTracker\\Models\\Visitor $visitor */",
"if",
"(",
"$",
"this",
"->",
"isVisitorKnown",
"(",
")",
")",
... | Create a new visitor if is unknown.
@return bool | [
"Create",
"a",
"new",
"visitor",
"if",
"is",
"unknown",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L248-L270 |
221,060 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.isVisitorKnown | private function isVisitorKnown()
{
if ( ! $this->session()->has($this->getSessionKey()))
return false;
if ($this->getVisitorData('uuid') != $this->getVisitorIdFromSystem())
return false;
if ( ! $this->findByUuid($this->getVisitorData('uuid')))
return fa... | php | private function isVisitorKnown()
{
if ( ! $this->session()->has($this->getSessionKey()))
return false;
if ($this->getVisitorData('uuid') != $this->getVisitorIdFromSystem())
return false;
if ( ! $this->findByUuid($this->getVisitorData('uuid')))
return fa... | [
"private",
"function",
"isVisitorKnown",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"session",
"(",
")",
"->",
"has",
"(",
"$",
"this",
"->",
"getSessionKey",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"getVisi... | Check if the visitor is known.
@return bool | [
"Check",
"if",
"the",
"visitor",
"is",
"known",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L277-L289 |
221,061 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.generateVisitor | private function generateVisitor(array $visitorInfo)
{
$this->visitorInfo = $visitorInfo;
if ( ! $this->checkVisitorDataIsReliable())
$this->regenerateSystemVisitor();
$this->checkVisitorUuid();
} | php | private function generateVisitor(array $visitorInfo)
{
$this->visitorInfo = $visitorInfo;
if ( ! $this->checkVisitorDataIsReliable())
$this->regenerateSystemVisitor();
$this->checkVisitorUuid();
} | [
"private",
"function",
"generateVisitor",
"(",
"array",
"$",
"visitorInfo",
")",
"{",
"$",
"this",
"->",
"visitorInfo",
"=",
"$",
"visitorInfo",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"checkVisitorDataIsReliable",
"(",
")",
")",
"$",
"this",
"->",
"regene... | Generate visitor data.
@param array $visitorInfo | [
"Generate",
"visitor",
"data",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L308-L316 |
221,062 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.checkVisitorDataIsReliable | private function checkVisitorDataIsReliable()
{
$data = $this->getVisitorData();
foreach (['user_id', 'client_ip', 'user_agent'] as $key) {
if ($this->checkDataIsUnreliable($data, $key)) return false;
}
return true;
} | php | private function checkVisitorDataIsReliable()
{
$data = $this->getVisitorData();
foreach (['user_id', 'client_ip', 'user_agent'] as $key) {
if ($this->checkDataIsUnreliable($data, $key)) return false;
}
return true;
} | [
"private",
"function",
"checkVisitorDataIsReliable",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getVisitorData",
"(",
")",
";",
"foreach",
"(",
"[",
"'user_id'",
",",
"'client_ip'",
",",
"'user_agent'",
"]",
"as",
"$",
"key",
")",
"{",
"if",
"(... | Check if the visitor data is reliable.
@return bool | [
"Check",
"if",
"the",
"visitor",
"data",
"is",
"reliable",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L323-L332 |
221,063 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.checkDataIsUnreliable | private function checkDataIsUnreliable($data, $key)
{
return isset($data[$key]) && ($data[$key] !== $this->visitorInfo[$key]);
} | php | private function checkDataIsUnreliable($data, $key)
{
return isset($data[$key]) && ($data[$key] !== $this->visitorInfo[$key]);
} | [
"private",
"function",
"checkDataIsUnreliable",
"(",
"$",
"data",
",",
"$",
"key",
")",
"{",
"return",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
"&&",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
"!==",
"$",
"this",
"->",
"visitorInfo",
"[",... | Check the data is unreliable.
@param array|null $data
@param string $key
@return bool | [
"Check",
"the",
"data",
"is",
"unreliable",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L342-L345 |
221,064 | ARCANEDEV/LaravelTracker | src/Trackers/VisitorTracker.php | VisitorTracker.ensureVisitorDataIsComplete | private function ensureVisitorDataIsComplete()
{
$visitorData = $this->getVisitorData();
$completed = true;
foreach ($this->visitorInfo as $key => $value) {
if ($visitorData[$key] !== $value) {
/** @var \Arcanedev\LaravelTracker\Models\Visitor $model */
... | php | private function ensureVisitorDataIsComplete()
{
$visitorData = $this->getVisitorData();
$completed = true;
foreach ($this->visitorInfo as $key => $value) {
if ($visitorData[$key] !== $value) {
/** @var \Arcanedev\LaravelTracker\Models\Visitor $model */
... | [
"private",
"function",
"ensureVisitorDataIsComplete",
"(",
")",
"{",
"$",
"visitorData",
"=",
"$",
"this",
"->",
"getVisitorData",
"(",
")",
";",
"$",
"completed",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"visitorInfo",
"as",
"$",
"key",
"=>",
... | Ensure that the visitor data is complete. | [
"Ensure",
"that",
"the",
"visitor",
"data",
"is",
"complete",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/VisitorTracker.php#L350-L370 |
221,065 | ARCANEDEV/LaravelTracker | src/Trackers/RefererTracker.php | RefererTracker.track | public function track($refererUrl, $pageUrl)
{
$firstParsed = $this->getRefererParser()->parseUrl($refererUrl);
if ($firstParsed) {
$attributes = [
'url' => $firstParsed['url'],
'host' => $firstParsed['host'],
'd... | php | public function track($refererUrl, $pageUrl)
{
$firstParsed = $this->getRefererParser()->parseUrl($refererUrl);
if ($firstParsed) {
$attributes = [
'url' => $firstParsed['url'],
'host' => $firstParsed['host'],
'd... | [
"public",
"function",
"track",
"(",
"$",
"refererUrl",
",",
"$",
"pageUrl",
")",
"{",
"$",
"firstParsed",
"=",
"$",
"this",
"->",
"getRefererParser",
"(",
")",
"->",
"parseUrl",
"(",
"$",
"refererUrl",
")",
";",
"if",
"(",
"$",
"firstParsed",
")",
"{",... | Track the referer and return the id.
@param string $refererUrl
@param string $pageUrl
@return int|null | [
"Track",
"the",
"referer",
"and",
"return",
"the",
"id",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/RefererTracker.php#L52-L88 |
221,066 | ARCANEDEV/LaravelTracker | src/Trackers/RefererTracker.php | RefererTracker.trackDomain | private function trackDomain($name)
{
return $this->makeModel(BindingManager::MODEL_DOMAIN)
->newQuery()
->firstOrCreate(compact('name'))
->getKey();
} | php | private function trackDomain($name)
{
return $this->makeModel(BindingManager::MODEL_DOMAIN)
->newQuery()
->firstOrCreate(compact('name'))
->getKey();
} | [
"private",
"function",
"trackDomain",
"(",
"$",
"name",
")",
"{",
"return",
"$",
"this",
"->",
"makeModel",
"(",
"BindingManager",
"::",
"MODEL_DOMAIN",
")",
"->",
"newQuery",
"(",
")",
"->",
"firstOrCreate",
"(",
"compact",
"(",
"'name'",
")",
")",
"->",
... | Track the domain and get the id.
@param string $name
@return int | [
"Track",
"the",
"domain",
"and",
"get",
"the",
"id",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/RefererTracker.php#L97-L103 |
221,067 | ARCANEDEV/LaravelTracker | src/Trackers/RefererTracker.php | RefererTracker.trackRefererSearchTerms | private function trackRefererSearchTerms($referer, $searchTerms)
{
$terms = [];
foreach (explode(' ', $searchTerms) as $term) {
$terms[] = $this->makeModel(BindingManager::MODEL_REFERER_SEARCH_TERM)->fill([
'search_term' => $term,
]);
}
if (c... | php | private function trackRefererSearchTerms($referer, $searchTerms)
{
$terms = [];
foreach (explode(' ', $searchTerms) as $term) {
$terms[] = $this->makeModel(BindingManager::MODEL_REFERER_SEARCH_TERM)->fill([
'search_term' => $term,
]);
}
if (c... | [
"private",
"function",
"trackRefererSearchTerms",
"(",
"$",
"referer",
",",
"$",
"searchTerms",
")",
"{",
"$",
"terms",
"=",
"[",
"]",
";",
"foreach",
"(",
"explode",
"(",
"' '",
",",
"$",
"searchTerms",
")",
"as",
"$",
"term",
")",
"{",
"$",
"terms",
... | Store the referer's search terms.
@param \Arcanedev\LaravelTracker\Contracts\Models\Referer $referer
@param string $searchTerms | [
"Store",
"the",
"referer",
"s",
"search",
"terms",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/RefererTracker.php#L111-L124 |
221,068 | particle-php/Filter | src/Value/Container.php | Container.traverse | protected function traverse($key, $returnValue = true)
{
$value = $this->values;
foreach (explode('.', $key) as $part) {
if (!array_key_exists($part, $value)) {
return false;
}
$value = $value[$part];
}
return $returnValue ? $value ... | php | protected function traverse($key, $returnValue = true)
{
$value = $this->values;
foreach (explode('.', $key) as $part) {
if (!array_key_exists($part, $value)) {
return false;
}
$value = $value[$part];
}
return $returnValue ? $value ... | [
"protected",
"function",
"traverse",
"(",
"$",
"key",
",",
"$",
"returnValue",
"=",
"true",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"values",
";",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
"as",
"$",
"part",
")",
"{",
"... | Traverses the key using dot notation. Based on the second parameter, it will return the value or if it was set.
@param string $key
@param bool $returnValue
@return mixed | [
"Traverses",
"the",
"key",
"using",
"dot",
"notation",
".",
"Based",
"on",
"the",
"second",
"parameter",
"it",
"will",
"return",
"the",
"value",
"or",
"if",
"it",
"was",
"set",
"."
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Value/Container.php#L100-L110 |
221,069 | particle-php/Filter | src/Value/Container.php | Container.setTraverse | protected function setTraverse($key, $value)
{
$parts = explode('.', $key);
$ref = &$this->values;
foreach ($parts as $i => $part) {
$ref = &$ref[$part];
}
$ref = $value;
return $this;
} | php | protected function setTraverse($key, $value)
{
$parts = explode('.', $key);
$ref = &$this->values;
foreach ($parts as $i => $part) {
$ref = &$ref[$part];
}
$ref = $value;
return $this;
} | [
"protected",
"function",
"setTraverse",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"ref",
"=",
"&",
"$",
"this",
"->",
"values",
";",
"foreach",
"(",
"$",
"parts",
"as",... | Uses dot-notation to set a value.
@param string $key
@param mixed $value
@return $this | [
"Uses",
"dot",
"-",
"notation",
"to",
"set",
"a",
"value",
"."
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Value/Container.php#L119-L130 |
221,070 | particle-php/Filter | src/FilterResource.php | FilterResource.cut | public function cut($start, $length = null)
{
return $this->addRule(new FilterRule\Cut($start, $length));
} | php | public function cut($start, $length = null)
{
return $this->addRule(new FilterRule\Cut($start, $length));
} | [
"public",
"function",
"cut",
"(",
"$",
"start",
",",
"$",
"length",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addRule",
"(",
"new",
"FilterRule",
"\\",
"Cut",
"(",
"$",
"start",
",",
"$",
"length",
")",
")",
";",
"}"
] | Results rule that returns the cut value
@param int $start
@param int|null $length
@return $this | [
"Results",
"rule",
"that",
"returns",
"the",
"cut",
"value"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterResource.php#L87-L90 |
221,071 | particle-php/Filter | src/FilterResource.php | FilterResource.decodeJSON | public function decodeJSON($assoc = true, $depth = 512, $options = 0)
{
return $this->addRule(new FilterRule\DecodeJSON($assoc, $depth, $options));
} | php | public function decodeJSON($assoc = true, $depth = 512, $options = 0)
{
return $this->addRule(new FilterRule\DecodeJSON($assoc, $depth, $options));
} | [
"public",
"function",
"decodeJSON",
"(",
"$",
"assoc",
"=",
"true",
",",
"$",
"depth",
"=",
"512",
",",
"$",
"options",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"addRule",
"(",
"new",
"FilterRule",
"\\",
"DecodeJSON",
"(",
"$",
"assoc",
",",
... | Returns rule that decodes JSON code of a given value
@param bool $assoc When `true`, decoded objects will be converted into associative arrays (the default value is
set to `true` because both Filter and Validator can't deal with objects)
@param int $depth Decode recursion dept
@param int $options Bitmask of JSON decod... | [
"Returns",
"rule",
"that",
"decodes",
"JSON",
"code",
"of",
"a",
"given",
"value"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterResource.php#L102-L105 |
221,072 | particle-php/Filter | src/FilterResource.php | FilterResource.encode | public function encode($toEncodingFormat = null, $fromEncodingFormat = null)
{
return $this->addRule(new FilterRule\Encode($toEncodingFormat, $fromEncodingFormat));
} | php | public function encode($toEncodingFormat = null, $fromEncodingFormat = null)
{
return $this->addRule(new FilterRule\Encode($toEncodingFormat, $fromEncodingFormat));
} | [
"public",
"function",
"encode",
"(",
"$",
"toEncodingFormat",
"=",
"null",
",",
"$",
"fromEncodingFormat",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addRule",
"(",
"new",
"FilterRule",
"\\",
"Encode",
"(",
"$",
"toEncodingFormat",
",",
"$",
"fro... | Returns rule that returns an value in a specific encoding format
@param string|null $toEncodingFormat
@param string|null $fromEncodingFormat
@return $this | [
"Returns",
"rule",
"that",
"returns",
"an",
"value",
"in",
"a",
"specific",
"encoding",
"format"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterResource.php#L136-L139 |
221,073 | particle-php/Filter | src/FilterResource.php | FilterResource.numberFormat | public function numberFormat($decimals, $decimalPoint, $thousandSeparator)
{
return $this->addRule(new FilterRule\NumberFormat($decimals, $decimalPoint, $thousandSeparator));
} | php | public function numberFormat($decimals, $decimalPoint, $thousandSeparator)
{
return $this->addRule(new FilterRule\NumberFormat($decimals, $decimalPoint, $thousandSeparator));
} | [
"public",
"function",
"numberFormat",
"(",
"$",
"decimals",
",",
"$",
"decimalPoint",
",",
"$",
"thousandSeparator",
")",
"{",
"return",
"$",
"this",
"->",
"addRule",
"(",
"new",
"FilterRule",
"\\",
"NumberFormat",
"(",
"$",
"decimals",
",",
"$",
"decimalPoi... | Returns rule that formats numbers
@param int $decimals
@param string $decimalPoint
@param string $thousandSeparator
@return $this | [
"Returns",
"rule",
"that",
"formats",
"numbers"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterResource.php#L189-L192 |
221,074 | particle-php/Filter | src/FilterRule/Upper.php | Upper.filter | public function filter($value)
{
if ($this->encodingFormat !== null) {
return mb_strtoupper($value, $this->encodingFormat);
}
return mb_strtoupper($value);
} | php | public function filter($value)
{
if ($this->encodingFormat !== null) {
return mb_strtoupper($value, $this->encodingFormat);
}
return mb_strtoupper($value);
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"encodingFormat",
"!==",
"null",
")",
"{",
"return",
"mb_strtoupper",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"encodingFormat",
")",
";",
"}",
"return",
"mb_s... | Uppercase the given value
@param mixed $value
@return string | [
"Uppercase",
"the",
"given",
"value"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterRule/Upper.php#L26-L33 |
221,075 | particle-php/Filter | src/Filter.php | Filter.addFilterRule | public function addFilterRule(FilterRule $rule, $key = null)
{
$this->getChain($key)->addRule($rule, $this->encodingFormat);
} | php | public function addFilterRule(FilterRule $rule, $key = null)
{
$this->getChain($key)->addRule($rule, $this->encodingFormat);
} | [
"public",
"function",
"addFilterRule",
"(",
"FilterRule",
"$",
"rule",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"getChain",
"(",
"$",
"key",
")",
"->",
"addRule",
"(",
"$",
"rule",
",",
"$",
"this",
"->",
"encodingFormat",
")",
";",... | Set a filter rule on a chain
@param FilterRule $rule
@param null|string $key | [
"Set",
"a",
"filter",
"rule",
"on",
"a",
"chain"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L99-L102 |
221,076 | particle-php/Filter | src/Filter.php | Filter.filter | public function filter(array $data)
{
$data = $this->filterArrayWithGlobalChain($data);
$this->data = new Container($data);
$this->filterChains();
return $this->data->getArrayCopy();
} | php | public function filter(array $data)
{
$data = $this->filterArrayWithGlobalChain($data);
$this->data = new Container($data);
$this->filterChains();
return $this->data->getArrayCopy();
} | [
"public",
"function",
"filter",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"filterArrayWithGlobalChain",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"data",
"=",
"new",
"Container",
"(",
"$",
"data",
")",
";",
"$",
... | Filter the provided data
@param array $data
@return array | [
"Filter",
"the",
"provided",
"data"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L110-L119 |
221,077 | particle-php/Filter | src/Filter.php | Filter.filterArrayWithGlobalChain | protected function filterArrayWithGlobalChain(array $data)
{
if ($this->globalChain === null) {
return $data;
}
foreach ($data as $key => $value) {
$data = $this->filterValueWithGlobalChain($value, $key, $data);
}
return array_filter($data);
} | php | protected function filterArrayWithGlobalChain(array $data)
{
if ($this->globalChain === null) {
return $data;
}
foreach ($data as $key => $value) {
$data = $this->filterValueWithGlobalChain($value, $key, $data);
}
return array_filter($data);
} | [
"protected",
"function",
"filterArrayWithGlobalChain",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"globalChain",
"===",
"null",
")",
"{",
"return",
"$",
"data",
";",
"}",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",... | Filter all set fields with a global chain, recursively
@param array $data
@return array | [
"Filter",
"all",
"set",
"fields",
"with",
"a",
"global",
"chain",
"recursively"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L127-L138 |
221,078 | particle-php/Filter | src/Filter.php | Filter.filterValueWithGlobalChain | protected function filterValueWithGlobalChain($value, $key, $data)
{
if (is_array($value)) {
$data[$key] = $this->filterArrayWithGlobalChain($value);
return $data;
}
$filterResult = $this->globalChain->filter(true, $value, $data);
if ($filterResult->isNotEmpt... | php | protected function filterValueWithGlobalChain($value, $key, $data)
{
if (is_array($value)) {
$data[$key] = $this->filterArrayWithGlobalChain($value);
return $data;
}
$filterResult = $this->globalChain->filter(true, $value, $data);
if ($filterResult->isNotEmpt... | [
"protected",
"function",
"filterValueWithGlobalChain",
"(",
"$",
"value",
",",
"$",
"key",
",",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"data",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"filterArrayWit... | Filters a value with the global chain
@param mixed $value
@param string $key
@param array $data
@return array | [
"Filters",
"a",
"value",
"with",
"the",
"global",
"chain"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L148-L162 |
221,079 | particle-php/Filter | src/Filter.php | Filter.getFilterResult | protected function getFilterResult($key, Chain $chain)
{
if ($this->data->has($key)) {
return $chain->filter(true, $this->data->get($key), $this->data->getArrayCopy());
}
return $chain->filter(false, null, $this->data->getArrayCopy());
} | php | protected function getFilterResult($key, Chain $chain)
{
if ($this->data->has($key)) {
return $chain->filter(true, $this->data->get($key), $this->data->getArrayCopy());
}
return $chain->filter(false, null, $this->data->getArrayCopy());
} | [
"protected",
"function",
"getFilterResult",
"(",
"$",
"key",
",",
"Chain",
"$",
"chain",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"chain",
"->",
"filter",
"(",
"true",
",",
"$",
"... | Get the filter result from a chain
@param string $key
@param Chain $chain
@return FilterResult | [
"Get",
"the",
"filter",
"result",
"from",
"a",
"chain"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L171-L178 |
221,080 | particle-php/Filter | src/Filter.php | Filter.filterChains | protected function filterChains()
{
foreach ($this->chains as $key => $chain) {
$filterResult = $this->getFilterResult($key, $chain);
if ($filterResult->isNotEmpty()) {
$this->data->set(
$key,
$filterResult->getFilteredValue()
... | php | protected function filterChains()
{
foreach ($this->chains as $key => $chain) {
$filterResult = $this->getFilterResult($key, $chain);
if ($filterResult->isNotEmpty()) {
$this->data->set(
$key,
$filterResult->getFilteredValue()
... | [
"protected",
"function",
"filterChains",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"chains",
"as",
"$",
"key",
"=>",
"$",
"chain",
")",
"{",
"$",
"filterResult",
"=",
"$",
"this",
"->",
"getFilterResult",
"(",
"$",
"key",
",",
"$",
"chain",
"... | Filter all chains set | [
"Filter",
"all",
"chains",
"set"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L183-L196 |
221,081 | particle-php/Filter | src/Filter.php | Filter.getChain | protected function getChain($key)
{
// If no key, set global chain
if ($key === null) {
return $this->getGlobalChain();
}
// Return chain for key
if (isset($this->chains[$key])) {
return $this->chains[$key];
}
return $this->chains[$key... | php | protected function getChain($key)
{
// If no key, set global chain
if ($key === null) {
return $this->getGlobalChain();
}
// Return chain for key
if (isset($this->chains[$key])) {
return $this->chains[$key];
}
return $this->chains[$key... | [
"protected",
"function",
"getChain",
"(",
"$",
"key",
")",
"{",
"// If no key, set global chain",
"if",
"(",
"$",
"key",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getGlobalChain",
"(",
")",
";",
"}",
"// Return chain for key",
"if",
"(",
"isset"... | Get a filter rule chain for a key
@param null|string $key
@return Chain | [
"Get",
"a",
"filter",
"rule",
"chain",
"for",
"a",
"key"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L204-L216 |
221,082 | particle-php/Filter | src/Filter.php | Filter.getGlobalChain | protected function getGlobalChain()
{
if ($this->globalChain === null) {
$this->globalChain = $this->buildChain();
}
return $this->globalChain;
} | php | protected function getGlobalChain()
{
if ($this->globalChain === null) {
$this->globalChain = $this->buildChain();
}
return $this->globalChain;
} | [
"protected",
"function",
"getGlobalChain",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"globalChain",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"globalChain",
"=",
"$",
"this",
"->",
"buildChain",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"... | Get the global chain for all values
@return Chain | [
"Get",
"the",
"global",
"chain",
"for",
"all",
"values"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Filter.php#L223-L229 |
221,083 | particle-php/Filter | src/Chain.php | Chain.filter | public function filter($isSet, $value = null, $filterData = null)
{
/** @var FilterRule $rule */
foreach ($this->rules as $rule) {
$rule->setFilterData($filterData);
if ($isSet || $rule->allowedNotSet()) {
$value = $rule->filter($value);
$isSe... | php | public function filter($isSet, $value = null, $filterData = null)
{
/** @var FilterRule $rule */
foreach ($this->rules as $rule) {
$rule->setFilterData($filterData);
if ($isSet || $rule->allowedNotSet()) {
$value = $rule->filter($value);
$isSe... | [
"public",
"function",
"filter",
"(",
"$",
"isSet",
",",
"$",
"value",
"=",
"null",
",",
"$",
"filterData",
"=",
"null",
")",
"{",
"/** @var FilterRule $rule */",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"rule",
")",
"{",
"$",
"rule",
"->"... | Execute all filters in the chain
@param bool $isSet
@param mixed $value
@param array|null $filterData
@return FilterResult
@throws ExpectFilterResultException | [
"Execute",
"all",
"filters",
"in",
"the",
"chain"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/Chain.php#L34-L47 |
221,084 | Mastercard/sdk-core-php | MasterCard/Core/Exception/ApiException.php | ApiException.describe | function describe() {
return get_class($this) . ": \""
. $this->getMessage() . "\" (http_status: "
. $this->getHttpStatus() . ", reason_code: "
. $this->getReasonCode() . ", source: "
. $this->getSource() . ")";
} | php | function describe() {
return get_class($this) . ": \""
. $this->getMessage() . "\" (http_status: "
. $this->getHttpStatus() . ", reason_code: "
. $this->getReasonCode() . ", source: "
. $this->getSource() . ")";
} | [
"function",
"describe",
"(",
")",
"{",
"return",
"get_class",
"(",
"$",
"this",
")",
".",
"\": \\\"\"",
".",
"$",
"this",
"->",
"getMessage",
"(",
")",
".",
"\"\\\" (http_status: \"",
".",
"$",
"this",
"->",
"getHttpStatus",
"(",
")",
".",
"\", reason_code... | Returns a description of the error.
@return string Description of the error. | [
"Returns",
"a",
"description",
"of",
"the",
"error",
"."
] | 4785426d649771aedd15bd498708e7995c78df8c | https://github.com/Mastercard/sdk-core-php/blob/4785426d649771aedd15bd498708e7995c78df8c/MasterCard/Core/Exception/ApiException.php#L135-L141 |
221,085 | valorin/deploy | src/Command/Deploy.php | Deploy.push | protected function push()
{
// Check if push is enabled
if (!Config::get('vdeploy::config.push')) {
return true;
}
passthru('git push', $code);
if ($code) {
$this->error("FAILED: git push");
return false;
}
passthru('git p... | php | protected function push()
{
// Check if push is enabled
if (!Config::get('vdeploy::config.push')) {
return true;
}
passthru('git push', $code);
if ($code) {
$this->error("FAILED: git push");
return false;
}
passthru('git p... | [
"protected",
"function",
"push",
"(",
")",
"{",
"// Check if push is enabled",
"if",
"(",
"!",
"Config",
"::",
"get",
"(",
"'vdeploy::config.push'",
")",
")",
"{",
"return",
"true",
";",
"}",
"passthru",
"(",
"'git push'",
",",
"$",
"code",
")",
";",
"if",... | Runs the push, if requested
@return boolean | [
"Runs",
"the",
"push",
"if",
"requested"
] | f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00 | https://github.com/valorin/deploy/blob/f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00/src/Command/Deploy.php#L91-L111 |
221,086 | valorin/deploy | src/Command/Deploy.php | Deploy.production | protected function production()
{
// Check if push is enabled
if (!Config::get('vdeploy::config.production.enabled')) {
return true;
}
// Check for production
$remote = $this->argument('remote');
if ($remote != Config::get('vdeploy::config.production.name... | php | protected function production()
{
// Check if push is enabled
if (!Config::get('vdeploy::config.production.enabled')) {
return true;
}
// Check for production
$remote = $this->argument('remote');
if ($remote != Config::get('vdeploy::config.production.name... | [
"protected",
"function",
"production",
"(",
")",
"{",
"// Check if push is enabled",
"if",
"(",
"!",
"Config",
"::",
"get",
"(",
"'vdeploy::config.production.enabled'",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Check for production",
"$",
"remote",
"=",
"$",
... | Runs the production code, if requested
@return boolean | [
"Runs",
"the",
"production",
"code",
"if",
"requested"
] | f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00 | https://github.com/valorin/deploy/blob/f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00/src/Command/Deploy.php#L118-L171 |
221,087 | valorin/deploy | src/Command/Deploy.php | Deploy.incrementTag | protected function incrementTag($current, $major, $minor, $patch, $preRelease, $preIncrement)
{
// Current version
$this->line('');
$this->info("The current release version is: {$current}.");
// Simple options
$tag['major'] = 'v'.($major+1).'.0.0';
$tag['minor'] = "v... | php | protected function incrementTag($current, $major, $minor, $patch, $preRelease, $preIncrement)
{
// Current version
$this->line('');
$this->info("The current release version is: {$current}.");
// Simple options
$tag['major'] = 'v'.($major+1).'.0.0';
$tag['minor'] = "v... | [
"protected",
"function",
"incrementTag",
"(",
"$",
"current",
",",
"$",
"major",
",",
"$",
"minor",
",",
"$",
"patch",
",",
"$",
"preRelease",
",",
"$",
"preIncrement",
")",
"{",
"// Current version",
"$",
"this",
"->",
"line",
"(",
"''",
")",
";",
"$"... | Increments the tag, based on argument or user input
@param string $current
@param integer $major
@param integer $minor
@param integer $patch
@param sting $preRelease
@param integer $preIncrement
@return string | [
"Increments",
"the",
"tag",
"based",
"on",
"argument",
"or",
"user",
"input"
] | f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00 | https://github.com/valorin/deploy/blob/f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00/src/Command/Deploy.php#L184-L223 |
221,088 | valorin/deploy | src/Command/Deploy.php | Deploy.runCommands | protected function runCommands()
{
// Load Remote directory
$remote = $this->argument('remote');
$directory = Config::get('remote.connections.'.$remote.'.root');
// Define commands
$commands = array_merge(['cd '.$directory], Config::get('vdeploy::config.commands'));
... | php | protected function runCommands()
{
// Load Remote directory
$remote = $this->argument('remote');
$directory = Config::get('remote.connections.'.$remote.'.root');
// Define commands
$commands = array_merge(['cd '.$directory], Config::get('vdeploy::config.commands'));
... | [
"protected",
"function",
"runCommands",
"(",
")",
"{",
"// Load Remote directory",
"$",
"remote",
"=",
"$",
"this",
"->",
"argument",
"(",
"'remote'",
")",
";",
"$",
"directory",
"=",
"Config",
"::",
"get",
"(",
"'remote.connections.'",
".",
"$",
"remote",
"... | Runs the SSH commands on the remote
@return boolean | [
"Runs",
"the",
"SSH",
"commands",
"on",
"the",
"remote"
] | f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00 | https://github.com/valorin/deploy/blob/f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00/src/Command/Deploy.php#L230-L249 |
221,089 | valorin/deploy | src/Command/Deploy.php | Deploy.parseTags | protected function parseTags(&$command)
{
// Recurse?
if (is_array($command)) {
foreach ($command as &$cmd) {
if (!$this->parseTags($cmd)) {
return false;
}
}
return true;
}
// Look for tags
... | php | protected function parseTags(&$command)
{
// Recurse?
if (is_array($command)) {
foreach ($command as &$cmd) {
if (!$this->parseTags($cmd)) {
return false;
}
}
return true;
}
// Look for tags
... | [
"protected",
"function",
"parseTags",
"(",
"&",
"$",
"command",
")",
"{",
"// Recurse?",
"if",
"(",
"is_array",
"(",
"$",
"command",
")",
")",
"{",
"foreach",
"(",
"$",
"command",
"as",
"&",
"$",
"cmd",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
... | Parses the user tags in the commands array
@param string|string[] $command
@return boolean | [
"Parses",
"the",
"user",
"tags",
"in",
"the",
"commands",
"array"
] | f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00 | https://github.com/valorin/deploy/blob/f1a2a0c9d4fdfd91250f6f3af616d0c964c2aa00/src/Command/Deploy.php#L257-L296 |
221,090 | particle-php/Filter | src/FilterRule/Slug.php | Slug.filter | public function filter($value)
{
if (empty($value) && isset($this->filterData[$this->fieldToSlugFrom])) {
$value = $this->filterData[$this->fieldToSlugFrom];
}
if (is_null($value)) {
return $this->setEmpty();
}
$value = transliterator_transliterate($... | php | public function filter($value)
{
if (empty($value) && isset($this->filterData[$this->fieldToSlugFrom])) {
$value = $this->filterData[$this->fieldToSlugFrom];
}
if (is_null($value)) {
return $this->setEmpty();
}
$value = transliterator_transliterate($... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"filterData",
"[",
"$",
"this",
"->",
"fieldToSlugFrom",
"]",
")",
")",
"{",
"$",
"value",
"=",
"$",
"... | Slug the value of either the actual field of the given one.
@param mixed $value
@return string | [
"Slug",
"the",
"value",
"of",
"either",
"the",
"actual",
"field",
"of",
"the",
"given",
"one",
"."
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterRule/Slug.php#L51-L66 |
221,091 | particle-php/Filter | src/FilterRule/Cut.php | Cut.filter | public function filter($value)
{
if ($this->encodingFormat !== null) {
return mb_substr($value, $this->start, $this->length, $this->encodingFormat);
}
return mb_substr($value, $this->start, $this->length);
} | php | public function filter($value)
{
if ($this->encodingFormat !== null) {
return mb_substr($value, $this->start, $this->length, $this->encodingFormat);
}
return mb_substr($value, $this->start, $this->length);
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"encodingFormat",
"!==",
"null",
")",
"{",
"return",
"mb_substr",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"start",
",",
"$",
"this",
"->",
"length",
",",
... | Cuts the given value
@param mixed $value
@return string | [
"Cuts",
"the",
"given",
"value"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterRule/Cut.php#L46-L53 |
221,092 | particle-php/Filter | src/FilterRule/Each.php | Each.filter | public function filter($values)
{
if (is_array($values)) {
foreach ($values as $key => $value) {
$values[$key] = $this->filterValue($value);
}
}
return $values;
} | php | public function filter($values)
{
if (is_array($values)) {
foreach ($values as $key => $value) {
$values[$key] = $this->filterValue($value);
}
}
return $values;
} | [
"public",
"function",
"filter",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"values",
"[",
"$",
"key",
"]",
"=",
"$"... | When provided with an array, the callback filter will be executed for every value
@param mixed $values
@return array | [
"When",
"provided",
"with",
"an",
"array",
"the",
"callback",
"filter",
"will",
"be",
"executed",
"for",
"every",
"value"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterRule/Each.php#L40-L49 |
221,093 | particle-php/Filter | src/FilterRule/Each.php | Each.filterValue | protected function filterValue($value)
{
$filter = new Filter();
call_user_func($this->callable, $filter);
return $filter->filter($value);
} | php | protected function filterValue($value)
{
$filter = new Filter();
call_user_func($this->callable, $filter);
return $filter->filter($value);
} | [
"protected",
"function",
"filterValue",
"(",
"$",
"value",
")",
"{",
"$",
"filter",
"=",
"new",
"Filter",
"(",
")",
";",
"call_user_func",
"(",
"$",
"this",
"->",
"callable",
",",
"$",
"filter",
")",
";",
"return",
"$",
"filter",
"->",
"filter",
"(",
... | Filter a given value with a new filter instance in a callable
@param $value
@return array | [
"Filter",
"a",
"given",
"value",
"with",
"a",
"new",
"filter",
"instance",
"in",
"a",
"callable"
] | 49ba23accb1eb0342438e49258a54ed4e3f3335e | https://github.com/particle-php/Filter/blob/49ba23accb1eb0342438e49258a54ed4e3f3335e/src/FilterRule/Each.php#L57-L64 |
221,094 | Mastercard/sdk-core-php | MasterCard/Core/ApiController.php | ApiController.getUrl | public function getUrl($operationConfig, $operationMetadata, &$inputMap) {
$queryParams = array();
$action = $operationConfig->getAction();
$resourcePath = $operationConfig->getResourcePath();
$queryList = $operationConfig->getQueryParams();
$resolvedHostUrl = $operatio... | php | public function getUrl($operationConfig, $operationMetadata, &$inputMap) {
$queryParams = array();
$action = $operationConfig->getAction();
$resourcePath = $operationConfig->getResourcePath();
$queryList = $operationConfig->getQueryParams();
$resolvedHostUrl = $operatio... | [
"public",
"function",
"getUrl",
"(",
"$",
"operationConfig",
",",
"$",
"operationMetadata",
",",
"&",
"$",
"inputMap",
")",
"{",
"$",
"queryParams",
"=",
"array",
"(",
")",
";",
"$",
"action",
"=",
"$",
"operationConfig",
"->",
"getAction",
"(",
")",
";"... | This method generated the URL
@param type $operationConfig
@param type $operationMetadata
@param type $inputMap
@return type | [
"This",
"method",
"generated",
"the",
"URL"
] | 4785426d649771aedd15bd498708e7995c78df8c | https://github.com/Mastercard/sdk-core-php/blob/4785426d649771aedd15bd498708e7995c78df8c/MasterCard/Core/ApiController.php#L115-L184 |
221,095 | Mastercard/sdk-core-php | MasterCard/Core/ApiController.php | ApiController.getRequest | public function getRequest($operationConfig, $operationMetadata, &$inputMap) {
$action = $operationConfig->getAction();
$resourcePath = $operationConfig->getResourcePath();
$headerList = $operationConfig->getHeaderParams();
$queryList = $operationConfig->getQueryParams();
... | php | public function getRequest($operationConfig, $operationMetadata, &$inputMap) {
$action = $operationConfig->getAction();
$resourcePath = $operationConfig->getResourcePath();
$headerList = $operationConfig->getHeaderParams();
$queryList = $operationConfig->getQueryParams();
... | [
"public",
"function",
"getRequest",
"(",
"$",
"operationConfig",
",",
"$",
"operationMetadata",
",",
"&",
"$",
"inputMap",
")",
"{",
"$",
"action",
"=",
"$",
"operationConfig",
"->",
"getAction",
"(",
")",
";",
"$",
"resourcePath",
"=",
"$",
"operationConfig... | This is the function that returns a Request object
@param type $operationConfig
@param type $operationMetadata
@param type $inputMap
@return type | [
"This",
"is",
"the",
"function",
"that",
"returns",
"a",
"Request",
"object"
] | 4785426d649771aedd15bd498708e7995c78df8c | https://github.com/Mastercard/sdk-core-php/blob/4785426d649771aedd15bd498708e7995c78df8c/MasterCard/Core/ApiController.php#L206-L266 |
221,096 | Mastercard/sdk-core-php | MasterCard/Core/ApiController.php | ApiController.execute | public function execute($operationConfig, $operationMetadata, $inputMap) {
$request = $this->getRequest($operationConfig, $operationMetadata, $inputMap);
try {
$response = $this->client->send($request, array_merge(ApiConfig::getProxy(), ApiConfig::getTimeout()));
$statusCode = $... | php | public function execute($operationConfig, $operationMetadata, $inputMap) {
$request = $this->getRequest($operationConfig, $operationMetadata, $inputMap);
try {
$response = $this->client->send($request, array_merge(ApiConfig::getProxy(), ApiConfig::getTimeout()));
$statusCode = $... | [
"public",
"function",
"execute",
"(",
"$",
"operationConfig",
",",
"$",
"operationMetadata",
",",
"$",
"inputMap",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
"$",
"operationConfig",
",",
"$",
"operationMetadata",
",",
"$",
"inputMap... | This function executes the request
@param type $operationConfig
@param type $operationMetadata
@param type $inputMap
@return type
@throws SystemException | [
"This",
"function",
"executes",
"the",
"request"
] | 4785426d649771aedd15bd498708e7995c78df8c | https://github.com/Mastercard/sdk-core-php/blob/4785426d649771aedd15bd498708e7995c78df8c/MasterCard/Core/ApiController.php#L276-L313 |
221,097 | christiaan/InlineStyle | InlineStyle/InlineStyle.php | InlineStyle.loadDomDocument | public function loadDomDocument(\DOMDocument $domDocument)
{
$this->_dom = $domDocument;
foreach ($this->_getNodesForCssSelector('[style]') as $node) {
$node->setAttribute(
'inlinestyle-original-style',
$node->getAttribute('style')
);
}... | php | public function loadDomDocument(\DOMDocument $domDocument)
{
$this->_dom = $domDocument;
foreach ($this->_getNodesForCssSelector('[style]') as $node) {
$node->setAttribute(
'inlinestyle-original-style',
$node->getAttribute('style')
);
}... | [
"public",
"function",
"loadDomDocument",
"(",
"\\",
"DOMDocument",
"$",
"domDocument",
")",
"{",
"$",
"this",
"->",
"_dom",
"=",
"$",
"domDocument",
";",
"foreach",
"(",
"$",
"this",
"->",
"_getNodesForCssSelector",
"(",
"'[style]'",
")",
"as",
"$",
"node",
... | Load the HTML as a DOMDocument directly
@param \DOMDocument $domDocument | [
"Load",
"the",
"HTML",
"as",
"a",
"DOMDocument",
"directly"
] | 9c408760465f4e3ef2b5fb08cb6995e3233afa98 | https://github.com/christiaan/InlineStyle/blob/9c408760465f4e3ef2b5fb08cb6995e3233afa98/InlineStyle/InlineStyle.php#L92-L101 |
221,098 | christiaan/InlineStyle | InlineStyle/InlineStyle.php | InlineStyle.applyStylesheet | public function applyStylesheet($stylesheet)
{
$stylesheet = (array) $stylesheet;
foreach($stylesheet as $ss) {
$parsed = $this->parseStylesheet($ss);
$parsed = $this->sortSelectorsOnSpecificity($parsed);
foreach($parsed as $arr) {
list($selector, ... | php | public function applyStylesheet($stylesheet)
{
$stylesheet = (array) $stylesheet;
foreach($stylesheet as $ss) {
$parsed = $this->parseStylesheet($ss);
$parsed = $this->sortSelectorsOnSpecificity($parsed);
foreach($parsed as $arr) {
list($selector, ... | [
"public",
"function",
"applyStylesheet",
"(",
"$",
"stylesheet",
")",
"{",
"$",
"stylesheet",
"=",
"(",
"array",
")",
"$",
"stylesheet",
";",
"foreach",
"(",
"$",
"stylesheet",
"as",
"$",
"ss",
")",
"{",
"$",
"parsed",
"=",
"$",
"this",
"->",
"parseSty... | Applies one or more stylesheets to the current document
@param string|string[] $stylesheet
@return InlineStyle self | [
"Applies",
"one",
"or",
"more",
"stylesheets",
"to",
"the",
"current",
"document"
] | 9c408760465f4e3ef2b5fb08cb6995e3233afa98 | https://github.com/christiaan/InlineStyle/blob/9c408760465f4e3ef2b5fb08cb6995e3233afa98/InlineStyle/InlineStyle.php#L109-L122 |
221,099 | christiaan/InlineStyle | InlineStyle/InlineStyle.php | InlineStyle.applyRule | public function applyRule($selector, $style)
{
if($selector) {
$nodes = $this->_getNodesForCssSelector($selector);
$style = $this->_styleToArray($style);
foreach($nodes as $node) {
$current = $node->hasAttribute("style") ?
$this->_styl... | php | public function applyRule($selector, $style)
{
if($selector) {
$nodes = $this->_getNodesForCssSelector($selector);
$style = $this->_styleToArray($style);
foreach($nodes as $node) {
$current = $node->hasAttribute("style") ?
$this->_styl... | [
"public",
"function",
"applyRule",
"(",
"$",
"selector",
",",
"$",
"style",
")",
"{",
"if",
"(",
"$",
"selector",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_getNodesForCssSelector",
"(",
"$",
"selector",
")",
";",
"$",
"style",
"=",
"$",
"this... | Applies a style rule on the document
@param string $selector
@param string $style
@return InlineStyle self | [
"Applies",
"a",
"style",
"rule",
"on",
"the",
"document"
] | 9c408760465f4e3ef2b5fb08cb6995e3233afa98 | https://github.com/christiaan/InlineStyle/blob/9c408760465f4e3ef2b5fb08cb6995e3233afa98/InlineStyle/InlineStyle.php#L153-L171 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.