repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/Match.php | Match.addPlayerInTeam | function addPlayerInTeam($login, $teamId)
{
switch($teamId)
{
case 0:
if(array_search($login, $this->team2))
{
throw new \InvalidArgumentException();
}
if(!array_search($login, $this->team1))
{
$this->team1[] = $login;
}
break;
case 1:
if(array_search($login, $this->... | php | function addPlayerInTeam($login, $teamId)
{
switch($teamId)
{
case 0:
if(array_search($login, $this->team2))
{
throw new \InvalidArgumentException();
}
if(!array_search($login, $this->team1))
{
$this->team1[] = $login;
}
break;
case 1:
if(array_search($login, $this->... | [
"function",
"addPlayerInTeam",
"(",
"$",
"login",
",",
"$",
"teamId",
")",
"{",
"switch",
"(",
"$",
"teamId",
")",
"{",
"case",
"0",
":",
"if",
"(",
"array_search",
"(",
"$",
"login",
",",
"$",
"this",
"->",
"team2",
")",
")",
"{",
"throw",
"new",
... | add a login in a team, throw an exception if the login is already teamed or if the team does not exist
@param string $login
@param int $teamId
@throws \InvalidArgumentException | [
"add",
"a",
"login",
"in",
"a",
"team",
"throw",
"an",
"exception",
"if",
"the",
"login",
"is",
"already",
"teamed",
"or",
"if",
"the",
"team",
"does",
"not",
"exist"
] | train | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/Match.php#L112-L139 |
accgit/single-web | src/Single/Configurator.php | Configurator.enableTracy | public function enableTracy($logDirectory = null, $email = null)
{
Tracy\Debugger::$strictMode = true;
Tracy\Debugger::enable($this->mode, $logDirectory, $email);
} | php | public function enableTracy($logDirectory = null, $email = null)
{
Tracy\Debugger::$strictMode = true;
Tracy\Debugger::enable($this->mode, $logDirectory, $email);
} | [
"public",
"function",
"enableTracy",
"(",
"$",
"logDirectory",
"=",
"null",
",",
"$",
"email",
"=",
"null",
")",
"{",
"Tracy",
"\\",
"Debugger",
"::",
"$",
"strictMode",
"=",
"true",
";",
"Tracy",
"\\",
"Debugger",
"::",
"enable",
"(",
"$",
"this",
"->... | Enable Tracy Tools.
@param string $logDirectory
@param string $email | [
"Enable",
"Tracy",
"Tools",
"."
] | train | https://github.com/accgit/single-web/blob/5d0dce3313df9e22ab60749bcf01f1753de8c143/src/Single/Configurator.php#L52-L56 |
accgit/single-web | src/Single/Configurator.php | Configurator.createAutoload | public function createAutoload($path)
{
$loader = new Loaders\RobotLoader;
$loader->setCacheStorage(new Caching\Storages\FileStorage($this->temp));
$loader->addDirectory($path)->register();
return $loader;
} | php | public function createAutoload($path)
{
$loader = new Loaders\RobotLoader;
$loader->setCacheStorage(new Caching\Storages\FileStorage($this->temp));
$loader->addDirectory($path)->register();
return $loader;
} | [
"public",
"function",
"createAutoload",
"(",
"$",
"path",
")",
"{",
"$",
"loader",
"=",
"new",
"Loaders",
"\\",
"RobotLoader",
";",
"$",
"loader",
"->",
"setCacheStorage",
"(",
"new",
"Caching",
"\\",
"Storages",
"\\",
"FileStorage",
"(",
"$",
"this",
"->"... | Autoloading classes.
@param string|array $path
@return Loaders\RobotLoader | [
"Autoloading",
"classes",
"."
] | train | https://github.com/accgit/single-web/blob/5d0dce3313df9e22ab60749bcf01f1753de8c143/src/Single/Configurator.php#L63-L69 |
JeanWolf/yii2-jrbac | src/JDbManager.php | JDbManager.isRoot | public function isRoot()
{
if(\Yii::$app->getUser()->getIsGuest()) return false;
$user = \Yii::$app->getUser()->getIdentity();
if($user->getId() == 1) return true;
$auth = \Yii::$app->getAuthManager();
$roles = $auth->getRolesByUser($user->getId());
$roleNames = Array... | php | public function isRoot()
{
if(\Yii::$app->getUser()->getIsGuest()) return false;
$user = \Yii::$app->getUser()->getIdentity();
if($user->getId() == 1) return true;
$auth = \Yii::$app->getAuthManager();
$roles = $auth->getRolesByUser($user->getId());
$roleNames = Array... | [
"public",
"function",
"isRoot",
"(",
")",
"{",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getUser",
"(",
")",
"->",
"getIsGuest",
"(",
")",
")",
"return",
"false",
";",
"$",
"user",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getUser",
"(",
... | 类|方法 文档属性 eg: /** @jrbac 权限名称 | [
"类|方法",
"文档属性",
"eg:",
"/",
"**"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/src/JDbManager.php#L28-L37 |
anime-db/app-bundle | src/Command/ProposeUpdateCommand.php | ProposeUpdateCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$root = $this->getContainer()->getParameter('kernel.root_dir').'/../';
$time = filemtime($root.'composer.json');
if (file_exists($root.'composer.lock')) {
$time = max($time, filemtime($root.'composer.lo... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$root = $this->getContainer()->getParameter('kernel.root_dir').'/../';
$time = filemtime($root.'composer.json');
if (file_exists($root.'composer.lock')) {
$time = max($time, filemtime($root.'composer.lo... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"root",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"getParameter",
"(",
"'kernel.root_dir'",
")",
".",
"'/../'",
";",
... | @param InputInterface $input
@param OutputInterface $output
@return bool | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Command/ProposeUpdateCommand.php#L51-L77 |
fsi-open/doctrine-extensions-bundle | DependencyInjection/FSIDoctrineExtensionsExtension.php | FSIDoctrineExtensionsExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('s... | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('s... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"con... | {@inheritdoc} | [
"{"
] | train | https://github.com/fsi-open/doctrine-extensions-bundle/blob/1b9c01e0b216b2c1b2af087de233abbf3c84b9fe/DependencyInjection/FSIDoctrineExtensionsExtension.php#L25-L37 |
qcubed/orm | src/Query/ModelTrait.php | ModelTrait.buildQueryStatement | protected static function buildQueryStatement(
&$objQueryBuilder,
iCondition $objConditions,
$objOptionalClauses,
$mixParameterArray,
$blnCountOnly
) {
// Get the Database Object for this Class
$objDatabase = static::getDatabase();
$strTableName = stat... | php | protected static function buildQueryStatement(
&$objQueryBuilder,
iCondition $objConditions,
$objOptionalClauses,
$mixParameterArray,
$blnCountOnly
) {
// Get the Database Object for this Class
$objDatabase = static::getDatabase();
$strTableName = stat... | [
"protected",
"static",
"function",
"buildQueryStatement",
"(",
"&",
"$",
"objQueryBuilder",
",",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
",",
"$",
"mixParameterArray",
",",
"$",
"blnCountOnly",
")",
"{",
"// Get the Database Object for this C... | Takes a query builder object and outputs the sql query that corresponds to its structure and the given parameters.
@param Builder &$objQueryBuilder the QueryBuilder object that will be created
@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional ... | [
"Takes",
"a",
"query",
"builder",
"object",
"and",
"outputs",
"the",
"sql",
"query",
"that",
"corresponds",
"to",
"its",
"structure",
"and",
"the",
"given",
"parameters",
"."
] | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L89-L199 |
qcubed/orm | src/Query/ModelTrait.php | ModelTrait._QuerySingle | protected static function _QuerySingle(
iCondition $objConditions,
$objOptionalClauses = null,
$mixParameterArray = null
) {
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
... | php | protected static function _QuerySingle(
iCondition $objConditions,
$objOptionalClauses = null,
$mixParameterArray = null
) {
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
... | [
"protected",
"static",
"function",
"_QuerySingle",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the Query Statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",... | Static Qcubed Query method to query for a single <?php echo $objTable->ClassName ?> object.
Uses BuildQueryStatment to perform most of the work.
Is called by QuerySincle function of each object so that the correct return type will be put in the comments.
@param iCondition $objConditions any conditions on the query, i... | [
"Static",
"Qcubed",
"Query",
"method",
"to",
"query",
"for",
"a",
"single",
"<?php",
"echo",
"$objTable",
"-",
">",
"ClassName",
"?",
">",
"object",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
".",
"Is",
"called",
"by",... | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L213-L261 |
qcubed/orm | src/Query/ModelTrait.php | ModelTrait._QueryArray | protected static function _QueryArray(
iCondition $objConditions,
$objOptionalClauses = null,
$mixParameterArray = null
) {
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
... | php | protected static function _QueryArray(
iCondition $objConditions,
$objOptionalClauses = null,
$mixParameterArray = null
) {
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
... | [
"protected",
"static",
"function",
"_QueryArray",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the Query Statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",
... | Static Qcubed Query method to query for an array of objects.
Uses BuildQueryStatment to perform most of the work.
Is called by QueryArray function of each object so that the correct return type will be put in the comments.
@param iCondition $objConditions any conditions on the query, itself
@param iClause[]|null $objO... | [
"Static",
"Qcubed",
"Query",
"method",
"to",
"query",
"for",
"an",
"array",
"of",
"objects",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
".",
"Is",
"called",
"by",
"QueryArray",
"function",
"of",
"each",
"object",
"so",
... | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L274-L292 |
qcubed/orm | src/Query/ModelTrait.php | ModelTrait.queryCursor | public static function queryCursor(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the query statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, false... | php | public static function queryCursor(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the query statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, false... | [
"public",
"static",
"function",
"queryCursor",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the query statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",
"... | Static Qcubed query method to issue a query and get a cursor to progressively fetch its results.
Uses BuildQueryStatment to perform most of the work.
@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional iClause objects for this query
@param mixed... | [
"Static",
"Qcubed",
"query",
"method",
"to",
"issue",
"a",
"query",
"and",
"get",
"a",
"cursor",
"to",
"progressively",
"fetch",
"its",
"results",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
"."
] | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L305-L328 |
qcubed/orm | src/Query/ModelTrait.php | ModelTrait.queryCount | public static function queryCount(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, true);... | php | public static function queryCount(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, true);... | [
"public",
"static",
"function",
"queryCount",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the Query Statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",
":... | Static Qcubed Query method to query for a count of objects.
Uses BuildQueryStatment to perform most of the work.
@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional iClause objects for this query
@param mixed[] $mixParameterArray a array of name... | [
"Static",
"Qcubed",
"Query",
"method",
"to",
"query",
"for",
"a",
"count",
"of",
"objects",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
"."
] | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L340-L384 |
qcubed/orm | src/Query/ModelTrait.php | ModelTrait.expandArray | public static function expandArray(
$objDbRow,
$strAliasPrefix,
$objNode,
$objPreviousItemArray,
$strColumnAliasArray
) {
if (!$objNode->ChildNodeArray) {
return null;
}
$blnExpanded = null;
$pk = static::getRowPrimaryKey($objDbRow... | php | public static function expandArray(
$objDbRow,
$strAliasPrefix,
$objNode,
$objPreviousItemArray,
$strColumnAliasArray
) {
if (!$objNode->ChildNodeArray) {
return null;
}
$blnExpanded = null;
$pk = static::getRowPrimaryKey($objDbRow... | [
"public",
"static",
"function",
"expandArray",
"(",
"$",
"objDbRow",
",",
"$",
"strAliasPrefix",
",",
"$",
"objNode",
",",
"$",
"objPreviousItemArray",
",",
"$",
"strColumnAliasArray",
")",
"{",
"if",
"(",
"!",
"$",
"objNode",
"->",
"ChildNodeArray",
")",
"{... | Do a possible array expansion on the given node. If the node is an ExpandAsArray node,
it will add to the corresponding array in the object. Otherwise, it will follow the node
so that any leaf expansions can be handled.
@param \QCubed\Database\RowBase $objDbRow
@param string $strAliasPrefix
@param Node\NodeBase $objNo... | [
"Do",
"a",
"possible",
"array",
"expansion",
"on",
"the",
"given",
"node",
".",
"If",
"the",
"node",
"is",
"an",
"ExpandAsArray",
"node",
"it",
"will",
"add",
"to",
"the",
"corresponding",
"array",
"in",
"the",
"object",
".",
"Otherwise",
"it",
"will",
"... | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L416-L498 |
netgen/ngopengraph | classes/ngopengraphgmaplocation.php | ngOpenGraphGmapLocation.getData | public function getData()
{
$latitude = trim( $this->ContentObjectAttribute->attribute( 'content' )->attribute( 'latitude' ) );
$longitude = trim( $this->ContentObjectAttribute->attribute( 'content' )->attribute( 'longitude' ) );
return $latitude . ',' . $longitude;
} | php | public function getData()
{
$latitude = trim( $this->ContentObjectAttribute->attribute( 'content' )->attribute( 'latitude' ) );
$longitude = trim( $this->ContentObjectAttribute->attribute( 'content' )->attribute( 'longitude' ) );
return $latitude . ',' . $longitude;
} | [
"public",
"function",
"getData",
"(",
")",
"{",
"$",
"latitude",
"=",
"trim",
"(",
"$",
"this",
"->",
"ContentObjectAttribute",
"->",
"attribute",
"(",
"'content'",
")",
"->",
"attribute",
"(",
"'latitude'",
")",
")",
";",
"$",
"longitude",
"=",
"trim",
... | Returns data for the attribute
@return string | [
"Returns",
"data",
"for",
"the",
"attribute"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/classes/ngopengraphgmaplocation.php#L10-L15 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.initDoctrine | protected function initDoctrine()
{
try {
$this->doctrine = $this->db->getDoctrineSchemaManager();
$platform = $this->doctrine->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
$platform->registerDoctrineTypeMapping('json', 'json_array');
$this->connection = tru... | php | protected function initDoctrine()
{
try {
$this->doctrine = $this->db->getDoctrineSchemaManager();
$platform = $this->doctrine->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
$platform->registerDoctrineTypeMapping('json', 'json_array');
$this->connection = tru... | [
"protected",
"function",
"initDoctrine",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"doctrine",
"=",
"$",
"this",
"->",
"db",
"->",
"getDoctrineSchemaManager",
"(",
")",
";",
"$",
"platform",
"=",
"$",
"this",
"->",
"doctrine",
"->",
"getDatabasePlatfor... | initialize doctrine
@param
@return void | [
"initialize",
"doctrine"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L61-L74 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.scanDatabase | protected function scanDatabase()
{
if ($this->isConnected()) {
$tables = $this->doctrine->listTableNames();
foreach ($tables as $table) {
$schTable = $this->doctrine->listTableDetails($table);
$this->tables[$table] = $this->getTableFields($schTable);
}
}
} | php | protected function scanDatabase()
{
if ($this->isConnected()) {
$tables = $this->doctrine->listTableNames();
foreach ($tables as $table) {
$schTable = $this->doctrine->listTableDetails($table);
$this->tables[$table] = $this->getTableFields($schTable);
}
}
} | [
"protected",
"function",
"scanDatabase",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isConnected",
"(",
")",
")",
"{",
"$",
"tables",
"=",
"$",
"this",
"->",
"doctrine",
"->",
"listTableNames",
"(",
")",
";",
"foreach",
"(",
"$",
"tables",
"as",
"$... | scan database
@return void | [
"scan",
"database"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L81-L92 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.getTableFields | protected function getTableFields(Table $table)
{
$fileds = [];
foreach ($table->getColumns() as $column) {
$fileds[] = [
'name' => $column->getName(),
'type' => $column->getType()->getName(),
'not_null' => $column->getNotnull(),
'length' => $column->getLengt... | php | protected function getTableFields(Table $table)
{
$fileds = [];
foreach ($table->getColumns() as $column) {
$fileds[] = [
'name' => $column->getName(),
'type' => $column->getType()->getName(),
'not_null' => $column->getNotnull(),
'length' => $column->getLengt... | [
"protected",
"function",
"getTableFields",
"(",
"Table",
"$",
"table",
")",
"{",
"$",
"fileds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"table",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"$",
"fileds",
"[",
"]",
"=",
"[",
"'name... | get database fileds
@param Table $table
@return array | [
"get",
"database",
"fileds"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L100-L118 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.isPrimaryKey | protected function isPrimaryKey(Table $table, Column $column)
{
if ($table->hasPrimaryKey()) {
$primaryKeys = $table->getPrimaryKey()->getColumns();
return in_array($column->getName(), $primaryKeys);
}
return false;
} | php | protected function isPrimaryKey(Table $table, Column $column)
{
if ($table->hasPrimaryKey()) {
$primaryKeys = $table->getPrimaryKey()->getColumns();
return in_array($column->getName(), $primaryKeys);
}
return false;
} | [
"protected",
"function",
"isPrimaryKey",
"(",
"Table",
"$",
"table",
",",
"Column",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"table",
"->",
"hasPrimaryKey",
"(",
")",
")",
"{",
"$",
"primaryKeys",
"=",
"$",
"table",
"->",
"getPrimaryKey",
"(",
")",
"->... | check is column primary key
@param Table $table
@param Column $column
@return bool | [
"check",
"is",
"column",
"primary",
"key"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L127-L136 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.isForeignKey | protected function isForeignKey(Table $table, Column $column)
{
$foreignKey = false;
foreach ($table->getIndexes() as $key => $index) {
if ($key !== 'primary') {
try {
$fkConstrain = $table->getForeignkey($key);
$foreignKey = in_array($column->getName(), $fkConstrain->getColumns());
} catch (... | php | protected function isForeignKey(Table $table, Column $column)
{
$foreignKey = false;
foreach ($table->getIndexes() as $key => $index) {
if ($key !== 'primary') {
try {
$fkConstrain = $table->getForeignkey($key);
$foreignKey = in_array($column->getName(), $fkConstrain->getColumns());
} catch (... | [
"protected",
"function",
"isForeignKey",
"(",
"Table",
"$",
"table",
",",
"Column",
"$",
"column",
")",
"{",
"$",
"foreignKey",
"=",
"false",
";",
"foreach",
"(",
"$",
"table",
"->",
"getIndexes",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"index",
")",
... | check is column foreign key
@param Table $table
@param Column $column
@return bool | [
"check",
"is",
"column",
"foreign",
"key"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L145-L161 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.getFields | public function getFields($table)
{
if (isset($this->tables[$table])) {
return new Collection($this->tables[$table]);
}
} | php | public function getFields($table)
{
if (isset($this->tables[$table])) {
return new Collection($this->tables[$table]);
}
} | [
"public",
"function",
"getFields",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"new",
"Collection",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"table",
"]",
... | get table fields
@param string $table
@return array | [
"get",
"table",
"fields"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L189-L194 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.isFieldExists | public function isFieldExists($table, $field)
{
if (isset($this->tables[$table])) {
$fields = $this->getFields($table);
return $fields->where('name', $field)->count() > 0;
}
return false;
} | php | public function isFieldExists($table, $field)
{
if (isset($this->tables[$table])) {
$fields = $this->getFields($table);
return $fields->where('name', $field)->count() > 0;
}
return false;
} | [
"public",
"function",
"isFieldExists",
"(",
"$",
"table",
",",
"$",
"field",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"table",
"]",
")",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
"$",
"tab... | check is model table exists
@param string $table
@param string $field
@return bool | [
"check",
"is",
"model",
"table",
"exists"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L214-L223 |
phpmob/changmin | src/PhpMob/CmsBundle/Context/CachedCompositeLocaleContext.php | CachedCompositeLocaleContext.getLocaleCode | public function getLocaleCode(): string
{
if ($this->cachedLocaleCode) {
return $this->cachedLocaleCode;
}
return $this->cachedLocaleCode = $this->compositeContext->getLocaleCode();
} | php | public function getLocaleCode(): string
{
if ($this->cachedLocaleCode) {
return $this->cachedLocaleCode;
}
return $this->cachedLocaleCode = $this->compositeContext->getLocaleCode();
} | [
"public",
"function",
"getLocaleCode",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"cachedLocaleCode",
")",
"{",
"return",
"$",
"this",
"->",
"cachedLocaleCode",
";",
"}",
"return",
"$",
"this",
"->",
"cachedLocaleCode",
"=",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Context/CachedCompositeLocaleContext.php#L53-L60 |
VincentChalnot/SidusEAVFilterBundle | Filter/Type/AdvancedNumberFilterType.php | AdvancedNumberFilterType.applyAttributeQueryBuilder | protected function applyAttributeQueryBuilder(
AttributeQueryBuilderInterface $attributeQb,
$data
): AttributeQueryBuilderInterface {
$input = $data['input'];
switch ($data['option']) {
case 'exact':
return $attributeQb->equals($input);
case 'g... | php | protected function applyAttributeQueryBuilder(
AttributeQueryBuilderInterface $attributeQb,
$data
): AttributeQueryBuilderInterface {
$input = $data['input'];
switch ($data['option']) {
case 'exact':
return $attributeQb->equals($input);
case 'g... | [
"protected",
"function",
"applyAttributeQueryBuilder",
"(",
"AttributeQueryBuilderInterface",
"$",
"attributeQb",
",",
"$",
"data",
")",
":",
"AttributeQueryBuilderInterface",
"{",
"$",
"input",
"=",
"$",
"data",
"[",
"'input'",
"]",
";",
"switch",
"(",
"$",
"data... | @param AttributeQueryBuilderInterface $attributeQb
@param mixed $data
@return AttributeQueryBuilderInterface | [
"@param",
"AttributeQueryBuilderInterface",
"$attributeQb",
"@param",
"mixed",
"$data"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/Type/AdvancedNumberFilterType.php#L20-L46 |
chubbyphp/chubbyphp-api-http | src/Serialization/ApiProblem/AbstractApiProblemMapping.php | AbstractApiProblemMapping.getNormalizationFieldMappings | public function getNormalizationFieldMappings(string $path): array
{
return [
NormalizationFieldMappingBuilder::create('type')->getMapping(),
NormalizationFieldMappingBuilder::create('title')->getMapping(),
NormalizationFieldMappingBuilder::create('detail')->getMapping(),... | php | public function getNormalizationFieldMappings(string $path): array
{
return [
NormalizationFieldMappingBuilder::create('type')->getMapping(),
NormalizationFieldMappingBuilder::create('title')->getMapping(),
NormalizationFieldMappingBuilder::create('detail')->getMapping(),... | [
"public",
"function",
"getNormalizationFieldMappings",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"return",
"[",
"NormalizationFieldMappingBuilder",
"::",
"create",
"(",
"'type'",
")",
"->",
"getMapping",
"(",
")",
",",
"NormalizationFieldMappingBuilder",
"... | @param string $path
@return NormalizationFieldMappingInterface[] | [
"@param",
"string",
"$path"
] | train | https://github.com/chubbyphp/chubbyphp-api-http/blob/675d657b686e96aa16be56d0e9e07aaa844266ed/src/Serialization/ApiProblem/AbstractApiProblemMapping.php#L27-L35 |
ARCANEDEV/Sanitizer | src/Filters/UrlFilter.php | UrlFilter.filter | public function filter($value, array $options = [])
{
if ( ! is_string($value)) return $value;
$value = trim($value);
if ( ! Str::startsWith($value, ['http://', 'https://'])) {
$value = "http://$value";
}
return filter_var($value, FILTER_SANITIZE_URL);
} | php | public function filter($value, array $options = [])
{
if ( ! is_string($value)) return $value;
$value = trim($value);
if ( ! Str::startsWith($value, ['http://', 'https://'])) {
$value = "http://$value";
}
return filter_var($value, FILTER_SANITIZE_URL);
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"return",
"$",
"value",
";",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
... | Sanitize url of the given string.
@param mixed $value
@param array $options
@return string|mixed | [
"Sanitize",
"url",
"of",
"the",
"given",
"string",
"."
] | train | https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Filters/UrlFilter.php#L26-L37 |
webforge-labs/psc-cms | lib/Psc/UI/Button.php | Button.setLeftIcon | public function setLeftIcon($icon) {
$this->leftIcon = $icon;
$this->widgetOptions['icons']['primary'] = 'ui-icon-'.$this->leftIcon;
return $this;
} | php | public function setLeftIcon($icon) {
$this->leftIcon = $icon;
$this->widgetOptions['icons']['primary'] = 'ui-icon-'.$this->leftIcon;
return $this;
} | [
"public",
"function",
"setLeftIcon",
"(",
"$",
"icon",
")",
"{",
"$",
"this",
"->",
"leftIcon",
"=",
"$",
"icon",
";",
"$",
"this",
"->",
"widgetOptions",
"[",
"'icons'",
"]",
"[",
"'primary'",
"]",
"=",
"'ui-icon-'",
".",
"$",
"this",
"->",
"leftIcon"... | http://jqueryui.com/themeroller
@param string $icon der Name des Icons ohne ui-icon- davor | [
"http",
":",
"//",
"jqueryui",
".",
"com",
"/",
"themeroller"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Button.php#L96-L100 |
webforge-labs/psc-cms | lib/Psc/UI/Button.php | Button.setRightIcon | public function setRightIcon($icon) {
$this->rightIcon = $icon;
$this->widgetOptions['icons']['secondary'] = 'ui-icon-'.$this->rightIcon;
return $this;
} | php | public function setRightIcon($icon) {
$this->rightIcon = $icon;
$this->widgetOptions['icons']['secondary'] = 'ui-icon-'.$this->rightIcon;
return $this;
} | [
"public",
"function",
"setRightIcon",
"(",
"$",
"icon",
")",
"{",
"$",
"this",
"->",
"rightIcon",
"=",
"$",
"icon",
";",
"$",
"this",
"->",
"widgetOptions",
"[",
"'icons'",
"]",
"[",
"'secondary'",
"]",
"=",
"'ui-icon-'",
".",
"$",
"this",
"->",
"right... | http://jqueryui.com/themeroller
@param string $icon der Name des Icons ohne ui-icon- davor | [
"http",
":",
"//",
"jqueryui",
".",
"com",
"/",
"themeroller"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Button.php#L106-L110 |
webforge-labs/psc-cms | lib/Psc/UI/Button.php | Button.addData | public function addData($key, $value) {
if (!isset($this->data)) $this->data = array();
$this->data[$key] = $value;
return $this;
} | php | public function addData($key, $value) {
if (!isset($this->data)) $this->data = array();
$this->data[$key] = $value;
return $this;
} | [
"public",
"function",
"addData",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
")",
")",
"$",
"this",
"->",
"data",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"data",
"[",
"$",
"ke... | Fügt für einen Schlüssel die jQuery Data dem Button hinzu
$button->addData('something', 'myvalue');
// javascript
$('button').data('something') === 'myvalue' | [
"Fügt",
"für",
"einen",
"Schlüssel",
"die",
"jQuery",
"Data",
"dem",
"Button",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Button.php#L184-L188 |
AydinHassan/cli-md-renderer | src/Renderer/DocumentRenderer.php | DocumentRenderer.render | public function render(AbstractBlock $block, CliRenderer $renderer)
{
if (!($block instanceof Document)) {
throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
}
$wholeDoc = $renderer->renderBlocks($block->children());
return ... | php | public function render(AbstractBlock $block, CliRenderer $renderer)
{
if (!($block instanceof Document)) {
throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
}
$wholeDoc = $renderer->renderBlocks($block->children());
return ... | [
"public",
"function",
"render",
"(",
"AbstractBlock",
"$",
"block",
",",
"CliRenderer",
"$",
"renderer",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"block",
"instanceof",
"Document",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
... | @param AbstractBlock $block
@param CliRenderer $renderer
@return string | [
"@param",
"AbstractBlock",
"$block",
"@param",
"CliRenderer",
"$renderer"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/Renderer/DocumentRenderer.php#L24-L32 |
SAREhub/PHP_Commons | src/SAREhub/Commons/Misc/ArrayHelper.php | ArrayHelper.flatten | public static function flatten(array $input, $keySeparator = '.')
{
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($input),
RecursiveIteratorIterator::SELF_FIRST);
$path = [];
$output = [];
foreach ($iterator as $key => $value) {
$path[$... | php | public static function flatten(array $input, $keySeparator = '.')
{
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($input),
RecursiveIteratorIterator::SELF_FIRST);
$path = [];
$output = [];
foreach ($iterator as $key => $value) {
$path[$... | [
"public",
"static",
"function",
"flatten",
"(",
"array",
"$",
"input",
",",
"$",
"keySeparator",
"=",
"'.'",
")",
"{",
"$",
"iterator",
"=",
"new",
"RecursiveIteratorIterator",
"(",
"new",
"RecursiveArrayIterator",
"(",
"$",
"input",
")",
",",
"RecursiveIterat... | /**
Flattens array into a one-dimensional array.
Each key in the returned one-dimensional array is the join of all keys leading to
each (non-traversable) value, in all dimensions, separated by a given separator.
@param array $input
@param string $keySeparator
@return array | [
"/",
"**",
"Flattens",
"array",
"into",
"a",
"one",
"-",
"dimensional",
"array",
".",
"Each",
"key",
"in",
"the",
"returned",
"one",
"-",
"dimensional",
"array",
"is",
"the",
"join",
"of",
"all",
"keys",
"leading",
"to",
"each",
"(",
"non",
"-",
"trave... | train | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Misc/ArrayHelper.php#L22-L38 |
ipunkt/laravel-package-manager | src/Providers/ArtisanServiceProvider.php | ArtisanServiceProvider.register | public function register()
{
if ($this->registerOnlyForConsole && !$this->app->runningInConsole()) {
return;
}
$this->registerCommands($this->commands);
} | php | public function register()
{
if ($this->registerOnlyForConsole && !$this->app->runningInConsole()) {
return;
}
$this->registerCommands($this->commands);
} | [
"public",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"registerOnlyForConsole",
"&&",
"!",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"registerCommands",
"(",
... | Register any application services.
@return void | [
"Register",
"any",
"application",
"services",
"."
] | train | https://github.com/ipunkt/laravel-package-manager/blob/6ecfc9d933c37927e52c441d5019126be69e5817/src/Providers/ArtisanServiceProvider.php#L32-L39 |
ipunkt/laravel-package-manager | src/Providers/ArtisanServiceProvider.php | ArtisanServiceProvider.registerCommands | protected function registerCommands(array $commands)
{
if (!$this->app->runningInConsole()) {
return;
}
foreach ($commands as $key => $command) {
if (is_numeric($key)) {
$key = Str::lower(str_replace("\\", '.', $command));
}
$method = "register{$command}";
try {
if (method_exists($this,... | php | protected function registerCommands(array $commands)
{
if (!$this->app->runningInConsole()) {
return;
}
foreach ($commands as $key => $command) {
if (is_numeric($key)) {
$key = Str::lower(str_replace("\\", '.', $command));
}
$method = "register{$command}";
try {
if (method_exists($this,... | [
"protected",
"function",
"registerCommands",
"(",
"array",
"$",
"commands",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"commands",
"as",
"$",
"key",
"=>",
... | registers an array of commands (key is shortname and value is command class
or part of the registerYYYCommand method name)
@param array $commands
@throws \Exception | [
"registers",
"an",
"array",
"of",
"commands",
"(",
"key",
"is",
"shortname",
"and",
"value",
"is",
"command",
"class",
"or",
"part",
"of",
"the",
"registerYYYCommand",
"method",
"name",
")"
] | train | https://github.com/ipunkt/laravel-package-manager/blob/6ecfc9d933c37927e52c441d5019126be69e5817/src/Providers/ArtisanServiceProvider.php#L49-L75 |
amostajo/wordpress-plugin-core | src/psr4/Cache.php | Cache.add | public static function add( $key, $value, $expires )
{
$cache = self::instance();
if ( $cache && $value != null) {
$cache->set( $key, $value, $expires * 60 );
}
} | php | public static function add( $key, $value, $expires )
{
$cache = self::instance();
if ( $cache && $value != null) {
$cache->set( $key, $value, $expires * 60 );
}
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expires",
")",
"{",
"$",
"cache",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"cache",
"&&",
"$",
"value",
"!=",
"null",
")",
"{",
"$",
"cac... | Adds a value to cache.
@since 1.0
@param string $key Main plugin object as reference.
@param mixed $value Value to cache.
@param int $expires Expiration time in minutes. | [
"Adds",
"a",
"value",
"to",
"cache",
"."
] | train | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Cache.php#L89-L95 |
amostajo/wordpress-plugin-core | src/psr4/Cache.php | Cache.has | public static function has( $key )
{
$cache = self::instance();
if ( $cache ) {
return $cache->isExisting( $key );
}
return false;
} | php | public static function has( $key )
{
$cache = self::instance();
if ( $cache ) {
return $cache->isExisting( $key );
}
return false;
} | [
"public",
"static",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"$",
"cache",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"cache",
")",
"{",
"return",
"$",
"cache",
"->",
"isExisting",
"(",
"$",
"key",
")",
";",
"}",
"return",... | Returns flag if a given key has a value in cache or not.
@since 1.0
@param string $key Cache key name.
@return bool | [
"Returns",
"flag",
"if",
"a",
"given",
"key",
"has",
"a",
"value",
"in",
"cache",
"or",
"not",
"."
] | train | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Cache.php#L103-L110 |
amostajo/wordpress-plugin-core | src/psr4/Cache.php | Cache.remember | public static function remember( $key, $expires, Closure $closure )
{
$cache = self::instance();
if ( $cache ) {
if ( $cache->isExisting( $key ) ) {
return $cache->get( $key );
} else if ( $closure != null ) {
$value = $closure();
$cache->set( $key, $value, $expires * 60 );
return $value;
... | php | public static function remember( $key, $expires, Closure $closure )
{
$cache = self::instance();
if ( $cache ) {
if ( $cache->isExisting( $key ) ) {
return $cache->get( $key );
} else if ( $closure != null ) {
$value = $closure();
$cache->set( $key, $value, $expires * 60 );
return $value;
... | [
"public",
"static",
"function",
"remember",
"(",
"$",
"key",
",",
"$",
"expires",
",",
"Closure",
"$",
"closure",
")",
"{",
"$",
"cache",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"cache",
")",
"{",
"if",
"(",
"$",
"cache",
"-... | Returns the value of a given key.
If it doesn't exist, then the value pass by is returned.
@since 1.0
@param string $key Main plugin object as reference.
@param int $expires Expiration time in minutes.
@param Closure $value Value to cache.
@return mixed | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"key",
".",
"If",
"it",
"doesn",
"t",
"exist",
"then",
"the",
"value",
"pass",
"by",
"is",
"returned",
"."
] | train | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Cache.php#L121-L134 |
dashifen/wordpress-php7-plugin-boilerplate | src/Controller/AbstractController.php | AbstractController.defineActivationHooks | protected function defineActivationHooks(): void {
$backend = $this->getBackend();
$pluginName = $this->getFilename();
$handlers = ["activate", "deactivate", "uninstall"];
foreach ($handlers as $handler) {
// for each of our handlers, we hook an action handler to our
// backend component. the purpose... | php | protected function defineActivationHooks(): void {
$backend = $this->getBackend();
$pluginName = $this->getFilename();
$handlers = ["activate", "deactivate", "uninstall"];
foreach ($handlers as $handler) {
// for each of our handlers, we hook an action handler to our
// backend component. the purpose... | [
"protected",
"function",
"defineActivationHooks",
"(",
")",
":",
"void",
"{",
"$",
"backend",
"=",
"$",
"this",
"->",
"getBackend",
"(",
")",
";",
"$",
"pluginName",
"=",
"$",
"this",
"->",
"getFilename",
"(",
")",
";",
"$",
"handlers",
"=",
"[",
"\"ac... | Defines hooks using the Backend object for the activate,
deactivate, and uninstall actions of this plugin.
@return void | [
"Defines",
"hooks",
"using",
"the",
"Backend",
"object",
"for",
"the",
"activate",
"deactivate",
"and",
"uninstall",
"actions",
"of",
"this",
"plugin",
"."
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/AbstractController.php#L115-L129 |
dashifen/wordpress-php7-plugin-boilerplate | src/Controller/AbstractController.php | AbstractController.getSetting | public function getSetting(string $setting) {
$settings = $this->getSettings();
$keys = array_keys($settings);
if (!in_array($setting, $keys)) {
throw new ControllerException("Unknown setting: $setting.",
ControllerException::UNKNOWN_SETTING);
}
return $settings[$setting];
} | php | public function getSetting(string $setting) {
$settings = $this->getSettings();
$keys = array_keys($settings);
if (!in_array($setting, $keys)) {
throw new ControllerException("Unknown setting: $setting.",
ControllerException::UNKNOWN_SETTING);
}
return $settings[$setting];
} | [
"public",
"function",
"getSetting",
"(",
"string",
"$",
"setting",
")",
"{",
"$",
"settings",
"=",
"$",
"this",
"->",
"getSettings",
"(",
")",
";",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"settings",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
... | @param string $setting
@return mixed
@throws ControllerException | [
"@param",
"string",
"$setting"
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/AbstractController.php#L195-L205 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder.php | Zend_Feed_Builder._createHeader | private function _createHeader(array $data)
{
$mandatories = array('title', 'link', 'charset');
foreach ($mandatories as $mandatory) {
if (!isset($data[$mandatory])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once... | php | private function _createHeader(array $data)
{
$mandatories = array('title', 'link', 'charset');
foreach ($mandatories as $mandatory) {
if (!isset($data[$mandatory])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once... | [
"private",
"function",
"_createHeader",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"mandatories",
"=",
"array",
"(",
"'title'",
",",
"'link'",
",",
"'charset'",
")",
";",
"foreach",
"(",
"$",
"mandatories",
"as",
"$",
"mandatory",
")",
"{",
"if",
"(",
"... | Create the Zend_Feed_Builder_Header instance
@param array $data
@throws Zend_Feed_Builder_Exception
@return void | [
"Create",
"the",
"Zend_Feed_Builder_Header",
"instance"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder.php#L215-L334 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder.php | Zend_Feed_Builder._createEntries | private function _createEntries(array $data)
{
foreach ($data as $row) {
$mandatories = array('title', 'link', 'description');
foreach ($mandatories as $mandatory) {
if (!isset($row[$mandatory])) {
/**
* @see Zend_Feed_Builder_... | php | private function _createEntries(array $data)
{
foreach ($data as $row) {
$mandatories = array('title', 'link', 'description');
foreach ($mandatories as $mandatory) {
if (!isset($row[$mandatory])) {
/**
* @see Zend_Feed_Builder_... | [
"private",
"function",
"_createEntries",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"row",
")",
"{",
"$",
"mandatories",
"=",
"array",
"(",
"'title'",
",",
"'link'",
",",
"'description'",
")",
";",
"foreach",
"(",
"$",... | Create the array of article entries
@param array $data
@throws Zend_Feed_Builder_Exception
@return void | [
"Create",
"the",
"array",
"of",
"article",
"entries"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder.php#L343-L397 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.fill | public function fill(array $data)
{
if (empty($data['url']) || !is_string($data['url']) || strpos($data['url'], $this->browser->getHost()) !== 0) {
return;
}
$dom = $this->browser->getDom(substr($data['url'], strlen($this->browser->getHost())));
if (!($dom instanceof \DO... | php | public function fill(array $data)
{
if (empty($data['url']) || !is_string($data['url']) || strpos($data['url'], $this->browser->getHost()) !== 0) {
return;
}
$dom = $this->browser->getDom(substr($data['url'], strlen($this->browser->getHost())));
if (!($dom instanceof \DO... | [
"public",
"function",
"fill",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
"[",
"'url'",
"]",
")",
"||",
"!",
"is_string",
"(",
"$",
"data",
"[",
"'url'",
"]",
")",
"||",
"strpos",
"(",
"$",
"data",
"[",
"'url'",
"... | Fill item from source.
@param array $data
@return \AnimeDb\Bundle\CatalogBundle\Entity\Item|null | [
"Fill",
"item",
"from",
"source",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L359-L438 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getAttrAsArray | private function getAttrAsArray(\DOMElement $element)
{
$return = [];
for ($i = 0; $i < $element->attributes->length; ++$i) {
$return[$element->attributes->item($i)->nodeName] = $element->attributes->item($i)->nodeValue;
}
return $return;
} | php | private function getAttrAsArray(\DOMElement $element)
{
$return = [];
for ($i = 0; $i < $element->attributes->length; ++$i) {
$return[$element->attributes->item($i)->nodeName] = $element->attributes->item($i)->nodeValue;
}
return $return;
} | [
"private",
"function",
"getAttrAsArray",
"(",
"\\",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"element",
"->",
"attributes",
"->",
"length",
";",
"++",
"$",
... | Get element attributes as array.
@param \DOMElement $element
@return array | [
"Get",
"element",
"attributes",
"as",
"array",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L447-L455 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.setCover | private function setCover(Item $item, $id, $type)
{
$item->setCover(self::NAME.'/'.$id.'/1.jpg');
return $this->uploadImage($this->getCoverUrl($id, $type), $item);
} | php | private function setCover(Item $item, $id, $type)
{
$item->setCover(self::NAME.'/'.$id.'/1.jpg');
return $this->uploadImage($this->getCoverUrl($id, $type), $item);
} | [
"private",
"function",
"setCover",
"(",
"Item",
"$",
"item",
",",
"$",
"id",
",",
"$",
"type",
")",
"{",
"$",
"item",
"->",
"setCover",
"(",
"self",
"::",
"NAME",
".",
"'/'",
".",
"$",
"id",
".",
"'/1.jpg'",
")",
";",
"return",
"$",
"this",
"->",... | Get cover from source id.
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param string $id
@param string $type
@return bool | [
"Get",
"cover",
"from",
"source",
"id",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L466-L471 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.fillHeadData | private function fillHeadData(Item $item, \DOMXPath $xpath, \DOMElement $head)
{
/* @var $data \DOMElement */
$data = $xpath->query('font', $head)->item(0);
$length = $data->childNodes->length;
for ($i = 0; $i < $length; ++$i) {
if ($data->childNodes->item($i)->nodeName =... | php | private function fillHeadData(Item $item, \DOMXPath $xpath, \DOMElement $head)
{
/* @var $data \DOMElement */
$data = $xpath->query('font', $head)->item(0);
$length = $data->childNodes->length;
for ($i = 0; $i < $length; ++$i) {
if ($data->childNodes->item($i)->nodeName =... | [
"private",
"function",
"fillHeadData",
"(",
"Item",
"$",
"item",
",",
"\\",
"DOMXPath",
"$",
"xpath",
",",
"\\",
"DOMElement",
"$",
"head",
")",
"{",
"/* @var $data \\DOMElement */",
"$",
"data",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'font'",
",",
"$",
... | Fill head data.
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param \DOMXPath $xpath
@param \DOMElement $head
@return \AnimeDb\Bundle\CatalogBundle\Entity\Item | [
"Fill",
"head",
"data",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L482-L584 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.fillBodyData | private function fillBodyData(Item $item, \DOMXPath $xpath, \DOMElement $body, $id, $frames, $type)
{
for ($i = 0; $i < $body->childNodes->length; ++$i) {
if ($value = trim($body->childNodes->item($i)->nodeValue)) {
switch ($value) {
// get summary
... | php | private function fillBodyData(Item $item, \DOMXPath $xpath, \DOMElement $body, $id, $frames, $type)
{
for ($i = 0; $i < $body->childNodes->length; ++$i) {
if ($value = trim($body->childNodes->item($i)->nodeValue)) {
switch ($value) {
// get summary
... | [
"private",
"function",
"fillBodyData",
"(",
"Item",
"$",
"item",
",",
"\\",
"DOMXPath",
"$",
"xpath",
",",
"\\",
"DOMElement",
"$",
"body",
",",
"$",
"id",
",",
"$",
"frames",
",",
"$",
"type",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
... | Fill body data.
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param \DOMXPath $xpath
@param \DOMElement $body
@param int $id
@param bool $frames
@param string ... | [
"Fill",
"body",
"data",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L598-L658 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getCountryByName | private function getCountryByName($name)
{
$name = str_replace('Южная Корея', 'Республика Корея', $name);
$rep = $this->doctrine->getRepository('AnimeDbCatalogBundle:CountryTranslation');
if ($country = $rep->findOneBy(['locale' => 'ru', 'content' => $name])) {
return $country->g... | php | private function getCountryByName($name)
{
$name = str_replace('Южная Корея', 'Республика Корея', $name);
$rep = $this->doctrine->getRepository('AnimeDbCatalogBundle:CountryTranslation');
if ($country = $rep->findOneBy(['locale' => 'ru', 'content' => $name])) {
return $country->g... | [
"private",
"function",
"getCountryByName",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"'Южная Корея', 'Республ",
"и",
"а Корея', $name);",
"",
"",
"",
"",
"",
"$",
"rep",
"=",
"$",
"this",
"->",
"doctrine",
"->",
"getRepository",
"("... | Get real country by name.
@param string $name
@return \AnimeDb\Bundle\CatalogBundle\Entity\Country|null | [
"Get",
"real",
"country",
"by",
"name",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L680-L687 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getGenreByName | private function getGenreByName($name)
{
if (isset($this->genres[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Genre')
->findOneByName($this->genres[$name]);
}
} | php | private function getGenreByName($name)
{
if (isset($this->genres[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Genre')
->findOneByName($this->genres[$name]);
}
} | [
"private",
"function",
"getGenreByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"genres",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"doctrine",
"->",
"getRepository",
"(",
"'AnimeDbCatalogBundle:G... | Get real genre by name.
@param string $name
@return \AnimeDb\Bundle\CatalogBundle\Entity\Genre|null | [
"Get",
"real",
"genre",
"by",
"name",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L696-L703 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getTypeByName | private function getTypeByName($name)
{
if (isset($this->types[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Type')
->find($this->types[$name]);
}
} | php | private function getTypeByName($name)
{
if (isset($this->types[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Type')
->find($this->types[$name]);
}
} | [
"private",
"function",
"getTypeByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"doctrine",
"->",
"getRepository",
"(",
"'AnimeDbCatalogBundle:Typ... | Get real type by name.
@param string $name
@return \AnimeDb\Bundle\CatalogBundle\Entity\Type|null | [
"Get",
"real",
"type",
"by",
"name",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L712-L719 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getFrames | public function getFrames($id, $type)
{
$dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
if (!$dom) {
return [];
}
$images = (new \DOMXPath($dom))->query('//table//table//table//img');
$frames = [];
foreach ($images as $image) {
... | php | public function getFrames($id, $type)
{
$dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
if (!$dom) {
return [];
}
$images = (new \DOMXPath($dom))->query('//table//table//table//img');
$frames = [];
foreach ($images as $image) {
... | [
"public",
"function",
"getFrames",
"(",
"$",
"id",
",",
"$",
"type",
")",
"{",
"$",
"dom",
"=",
"$",
"this",
"->",
"browser",
"->",
"getDom",
"(",
"'/'",
".",
"$",
"type",
".",
"'/'",
".",
"$",
"type",
".",
"'_photos.php?id='",
".",
"$",
"id",
")... | Get item frames.
@param int $id
@param string $type
@return array | [
"Get",
"item",
"frames",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L729-L761 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getNodeValueAsText | private function getNodeValueAsText(\DOMNode $node)
{
$text = $node->ownerDocument->saveHTML($node);
$text = str_replace(["<br>\n", "\n", '<br>'], ['<br>', ' ', "\n"], $text);
return trim(strip_tags($text));
} | php | private function getNodeValueAsText(\DOMNode $node)
{
$text = $node->ownerDocument->saveHTML($node);
$text = str_replace(["<br>\n", "\n", '<br>'], ['<br>', ' ', "\n"], $text);
return trim(strip_tags($text));
} | [
"private",
"function",
"getNodeValueAsText",
"(",
"\\",
"DOMNode",
"$",
"node",
")",
"{",
"$",
"text",
"=",
"$",
"node",
"->",
"ownerDocument",
"->",
"saveHTML",
"(",
"$",
"node",
")",
";",
"$",
"text",
"=",
"str_replace",
"(",
"[",
"\"<br>\\n\"",
",",
... | Get node value as text.
@param \DOMNode $node
@return string | [
"Get",
"node",
"value",
"as",
"text",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L770-L776 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getStudio | private function getStudio(\DOMXPath $xpath, \DOMNode $body)
{
$studios = $xpath->query('//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]', $body);
if ($studios->length) {
foreach ($studios as $studio) {
$url = $studio->attributes->getNamedItem('src')->... | php | private function getStudio(\DOMXPath $xpath, \DOMNode $body)
{
$studios = $xpath->query('//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]', $body);
if ($studios->length) {
foreach ($studios as $studio) {
$url = $studio->attributes->getNamedItem('src')->... | [
"private",
"function",
"getStudio",
"(",
"\\",
"DOMXPath",
"$",
"xpath",
",",
"\\",
"DOMNode",
"$",
"body",
")",
"{",
"$",
"studios",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'//img[starts-with(@src,\"http://www.world-art.ru/img/company_new/\")]'",
",",
"$",
"body"... | Get item studio.
@param \DOMXPath $xpath
@param \DOMNode $body
@return \AnimeDb\Bundle\CatalogBundle\Entity\Studio|null | [
"Get",
"item",
"studio",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L786-L799 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getItemType | public function getItemType($url)
{
if (strpos($url, self::ITEM_TYPE_ANIMATION.'/'.self::ITEM_TYPE_ANIMATION) !== false) {
return self::ITEM_TYPE_ANIMATION;
} elseif (strpos($url, self::ITEM_TYPE_CINEMA.'/'.self::ITEM_TYPE_CINEMA) !== false) {
return self::ITEM_TYPE_CINEMA;
... | php | public function getItemType($url)
{
if (strpos($url, self::ITEM_TYPE_ANIMATION.'/'.self::ITEM_TYPE_ANIMATION) !== false) {
return self::ITEM_TYPE_ANIMATION;
} elseif (strpos($url, self::ITEM_TYPE_CINEMA.'/'.self::ITEM_TYPE_CINEMA) !== false) {
return self::ITEM_TYPE_CINEMA;
... | [
"public",
"function",
"getItemType",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"self",
"::",
"ITEM_TYPE_ANIMATION",
".",
"'/'",
".",
"self",
"::",
"ITEM_TYPE_ANIMATION",
")",
"!==",
"false",
")",
"{",
"return",
"self",
"::",
... | Get item type by URL.
@param string $url
@return string | [
"Get",
"item",
"type",
"by",
"URL",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L808-L817 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.fillAnimationNames | protected function fillAnimationNames(Item $item, \DOMXPath $xpath, \DOMElement $head)
{
// add main name
$names = $xpath->query('table[1]/tr/td', $head)->item(0)->nodeValue;
$names = explode("\n", trim($names));
// clear
$name = preg_replace('/\[\d{4}\]/', '', array_shift($... | php | protected function fillAnimationNames(Item $item, \DOMXPath $xpath, \DOMElement $head)
{
// add main name
$names = $xpath->query('table[1]/tr/td', $head)->item(0)->nodeValue;
$names = explode("\n", trim($names));
// clear
$name = preg_replace('/\[\d{4}\]/', '', array_shift($... | [
"protected",
"function",
"fillAnimationNames",
"(",
"Item",
"$",
"item",
",",
"\\",
"DOMXPath",
"$",
"xpath",
",",
"\\",
"DOMElement",
"$",
"head",
")",
"{",
"// add main name",
"$",
"names",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'table[1]/tr/td'",
",",
... | Fill names for Animation type.
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param \DOMXPath $xpath
@param \DOMElement $head
@return \AnimeDb\Bundle\CatalogBundle\Entity\Item | [
"Fill",
"names",
"for",
"Animation",
"type",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L828-L848 |
anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getCoverUrl | public function getCoverUrl($id, $type)
{
switch ($type) {
case self::ITEM_TYPE_ANIMATION:
return $this->browser->getHost().'/'.$type.'/img/'.(ceil($id / 1000) * 1000).'/'.$id.'/1.jpg';
case self::ITEM_TYPE_CINEMA:
return $this->browser->getHost().'/'.... | php | public function getCoverUrl($id, $type)
{
switch ($type) {
case self::ITEM_TYPE_ANIMATION:
return $this->browser->getHost().'/'.$type.'/img/'.(ceil($id / 1000) * 1000).'/'.$id.'/1.jpg';
case self::ITEM_TYPE_CINEMA:
return $this->browser->getHost().'/'.... | [
"public",
"function",
"getCoverUrl",
"(",
"$",
"id",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"self",
"::",
"ITEM_TYPE_ANIMATION",
":",
"return",
"$",
"this",
"->",
"browser",
"->",
"getHost",
"(",
")",
".",
"'/'",
".... | Get cover URL.
@param string $id
@param string $type
@return string|null | [
"Get",
"cover",
"URL",
"."
] | train | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L890-L900 |
EvanDotPro/EdpGithub | src/EdpGithub/Listener/Auth/UrlToken.php | UrlToken.preSend | public function preSend(Event $e)
{
$validator = new NotEmpty();
if (!isset($this->options['tokenOrLogin'])
|| !$validator->isValid($this->options['tokenOrLogin'])
) {
throw new Exception\InvalidArgumentException('You need to set OAuth token!');
}
/*... | php | public function preSend(Event $e)
{
$validator = new NotEmpty();
if (!isset($this->options['tokenOrLogin'])
|| !$validator->isValid($this->options['tokenOrLogin'])
) {
throw new Exception\InvalidArgumentException('You need to set OAuth token!');
}
/*... | [
"public",
"function",
"preSend",
"(",
"Event",
"$",
"e",
")",
"{",
"$",
"validator",
"=",
"new",
"NotEmpty",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'tokenOrLogin'",
"]",
")",
"||",
"!",
"$",
"validator",
"-... | Add access token to Request Parameters
@throws Exception\InvalidArgumentException | [
"Add",
"access",
"token",
"to",
"Request",
"Parameters"
] | train | https://github.com/EvanDotPro/EdpGithub/blob/51f3e33e02edbef011103e3c2c1629d46af011a3/src/EdpGithub/Listener/Auth/UrlToken.php#L16-L31 |
echo58/sms | src/Pool.php | Pool.registerProvider | public function registerProvider(ProviderInterface $provider)
{
$this->providers[$provider->getName()] = $provider;
$this->sortProviders();
return $this;
} | php | public function registerProvider(ProviderInterface $provider)
{
$this->providers[$provider->getName()] = $provider;
$this->sortProviders();
return $this;
} | [
"public",
"function",
"registerProvider",
"(",
"ProviderInterface",
"$",
"provider",
")",
"{",
"$",
"this",
"->",
"providers",
"[",
"$",
"provider",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"provider",
";",
"$",
"this",
"->",
"sortProviders",
"(",
")",
... | 添加一个短信接口供应商
@param ProviderInterface $provider
@return $this | [
"添加一个短信接口供应商"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L72-L78 |
echo58/sms | src/Pool.php | Pool.registerProviders | public function registerProviders(array $providers)
{
foreach ($providers as $provider) {
$this->providers[$provider->getName()] = $provider;
}
$this->sortProviders();
return $this;
} | php | public function registerProviders(array $providers)
{
foreach ($providers as $provider) {
$this->providers[$provider->getName()] = $provider;
}
$this->sortProviders();
return $this;
} | [
"public",
"function",
"registerProviders",
"(",
"array",
"$",
"providers",
")",
"{",
"foreach",
"(",
"$",
"providers",
"as",
"$",
"provider",
")",
"{",
"$",
"this",
"->",
"providers",
"[",
"$",
"provider",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"pro... | 在现有短信接口供应商列表中添加一批新的短信接口供应商
@param ProviderInterface[] $providers
@return $this | [
"在现有短信接口供应商列表中添加一批新的短信接口供应商"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L86-L94 |
echo58/sms | src/Pool.php | Pool.sortProviders | protected function sortProviders()
{
// fix: uasort(): Array was modified by the user comparison function
$simpleProviders = [];
foreach ($this->providers as $name => $provider) {
$simpleProviders[$name] = $provider->getPriority();
}
asort($simpleProviders);
... | php | protected function sortProviders()
{
// fix: uasort(): Array was modified by the user comparison function
$simpleProviders = [];
foreach ($this->providers as $name => $provider) {
$simpleProviders[$name] = $provider->getPriority();
}
asort($simpleProviders);
... | [
"protected",
"function",
"sortProviders",
"(",
")",
"{",
"// fix: uasort(): Array was modified by the user comparison function",
"$",
"simpleProviders",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"name",
"=>",
"$",
"provider",
")"... | 根据短信接口供应商的优先级对短信接口供应商列表进行排序
优先级数字越小,越靠前 | [
"根据短信接口供应商的优先级对短信接口供应商列表进行排序"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L101-L114 |
echo58/sms | src/Pool.php | Pool.setMessages | public function setMessages(array $messages)
{
$this->unsetMessages();
foreach ($messages as $message) {
$this->appendMessage($message);
}
return $this;
} | php | public function setMessages(array $messages)
{
$this->unsetMessages();
foreach ($messages as $message) {
$this->appendMessage($message);
}
return $this;
} | [
"public",
"function",
"setMessages",
"(",
"array",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"unsetMessages",
"(",
")",
";",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"appendMessage",
"(",
"$",
"message",
"... | 设置需要发送的消息列表
@param Message[] $messages
@return $this | [
"设置需要发送的消息列表"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L140-L148 |
echo58/sms | src/Pool.php | Pool.addMessage | public function addMessage(Message $message, $prepend = false)
{
if (!$prepend) {
$this->appendMessage($message);
} else {
$this->prependMessage($message);
}
return $this;
} | php | public function addMessage(Message $message, $prepend = false)
{
if (!$prepend) {
$this->appendMessage($message);
} else {
$this->prependMessage($message);
}
return $this;
} | [
"public",
"function",
"addMessage",
"(",
"Message",
"$",
"message",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"prepend",
")",
"{",
"$",
"this",
"->",
"appendMessage",
"(",
"$",
"message",
")",
";",
"}",
"else",
"{",
"$",
"th... | 添加一条需要发送的消息
@param Message $message
@param bool $prepend 控制添加的消息是添加在消息队列头部还是尾部,默认添加在尾部
@return $this | [
"添加一条需要发送的消息"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L170-L179 |
echo58/sms | src/Pool.php | Pool.addMessages | public function addMessages(array $messages, $prepend = false)
{
if ($prepend) {
$messages = array_reverse($messages);
}
foreach ($messages as $message) {
$this->addMessage($message, $prepend);
}
return $this;
} | php | public function addMessages(array $messages, $prepend = false)
{
if ($prepend) {
$messages = array_reverse($messages);
}
foreach ($messages as $message) {
$this->addMessage($message, $prepend);
}
return $this;
} | [
"public",
"function",
"addMessages",
"(",
"array",
"$",
"messages",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"prepend",
")",
"{",
"$",
"messages",
"=",
"array_reverse",
"(",
"$",
"messages",
")",
";",
"}",
"foreach",
"(",
"$",
"me... | 添加一批需要发送的消息
@param Message[] $messages
@param bool $prepend 控制添加的消息是添加在消息队列头部还是尾部,默认添加在尾部
@return $this | [
"添加一批需要发送的消息"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L188-L199 |
echo58/sms | src/Pool.php | Pool.send | public function send()
{
$providers = $this->providers;
$messages = $this->messages;
$this->unsetMessages();
foreach ($messages as &$message) {
foreach ($providers as $provider) {
$message->using($provider)->send();
if ($message->getStatus(... | php | public function send()
{
$providers = $this->providers;
$messages = $this->messages;
$this->unsetMessages();
foreach ($messages as &$message) {
foreach ($providers as $provider) {
$message->using($provider)->send();
if ($message->getStatus(... | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"providers",
"=",
"$",
"this",
"->",
"providers",
";",
"$",
"messages",
"=",
"$",
"this",
"->",
"messages",
";",
"$",
"this",
"->",
"unsetMessages",
"(",
")",
";",
"foreach",
"(",
"$",
"messages",
"as... | 依次发送当前短信列表中的短信
@return Message[] | [
"依次发送当前短信列表中的短信"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/Pool.php#L254-L271 |
yuncms/framework | src/rest/models/UserRecoveryForm.php | UserRecoveryForm.resetPassword | public function resetPassword()
{
if ($this->validate() && ($user = $this->getUser()) != null) {
$user->resetPassword($this->password);
return true;
}
return false;
} | php | public function resetPassword()
{
if ($this->validate() && ($user = $this->getUser()) != null) {
$user->resetPassword($this->password);
return true;
}
return false;
} | [
"public",
"function",
"resetPassword",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
"&&",
"(",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
")",
"!=",
"null",
")",
"{",
"$",
"user",
"->",
"resetPassword",
"(",
"... | 重置密码
@return boolean | [
"重置密码"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/models/UserRecoveryForm.php#L82-L89 |
yuncms/framework | src/user/migrations/m180228_112500Create_user_login_attempt_table.php | m180228_112500Create_user_login_attempt_table.safeUp | public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=Inn... | php | public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=Inn... | [
"public",
"function",
"safeUp",
"(",
")",
"{",
"$",
"tableOptions",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"db",
"->",
"driverName",
"===",
"'mysql'",
")",
"{",
"// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-... | {@inheritdoc} | [
"{"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/migrations/m180228_112500Create_user_login_attempt_table.php#L15-L34 |
dashifen/wordpress-php7-plugin-boilerplate | src/Controller/ControllerTraits/PostStatusesTrait.php | PostStatusesTrait.initPostStatusesTrait | final protected function initPostStatusesTrait(): void {
$postStatuses = $this->getPostStatuses();
// first, we register our statuses. notice that we directly call the
// WordPress add_action() function because we want to use anonymous
// functions here, and there's no good way to add these actions to a
/... | php | final protected function initPostStatusesTrait(): void {
$postStatuses = $this->getPostStatuses();
// first, we register our statuses. notice that we directly call the
// WordPress add_action() function because we want to use anonymous
// functions here, and there's no good way to add these actions to a
/... | [
"final",
"protected",
"function",
"initPostStatusesTrait",
"(",
")",
":",
"void",
"{",
"$",
"postStatuses",
"=",
"$",
"this",
"->",
"getPostStatuses",
"(",
")",
";",
"// first, we register our statuses. notice that we directly call the",
"// WordPress add_action() function b... | When we initialize this trait, we want to register our post statuses
and ensure that they appear in the status drop-downs throughout Word-
Press core.
@return void | [
"When",
"we",
"initialize",
"this",
"trait",
"we",
"want",
"to",
"register",
"our",
"post",
"statuses",
"and",
"ensure",
"that",
"they",
"appear",
"in",
"the",
"status",
"drop",
"-",
"downs",
"throughout",
"Word",
"-",
"Press",
"core",
"."
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/ControllerTraits/PostStatusesTrait.php#L38-L171 |
ClanCats/Core | src/bundles/Database/Query.php | Query.insert | public static function insert( $table, $values = array(), $handler = null )
{
return Query_Insert::create( $table, $handler )->values( $values );
} | php | public static function insert( $table, $values = array(), $handler = null )
{
return Query_Insert::create( $table, $handler )->values( $values );
} | [
"public",
"static",
"function",
"insert",
"(",
"$",
"table",
",",
"$",
"values",
"=",
"array",
"(",
")",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"return",
"Query_Insert",
"::",
"create",
"(",
"$",
"table",
",",
"$",
"handler",
")",
"->",
"values"... | Create an insert
@param string $table
@param array $values
@param string $handler
@return DB\Query | [
"Create",
"an",
"insert"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L50-L53 |
ClanCats/Core | src/bundles/Database/Query.php | Query.update | public static function update( $table, $values = array(), $handler = null )
{
return Query_Update::create( $table, $handler )->set( $values );
} | php | public static function update( $table, $values = array(), $handler = null )
{
return Query_Update::create( $table, $handler )->set( $values );
} | [
"public",
"static",
"function",
"update",
"(",
"$",
"table",
",",
"$",
"values",
"=",
"array",
"(",
")",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"return",
"Query_Update",
"::",
"create",
"(",
"$",
"table",
",",
"$",
"handler",
")",
"->",
"set",
... | Create an update
@param string $table
@param array $values
@param string $handler
@return DB\Query | [
"Create",
"an",
"update"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L63-L66 |
ClanCats/Core | src/bundles/Database/Query.php | Query.select | public static function select( $table, $fields = array(), $handler = null )
{
return Query_Select::create( $table, $handler )->fields( $fields );
} | php | public static function select( $table, $fields = array(), $handler = null )
{
return Query_Select::create( $table, $handler )->fields( $fields );
} | [
"public",
"static",
"function",
"select",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"array",
"(",
")",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"return",
"Query_Select",
"::",
"create",
"(",
"$",
"table",
",",
"$",
"handler",
")",
"->",
"fields"... | Select data from the database
@param string $table
@param array $fields
@param string $handler
@return mixed | [
"Select",
"data",
"from",
"the",
"database"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L88-L91 |
ClanCats/Core | src/bundles/Database/Query.php | Query.where | public function where( $column, $param1 = null, $param2 = null, $type = 'and' )
{
// if this is the first where element we are going to change
// the where type to 'where'
if ( empty( $this->wheres ) )
{
$type = 'where';
}
// when column is an array we assume to make a bulk and where.
// array( 'n... | php | public function where( $column, $param1 = null, $param2 = null, $type = 'and' )
{
// if this is the first where element we are going to change
// the where type to 'where'
if ( empty( $this->wheres ) )
{
$type = 'where';
}
// when column is an array we assume to make a bulk and where.
// array( 'n... | [
"public",
"function",
"where",
"(",
"$",
"column",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
",",
"$",
"type",
"=",
"'and'",
")",
"{",
"// if this is the first where element we are going to change",
"// the where type to 'where'",
"if",
"("... | Create a where statement
where query: <$column> <$param1> <$param2> <$type>
example:
->where( 'name', 'ladina' ) // name = landina
->where( 'age', '>', 18 )
->where( 'name', 'in', array( 'johanna', 'jennifer' ) )
@param string $column The SQL column
@param mixed $param1
@param mixed $param2
@param string $type... | [
"Create",
"a",
"where",
"statement"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L180-L224 |
ClanCats/Core | src/bundles/Database/Query.php | Query.or_where | public function or_where( $column, $param1 = null, $param2 = null )
{
return $this->where( $column, $param1, $param2, 'or' );
} | php | public function or_where( $column, $param1 = null, $param2 = null )
{
return $this->where( $column, $param1, $param2, 'or' );
} | [
"public",
"function",
"or_where",
"(",
"$",
"column",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"where",
"(",
"$",
"column",
",",
"$",
"param1",
",",
"$",
"param2",
",",
"'or'",
")",
... | Create an or where statement
This is the same as the normal where just with a fixed type
@param string $column The SQL column
@param mixed $param1
@param mixed $param2
@return self | [
"Create",
"an",
"or",
"where",
"statement"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L237-L240 |
ClanCats/Core | src/bundles/Database/Query.php | Query.and_where | public function and_where( $column, $param1 = null, $param2 = null )
{
return $this->where( $column, $param1, $param2, 'and' );
} | php | public function and_where( $column, $param1 = null, $param2 = null )
{
return $this->where( $column, $param1, $param2, 'and' );
} | [
"public",
"function",
"and_where",
"(",
"$",
"column",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"where",
"(",
"$",
"column",
",",
"$",
"param1",
",",
"$",
"param2",
",",
"'and'",
")",
... | Create an and where statement
This is the same as the normal where just with a fixed type
@param string $column The SQL column
@param mixed $param1
@param mixed $param2
@return self | [
"Create",
"an",
"and",
"where",
"statement"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L253-L256 |
ClanCats/Core | src/bundles/Database/Query.php | Query.run | public function run( $handler = null )
{
if ( !is_null( $handler ) )
{
$this->handler( $handler );
}
return $this->handler->run( $this->build(), $this->handler->builder()->parameters );
} | php | public function run( $handler = null )
{
if ( !is_null( $handler ) )
{
$this->handler( $handler );
}
return $this->handler->run( $this->build(), $this->handler->builder()->parameters );
} | [
"public",
"function",
"run",
"(",
"$",
"handler",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"handler",
")",
")",
"{",
"$",
"this",
"->",
"handler",
"(",
"$",
"handler",
")",
";",
"}",
"return",
"$",
"this",
"->",
"handler",
"->"... | Build and execute the current query
This wil run the local build function and pass the parameters
from the builder object in the handler
@param string $handler
@return mixed | [
"Build",
"and",
"execute",
"the",
"current",
"query",
"This",
"wil",
"run",
"the",
"local",
"build",
"function",
"and",
"pass",
"the",
"parameters",
"from",
"the",
"builder",
"object",
"in",
"the",
"handler"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L319-L327 |
aedart/laravel-helpers | src/Traits/Logging/LogManagerTrait.php | LogManagerTrait.getLogManager | public function getLogManager(): ?LogManager
{
if (!$this->hasLogManager()) {
$this->setLogManager($this->getDefaultLogManager());
}
return $this->logManager;
} | php | public function getLogManager(): ?LogManager
{
if (!$this->hasLogManager()) {
$this->setLogManager($this->getDefaultLogManager());
}
return $this->logManager;
} | [
"public",
"function",
"getLogManager",
"(",
")",
":",
"?",
"LogManager",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasLogManager",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setLogManager",
"(",
"$",
"this",
"->",
"getDefaultLogManager",
"(",
")",
")",
";"... | Get log manager
If no log manager has been set, this method will
set and return a default log manager, if any such
value is available
@see getDefaultLogManager()
@return LogManager|null log manager or null if none log manager has been set | [
"Get",
"log",
"manager"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Logging/LogManagerTrait.php#L52-L58 |
zodream/thirdparty | src/Pay/ChinaPay.php | ChinaPay.sign | public function sign($content) {
if (is_array($content)) {
$content = $this->getSignContent($content);
}
$sign_flag = openssl_sign($content,
$signature,
$this->privateKey['pkey'],
OPENSSL_ALGO_SHA512);
if (!$sign_flag) {
throw n... | php | public function sign($content) {
if (is_array($content)) {
$content = $this->getSignContent($content);
}
$sign_flag = openssl_sign($content,
$signature,
$this->privateKey['pkey'],
OPENSSL_ALGO_SHA512);
if (!$sign_flag) {
throw n... | [
"public",
"function",
"sign",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getSignContent",
"(",
"$",
"content",
")",
";",
"}",
"$",
"sign_flag",
"=",
"openssl_sign... | 签名
@param array|string $content
@return string
@throws \Exception
@internal param array|string $args | [
"签名"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/ChinaPay.php#L126-L138 |
zodream/thirdparty | src/Pay/ChinaPay.php | ChinaPay.getEncodeArray | public function getEncodeArray(array $args) {
$data = [];
foreach ($args as $key => $item) {
$data[] = sprintf('%s=%s', urlencode($key), urlencode($item));
}
return sprintf('{%s}', implode('&', $data));
} | php | public function getEncodeArray(array $args) {
$data = [];
foreach ($args as $key => $item) {
$data[] = sprintf('%s=%s', urlencode($key), urlencode($item));
}
return sprintf('{%s}', implode('&', $data));
} | [
"public",
"function",
"getEncodeArray",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"sprintf",
"(",
"'%s=%s'",
",",
... | 数组转换成字符串
@param array $args
@return string | [
"数组转换成字符串"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/ChinaPay.php#L178-L184 |
zodream/thirdparty | src/Pay/ChinaPay.php | ChinaPay.oldForm | public function oldForm(array $args, $buttonTip = '立即使用银联支付') {
$data = $this->encodeSign(Http::getMapParameters([
'Version' => '20140728',
'AccessType',// => '0',
'InstuId',
'AcqCode',
'#MerId',
'#MerOrderNo',
'#TranDate',// =>... | php | public function oldForm(array $args, $buttonTip = '立即使用银联支付') {
$data = $this->encodeSign(Http::getMapParameters([
'Version' => '20140728',
'AccessType',// => '0',
'InstuId',
'AcqCode',
'#MerId',
'#MerOrderNo',
'#TranDate',// =>... | [
"public",
"function",
"oldForm",
"(",
"array",
"$",
"args",
",",
"$",
"buttonTip",
"=",
"'立即使用银联支付') {",
"",
"",
"$",
"data",
"=",
"$",
"this",
"->",
"encodeSign",
"(",
"Http",
"::",
"getMapParameters",
"(",
"[",
"'Version'",
"=>",
"'20140728'",
",",
"'A... | 生成提交表单
@param array $args
@param string $buttonTip
@return string
@throws Exception | [
"生成提交表单"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/ChinaPay.php#L193-L232 |
zodream/thirdparty | src/Pay/ChinaPay.php | ChinaPay.declareOrder | public function declareOrder(array $args = array()) {
$args = $this->getDeclareOrder()
->parameters($this->merge($args))->json();
// 签名和验签方法不一样,要改
if (!$this->verify($args)) {
throw new Exception('数据验签失败!');
}
if ($args['respCode'] != '01') {
r... | php | public function declareOrder(array $args = array()) {
$args = $this->getDeclareOrder()
->parameters($this->merge($args))->json();
// 签名和验签方法不一样,要改
if (!$this->verify($args)) {
throw new Exception('数据验签失败!');
}
if ($args['respCode'] != '01') {
r... | [
"public",
"function",
"declareOrder",
"(",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"getDeclareOrder",
"(",
")",
"->",
"parameters",
"(",
"$",
"this",
"->",
"merge",
"(",
"$",
"args",
")",
")",
"-... | 报关
@param array $args
@return array|mixed
@throws Exception | [
"报关"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/ChinaPay.php#L258-L274 |
zodream/thirdparty | src/OAuth/BaseOAuth.php | BaseOAuth.login | public function login() {
$state = Str::randomNumber(7);
Factory::session()->set('state', $state);
$this->set('state', $state);
return $this->getLogin()->getUrl();
} | php | public function login() {
$state = Str::randomNumber(7);
Factory::session()->set('state', $state);
$this->set('state', $state);
return $this->getLogin()->getUrl();
} | [
"public",
"function",
"login",
"(",
")",
"{",
"$",
"state",
"=",
"Str",
"::",
"randomNumber",
"(",
"7",
")",
";",
"Factory",
"::",
"session",
"(",
")",
"->",
"set",
"(",
"'state'",
",",
"$",
"state",
")",
";",
"$",
"this",
"->",
"set",
"(",
"'sta... | 返回重定向到登录页面的链接
@return Uri
@throws \Exception | [
"返回重定向到登录页面的链接"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/OAuth/BaseOAuth.php#L61-L66 |
uthando-cms/uthando-dompdf | src/UthandoDomPdf/Form/View/Helper/PdfTextLineFormCollection.php | PdfTextLineFormCollection.renderTemplate | public function renderTemplate(Collection $collection)
{
$escapeHtmlAttribHelper = $this->getEscapeHtmlAttrHelper();
$fieldsetHelper = $this->getFieldsetHelper();
$templateMarkup = '';
$elementOrFieldset = $collection->getTemplateElement();
if ($elementOrFieldset instanceo... | php | public function renderTemplate(Collection $collection)
{
$escapeHtmlAttribHelper = $this->getEscapeHtmlAttrHelper();
$fieldsetHelper = $this->getFieldsetHelper();
$templateMarkup = '';
$elementOrFieldset = $collection->getTemplateElement();
if ($elementOrFieldset instanceo... | [
"public",
"function",
"renderTemplate",
"(",
"Collection",
"$",
"collection",
")",
"{",
"$",
"escapeHtmlAttribHelper",
"=",
"$",
"this",
"->",
"getEscapeHtmlAttrHelper",
"(",
")",
";",
"$",
"fieldsetHelper",
"=",
"$",
"this",
"->",
"getFieldsetHelper",
"(",
")",... | Only render a template
@param Collection $collection
@return string | [
"Only",
"render",
"a",
"template"
] | train | https://github.com/uthando-cms/uthando-dompdf/blob/60a750058c2db9ed167476192b20c7f544c32007/src/UthandoDomPdf/Form/View/Helper/PdfTextLineFormCollection.php#L129-L152 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.bundle | public static function bundle( $name, $path = null )
{
static::$bundles[$name] = $path;
static::$namespaces[$name] = $path.CCDIR_CLASS;
} | php | public static function bundle( $name, $path = null )
{
static::$bundles[$name] = $path;
static::$namespaces[$name] = $path.CCDIR_CLASS;
} | [
"public",
"static",
"function",
"bundle",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"null",
")",
"{",
"static",
"::",
"$",
"bundles",
"[",
"$",
"name",
"]",
"=",
"$",
"path",
";",
"static",
"::",
"$",
"namespaces",
"[",
"$",
"name",
"]",
"=",
"$",... | Add a bundle
A bundle is a CCF style package with classes, controllers, views etc.
@param string|array $name
@param path $path
@return void | [
"Add",
"a",
"bundle",
"A",
"bundle",
"is",
"a",
"CCF",
"style",
"package",
"with",
"classes",
"controllers",
"views",
"etc",
"."
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L68-L72 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.map | public static function map( $name, $path = null )
{
if ( is_array( $name ) )
{
static::$namespaces = array_merge( static::$namespaces, $name ); return;
}
static::$namespaces[$name] = $path;
} | php | public static function map( $name, $path = null )
{
if ( is_array( $name ) )
{
static::$namespaces = array_merge( static::$namespaces, $name ); return;
}
static::$namespaces[$name] = $path;
} | [
"public",
"static",
"function",
"map",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"static",
"::",
"$",
"namespaces",
"=",
"array_merge",
"(",
"static",
"::",
"$",
"namespaces",
... | Add one or more maps
A map is simply a class namepsace
@param string|array $name
@param path $path
@return void | [
"Add",
"one",
"or",
"more",
"maps",
"A",
"map",
"is",
"simply",
"a",
"class",
"namepsace"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L82-L89 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.shadow | public static function shadow( $name, $namespace, $path = null )
{
static::$shadows[$name] = $class = $namespace."\\".$name;
if ( !is_null( $path ) )
{
static::bind( $name, $class );
}
} | php | public static function shadow( $name, $namespace, $path = null )
{
static::$shadows[$name] = $class = $namespace."\\".$name;
if ( !is_null( $path ) )
{
static::bind( $name, $class );
}
} | [
"public",
"static",
"function",
"shadow",
"(",
"$",
"name",
",",
"$",
"namespace",
",",
"$",
"path",
"=",
"null",
")",
"{",
"static",
"::",
"$",
"shadows",
"[",
"$",
"name",
"]",
"=",
"$",
"class",
"=",
"$",
"namespace",
".",
"\"\\\\\"",
".",
"$",
... | Add a shadow class
A shadow class is a global class and gets liftet to the global namespace.
\Some\Longer\Namespace\Foo::bar() -> Foo::bar()
exmpale:
CCFinder::shadow( 'Foo', 'Some\Longer\Namespace', 'myclasses/Foo.php' );
@param string $name The shadow
@param string $namespace The real class namespace
@param s... | [
"Add",
"a",
"shadow",
"class",
"A",
"shadow",
"class",
"is",
"a",
"global",
"class",
"and",
"gets",
"liftet",
"to",
"the",
"global",
"namespace",
"."
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L105-L113 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.alias | public static function alias( $name, $path = null )
{
if ( is_array( $name ) )
{
static::$aliases = array_merge( static::$aliases, $name ); return;
}
static::$aliases[$name] = $path;
} | php | public static function alias( $name, $path = null )
{
if ( is_array( $name ) )
{
static::$aliases = array_merge( static::$aliases, $name ); return;
}
static::$aliases[$name] = $path;
} | [
"public",
"static",
"function",
"alias",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"static",
"::",
"$",
"aliases",
"=",
"array_merge",
"(",
"static",
"::",
"$",
"aliases",
","... | Add one or more aliases
An alias can overwrite an shadow. This way we can extend other classes.
example:
CCFinder::alias( 'Foo', '/path/to/my/Foo.php' );
@param string $name
@param path $path
@return void | [
"Add",
"one",
"or",
"more",
"aliases",
"An",
"alias",
"can",
"overwrite",
"an",
"shadow",
".",
"This",
"way",
"we",
"can",
"extend",
"other",
"classes",
"."
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L126-L133 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.bind | public static function bind( $name, $path = null )
{
if ( is_array( $name ) )
{
static::$classes = array_merge( static::$classes, $name ); return;
}
static::$classes[$name] = $path;
} | php | public static function bind( $name, $path = null )
{
if ( is_array( $name ) )
{
static::$classes = array_merge( static::$classes, $name ); return;
}
static::$classes[$name] = $path;
} | [
"public",
"static",
"function",
"bind",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"static",
"::",
"$",
"classes",
"=",
"array_merge",
"(",
"static",
"::",
"$",
"classes",
",",... | Add one or more class to the autoloader
@param string $name
@param path $path
@return void | [
"Add",
"one",
"or",
"more",
"class",
"to",
"the",
"autoloader"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L142-L149 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.package | public static function package( $dir, $classes )
{
foreach( $classes as $name => $path )
{
static::$classes[$name] = $dir.$path;
}
} | php | public static function package( $dir, $classes )
{
foreach( $classes as $name => $path )
{
static::$classes[$name] = $dir.$path;
}
} | [
"public",
"static",
"function",
"package",
"(",
"$",
"dir",
",",
"$",
"classes",
")",
"{",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"name",
"=>",
"$",
"path",
")",
"{",
"static",
"::",
"$",
"classes",
"[",
"$",
"name",
"]",
"=",
"$",
"dir",
"."... | This simply adds some classes with a prefix
@param string $name
@param path $path
@return void | [
"This",
"simply",
"adds",
"some",
"classes",
"with",
"a",
"prefix"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L159-L165 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.shadow_package | public static function shadow_package( $dir, $namespace, $shadows )
{
foreach( $shadows as $name => $path )
{
static::$shadows[$name] = $class = $namespace."\\".$name;
static::$classes[$class] = $dir.$path;
}
} | php | public static function shadow_package( $dir, $namespace, $shadows )
{
foreach( $shadows as $name => $path )
{
static::$shadows[$name] = $class = $namespace."\\".$name;
static::$classes[$class] = $dir.$path;
}
} | [
"public",
"static",
"function",
"shadow_package",
"(",
"$",
"dir",
",",
"$",
"namespace",
",",
"$",
"shadows",
")",
"{",
"foreach",
"(",
"$",
"shadows",
"as",
"$",
"name",
"=>",
"$",
"path",
")",
"{",
"static",
"::",
"$",
"shadows",
"[",
"$",
"name",... | This simply adds some shadows with a prefix
@param string $name
@param path $path
@return void | [
"This",
"simply",
"adds",
"some",
"shadows",
"with",
"a",
"prefix"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L175-L182 |
ClanCats/Core | src/classes/CCFinder.php | CCFinder.find | public static function find( $class )
{
if ( class_exists( $class, false ) )
{
return;
}
// class with or without namespace?
if ( strpos( $class , '\\' ) !== false )
{
/*
* alias map
*/
if ( array_key_exists( $class, static::$aliases ) )
{
require static::$aliases[$class];
}... | php | public static function find( $class )
{
if ( class_exists( $class, false ) )
{
return;
}
// class with or without namespace?
if ( strpos( $class , '\\' ) !== false )
{
/*
* alias map
*/
if ( array_key_exists( $class, static::$aliases ) )
{
require static::$aliases[$class];
}... | [
"public",
"static",
"function",
"find",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"class",
",",
"false",
")",
")",
"{",
"return",
";",
"}",
"// class with or without namespace?",
"if",
"(",
"strpos",
"(",
"$",
"class",
",",
"'\\\\... | Autoloading handler
@param string $class
@return bool | [
"Autoloading",
"handler"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L190-L298 |
aedart/laravel-helpers | src/Traits/Routing/RedirectTrait.php | RedirectTrait.getRedirect | public function getRedirect(): ?Redirector
{
if (!$this->hasRedirect()) {
$this->setRedirect($this->getDefaultRedirect());
}
return $this->redirect;
} | php | public function getRedirect(): ?Redirector
{
if (!$this->hasRedirect()) {
$this->setRedirect($this->getDefaultRedirect());
}
return $this->redirect;
} | [
"public",
"function",
"getRedirect",
"(",
")",
":",
"?",
"Redirector",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRedirect",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setRedirect",
"(",
"$",
"this",
"->",
"getDefaultRedirect",
"(",
")",
")",
";",
"}",... | Get redirect
If no redirect has been set, this method will
set and return a default redirect, if any such
value is available
@see getDefaultRedirect()
@return Redirector|null redirect or null if none redirect has been set | [
"Get",
"redirect"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Routing/RedirectTrait.php#L53-L59 |
redaigbaria/oauth2 | examples/relational/Storage/RefreshTokenStorage.php | RefreshTokenStorage.get | public function get($token)
{
$result = Capsule::table('oauth_refresh_tokens')
->where('refresh_token', $token)
->get();
if (count($result) === 1) {
$token = (new RefreshTokenEntity($this->server))
->setId($... | php | public function get($token)
{
$result = Capsule::table('oauth_refresh_tokens')
->where('refresh_token', $token)
->get();
if (count($result) === 1) {
$token = (new RefreshTokenEntity($this->server))
->setId($... | [
"public",
"function",
"get",
"(",
"$",
"token",
")",
"{",
"$",
"result",
"=",
"Capsule",
"::",
"table",
"(",
"'oauth_refresh_tokens'",
")",
"->",
"where",
"(",
"'refresh_token'",
",",
"$",
"token",
")",
"->",
"get",
"(",
")",
";",
"if",
"(",
"count",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/examples/relational/Storage/RefreshTokenStorage.php#L15-L31 |
redaigbaria/oauth2 | examples/relational/Storage/RefreshTokenStorage.php | RefreshTokenStorage.create | public function create($token, $expireTime, $accessToken)
{
Capsule::table('oauth_refresh_tokens')
->insert([
'refresh_token' => $token,
'access_token' => $accessToken,
'expire_time' => $expireTime,
... | php | public function create($token, $expireTime, $accessToken)
{
Capsule::table('oauth_refresh_tokens')
->insert([
'refresh_token' => $token,
'access_token' => $accessToken,
'expire_time' => $expireTime,
... | [
"public",
"function",
"create",
"(",
"$",
"token",
",",
"$",
"expireTime",
",",
"$",
"accessToken",
")",
"{",
"Capsule",
"::",
"table",
"(",
"'oauth_refresh_tokens'",
")",
"->",
"insert",
"(",
"[",
"'refresh_token'",
"=>",
"$",
"token",
",",
"'access_token'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/examples/relational/Storage/RefreshTokenStorage.php#L36-L44 |
Double-Opt-in/php-client-api | src/Client/Commands/LogCommand.php | LogCommand.setData | public function setData($data, $key = null)
{
if (is_array($data) && $key === null) {
$this->data = $data;
return $this;
}
if ($key === null)
$key = 'data';
$this->data[$key] = $data;
return $this;
} | php | public function setData($data, $key = null)
{
if (is_array($data) && $key === null) {
$this->data = $data;
return $this;
}
if ($key === null)
$key = 'data';
$this->data[$key] = $data;
return $this;
} | [
"public",
"function",
"setData",
"(",
"$",
"data",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"&&",
"$",
"key",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"return",
"$",... | setting data to add for the logging action
we suggest setting an array
@param array|mixed $data
@param null $key
@return $this | [
"setting",
"data",
"to",
"add",
"for",
"the",
"logging",
"action"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/LogCommand.php#L101-L115 |
Double-Opt-in/php-client-api | src/Client/Commands/LogCommand.php | LogCommand.body | public function body(CryptographyEngine $cryptographyEngine)
{
$body = array(
'hash' => $cryptographyEngine->hash($this->email),
'action' => $this->action,
);
if ( ! empty($this->scope))
$body['scope'] = $this->scope;
if ( ! empty($this->data))
$body['data'] = $cryptographyEngine->encrypt(json_en... | php | public function body(CryptographyEngine $cryptographyEngine)
{
$body = array(
'hash' => $cryptographyEngine->hash($this->email),
'action' => $this->action,
);
if ( ! empty($this->scope))
$body['scope'] = $this->scope;
if ( ! empty($this->data))
$body['data'] = $cryptographyEngine->encrypt(json_en... | [
"public",
"function",
"body",
"(",
"CryptographyEngine",
"$",
"cryptographyEngine",
")",
"{",
"$",
"body",
"=",
"array",
"(",
"'hash'",
"=>",
"$",
"cryptographyEngine",
"->",
"hash",
"(",
"$",
"this",
"->",
"email",
")",
",",
"'action'",
"=>",
"$",
"this",... | returns the body
hash: email will be hashed before requesting the server
action: action will be transmitted in plain text
scope: optional scope will be transmitted in plain text
data: optional data will be encrypted before requesting the server
@param CryptographyEngine $cryptographyEngine
@return array|\Guzzle\Http... | [
"returns",
"the",
"body"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/LogCommand.php#L129-L153 |
Double-Opt-in/php-client-api | src/Client/Commands/LogCommand.php | LogCommand.setIp | public function setIp($ip)
{
if (null !== $ip) {
if ( ! filter_var($ip, FILTER_VALIDATE_IP))
throw new \InvalidArgumentException('Parameter ip is not a valid ip');
}
$this->ip = $ip;
return $this;
} | php | public function setIp($ip)
{
if (null !== $ip) {
if ( ! filter_var($ip, FILTER_VALIDATE_IP))
throw new \InvalidArgumentException('Parameter ip is not a valid ip');
}
$this->ip = $ip;
return $this;
} | [
"public",
"function",
"setIp",
"(",
"$",
"ip",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"ip",
")",
"{",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"ip",
",",
"FILTER_VALIDATE_IP",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Paramete... | sets ip
@param null|string $ip
@return $this
@throws \InvalidArgumentException when ip validation failed | [
"sets",
"ip"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/LogCommand.php#L176-L186 |
Double-Opt-in/php-client-api | src/Client/Commands/LogCommand.php | LogCommand.setCreatedAt | public function setCreatedAt($created_at)
{
if (null !== $created_at) {
if ($created_at instanceof \DateTime)
$created_at = $created_at->format('Y-m-d H:i:s');
elseif ( ! strtotime($created_at))
throw new \InvalidArgumentException('Parameter created_at is not a valid date string');
}
$this->create... | php | public function setCreatedAt($created_at)
{
if (null !== $created_at) {
if ($created_at instanceof \DateTime)
$created_at = $created_at->format('Y-m-d H:i:s');
elseif ( ! strtotime($created_at))
throw new \InvalidArgumentException('Parameter created_at is not a valid date string');
}
$this->create... | [
"public",
"function",
"setCreatedAt",
"(",
"$",
"created_at",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"created_at",
")",
"{",
"if",
"(",
"$",
"created_at",
"instanceof",
"\\",
"DateTime",
")",
"$",
"created_at",
"=",
"$",
"created_at",
"->",
"format",
"... | sets created_at
@param null|string|\DateTime $created_at
@return $this
@throws \InvalidArgumentException when date validation failed | [
"sets",
"created_at"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/LogCommand.php#L210-L222 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.getList | public function getList($id = null, $key = null, $value = null, $spacer = ' ') {
$left = $this->getConfig('leftField');
$right = $this->getConfig('rightField');
$query = $this->getRepository()->select()->orderBy($left, 'asc');
if ($id) {
if ($parentNode = $this->getNode(... | php | public function getList($id = null, $key = null, $value = null, $spacer = ' ') {
$left = $this->getConfig('leftField');
$right = $this->getConfig('rightField');
$query = $this->getRepository()->select()->orderBy($left, 'asc');
if ($id) {
if ($parentNode = $this->getNode(... | [
"public",
"function",
"getList",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"key",
"=",
"null",
",",
"$",
"value",
"=",
"null",
",",
"$",
"spacer",
"=",
"' '",
")",
"{",
"$",
"left",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'leftField'",
")",
";... | Return a list of nodes indented to indicate tree level.
The $key and $value will be used to extract values from the node.
If no ID is provided, the top level root will be used.
@param int $id
@param string $key
@param string $value
@param string $spacer
@return array | [
"Return",
"a",
"list",
"of",
"nodes",
"indented",
"to",
"indicate",
"tree",
"level",
".",
"The",
"$key",
"and",
"$value",
"will",
"be",
"used",
"to",
"extract",
"values",
"from",
"the",
"node",
".",
"If",
"no",
"ID",
"is",
"provided",
"the",
"top",
"le... | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L95-L110 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.getNode | public function getNode($id, $withParent = false) {
$repo = $this->getRepository();
$pk = $repo->getPrimaryKey();
$query = $repo->select();
if ($withParent) {
$query
->where($repo->getAlias() . '.' . $pk, $id)
->leftJoin(
[... | php | public function getNode($id, $withParent = false) {
$repo = $this->getRepository();
$pk = $repo->getPrimaryKey();
$query = $repo->select();
if ($withParent) {
$query
->where($repo->getAlias() . '.' . $pk, $id)
->leftJoin(
[... | [
"public",
"function",
"getNode",
"(",
"$",
"id",
",",
"$",
"withParent",
"=",
"false",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"pk",
"=",
"$",
"repo",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"query",
... | Return a node by ID. If $withParent is true, parent data will be joined in.
@param int $id
@param bool $withParent
@return \Titon\Db\Entity | [
"Return",
"a",
"node",
"by",
"ID",
".",
"If",
"$withParent",
"is",
"true",
"parent",
"data",
"will",
"be",
"joined",
"in",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L119-L137 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.getPath | public function getPath($id) {
$node = $this->getNode($id);
if (!$node) {
return [];
}
$left = $this->getConfig('leftField');
$right = $this->getConfig('rightField');
return $this->getRepository()->select()
->where($left, '<', $node[$left])
... | php | public function getPath($id) {
$node = $this->getNode($id);
if (!$node) {
return [];
}
$left = $this->getConfig('leftField');
$right = $this->getConfig('rightField');
return $this->getRepository()->select()
->where($left, '<', $node[$left])
... | [
"public",
"function",
"getPath",
"(",
"$",
"id",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"getNode",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"left",
"=",
"$",
"this",
"->",
"... | Return the hierarchical path to the current node.
@param int $id
@return \Titon\Db\EntityCollection | [
"Return",
"the",
"hierarchical",
"path",
"to",
"the",
"current",
"node",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L145-L160 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.getTree | public function getTree($id = null) {
$parent = $this->getConfig('parentField');
$left = $this->getConfig('leftField');
$right = $this->getConfig('rightField');
$query = $this->getRepository()->select()->orderBy($left, 'asc');
if ($id) {
if ($parentNode = $this->get... | php | public function getTree($id = null) {
$parent = $this->getConfig('parentField');
$left = $this->getConfig('leftField');
$right = $this->getConfig('rightField');
$query = $this->getRepository()->select()->orderBy($left, 'asc');
if ($id) {
if ($parentNode = $this->get... | [
"public",
"function",
"getTree",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'parentField'",
")",
";",
"$",
"left",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'leftField'",
")",
";",
"$",
"right",
... | Return a tree of nested nodes. If no ID is provided, the top level root will be used.
@param int $id
@return array | [
"Return",
"a",
"tree",
"of",
"nested",
"nodes",
".",
"If",
"no",
"ID",
"is",
"provided",
"the",
"top",
"level",
"root",
"will",
"be",
"used",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L168-L208 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.mapList | public function mapList(array $nodes, $key, $value, $spacer) {
$tree = [];
$stack = [];
$key = $key ?: $this->getRepository()->getPrimaryKey();
$value = $value ?: $this->getRepository()->getDisplayField();
$right = $this->getConfig('rightField');
foreach ($nodes as $node... | php | public function mapList(array $nodes, $key, $value, $spacer) {
$tree = [];
$stack = [];
$key = $key ?: $this->getRepository()->getPrimaryKey();
$value = $value ?: $this->getRepository()->getDisplayField();
$right = $this->getConfig('rightField');
foreach ($nodes as $node... | [
"public",
"function",
"mapList",
"(",
"array",
"$",
"nodes",
",",
"$",
"key",
",",
"$",
"value",
",",
"$",
"spacer",
")",
"{",
"$",
"tree",
"=",
"[",
"]",
";",
"$",
"stack",
"=",
"[",
"]",
";",
"$",
"key",
"=",
"$",
"key",
"?",
":",
"$",
"t... | Map a nested tree using the primary key and display field as the values to populate the list.
Nested lists will be prepended with a spacer to indicate indentation.
@param array $nodes
@param string $key
@param string $value
@param string $spacer
@return array | [
"Map",
"a",
"nested",
"tree",
"using",
"the",
"primary",
"key",
"and",
"display",
"field",
"as",
"the",
"values",
"to",
"populate",
"the",
"list",
".",
"Nested",
"lists",
"will",
"be",
"prepended",
"with",
"a",
"spacer",
"to",
"indicate",
"indentation",
".... | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L220-L241 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.mapTree | public function mapTree(array $nodes, array $mappedNodes = []) {
if (!$mappedNodes) {
return $nodes;
}
$tree = [];
$pk = $this->getRepository()->getPrimaryKey();
foreach ($nodes as $node) {
$id = $node[$pk];
if (isset($mappedNodes[$id])) {
... | php | public function mapTree(array $nodes, array $mappedNodes = []) {
if (!$mappedNodes) {
return $nodes;
}
$tree = [];
$pk = $this->getRepository()->getPrimaryKey();
foreach ($nodes as $node) {
$id = $node[$pk];
if (isset($mappedNodes[$id])) {
... | [
"public",
"function",
"mapTree",
"(",
"array",
"$",
"nodes",
",",
"array",
"$",
"mappedNodes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"mappedNodes",
")",
"{",
"return",
"$",
"nodes",
";",
"}",
"$",
"tree",
"=",
"[",
"]",
";",
"$",
"pk",
... | Map a nested tree of arrays using the parent node stack and the mapped nodes by parent ID.
@param array $nodes
@param array $mappedNodes
@return array | [
"Map",
"a",
"nested",
"tree",
"of",
"arrays",
"using",
"the",
"parent",
"node",
"stack",
"and",
"the",
"mapped",
"nodes",
"by",
"parent",
"ID",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L250-L269 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.moveDown | public function moveDown($id, $count = 1) {
$pk = $this->getRepository()->getPrimaryKey();
$node = $this->getNode($id, true);
if (!$node || empty($node['Parent']['id'])) {
return false;
}
$left = $this->getConfig('leftField');
$right = $this->getConfig('righ... | php | public function moveDown($id, $count = 1) {
$pk = $this->getRepository()->getPrimaryKey();
$node = $this->getNode($id, true);
if (!$node || empty($node['Parent']['id'])) {
return false;
}
$left = $this->getConfig('leftField');
$right = $this->getConfig('righ... | [
"public",
"function",
"moveDown",
"(",
"$",
"id",
",",
"$",
"count",
"=",
"1",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"node",
"=",
"$",
"this",
"->",
"getNode",
"(",
"$",... | Move a child node down in the list and move up neighboring nodes.
If the node does not have a parent (is a root node), this method will not work.
@param int $id
@param int $count
@return bool | [
"Move",
"a",
"child",
"node",
"down",
"in",
"the",
"list",
"and",
"move",
"up",
"neighboring",
"nodes",
".",
"If",
"the",
"node",
"does",
"not",
"have",
"a",
"parent",
"(",
"is",
"a",
"root",
"node",
")",
"this",
"method",
"will",
"not",
"work",
"."
... | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L279-L326 |
titon/db | src/Titon/Db/Behavior/HierarchyBehavior.php | HierarchyBehavior.moveTo | public function moveTo($id, $parent_id) {
$pk = $this->getRepository()->getPrimaryKey();
$node = $this->getNode($id);
if (!$node || $node[$this->getConfig('parentField')] == $parent_id) {
return false;
}
$left = $this->getConfig('leftField');
$right = $this-... | php | public function moveTo($id, $parent_id) {
$pk = $this->getRepository()->getPrimaryKey();
$node = $this->getNode($id);
if (!$node || $node[$this->getConfig('parentField')] == $parent_id) {
return false;
}
$left = $this->getConfig('leftField');
$right = $this-... | [
"public",
"function",
"moveTo",
"(",
"$",
"id",
",",
"$",
"parent_id",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"node",
"=",
"$",
"this",
"->",
"getNode",
"(",
"$",
"id",
"... | Move a node between parents and the root. This will re-order the tree accordingly.
If $parent_id is null, the node will be moved to the root.
@param int $id
@param int $parent_id
@return bool | [
"Move",
"a",
"node",
"between",
"parents",
"and",
"the",
"root",
".",
"This",
"will",
"re",
"-",
"order",
"the",
"tree",
"accordingly",
".",
"If",
"$parent_id",
"is",
"null",
"the",
"node",
"will",
"be",
"moved",
"to",
"the",
"root",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/HierarchyBehavior.php#L393-L433 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.