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
sequencelengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
sequencelengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
sciactive/nymph-server
src/Drivers/MySQLDriver.php
MySQLDriver.createTables
private function createTables($etype = null) { $this->query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";'); if ($this->config['MySQL']['foreign_keys']) { $foreignKeyEntityTableGuid = " REFERENCES `{$this->prefix}guids`(`guid`) ON DELETE CASCADE"; $foreignKeyDataTableGuid = " REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE"; $foreignKeyDataComparisonsTableGuid = " REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE"; $foreignKeyReferencesTableGuid = " REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE"; } else { $foreignKeyEntityTableGuid = ''; $foreignKeyDataTableGuid = ''; $foreignKeyDataComparisonsTableGuid = ''; $foreignKeyReferencesTableGuid = ''; } if (isset($etype)) { $etype = '_'.mysqli_real_escape_string($this->link, $etype); // Create the entity table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}entities{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL{$foreignKeyEntityTableGuid}, ". "`tags` LONGTEXT, ". "`cdate` DECIMAL(18,6) NOT NULL, ". "`mdate` DECIMAL(18,6) NOT NULL, ". "PRIMARY KEY (`guid`), ". "INDEX `id_cdate` USING BTREE (`cdate`), ". "INDEX `id_mdate` USING BTREE (`mdate`), ". "FULLTEXT `id_tags` (`tags`) ". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the data table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}data{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL{$foreignKeyDataTableGuid}, ". "`name` TEXT NOT NULL, ". "`value` LONGTEXT NOT NULL, ". "PRIMARY KEY (`guid`,`name`(255)), ". "INDEX `id_name` USING HASH (`name`(255)), ". "INDEX `id_name_value` USING BTREE (`name`(255), `value`(512))". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the data comparisons table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}comparisons{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL". "{$foreignKeyDataComparisonsTableGuid}, ". "`name` TEXT NOT NULL, ". "`eq_true` BOOLEAN, ". "`eq_one` BOOLEAN, ". "`eq_zero` BOOLEAN, ". "`eq_negone` BOOLEAN, ". "`eq_emptyarray` BOOLEAN, ". "`string` LONGTEXT, ". "`int` BIGINT, ". "`float` DOUBLE, ". "`is_int` BOOLEAN NOT NULL, ". "PRIMARY KEY (`guid`, `name`(255)), ". "INDEX `id_name` USING HASH (`name`(255))". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the references table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}references{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL". "{$foreignKeyDataComparisonsTableGuid}, ". "`name` TEXT NOT NULL, ". "`reference` BIGINT(20) UNSIGNED NOT NULL, ". "PRIMARY KEY (`guid`, `name`(255), `reference`), ". "INDEX `id_name_reference` USING BTREE (`name`(255), `reference`)". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); } else { // Create the GUID table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}guids` (". "`guid` BIGINT(20) UNSIGNED NOT NULL, ". "PRIMARY KEY (`guid`)". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the UID table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}uids` (". "`name` TEXT NOT NULL, ". "`cur_uid` BIGINT(20) UNSIGNED NOT NULL, ". "PRIMARY KEY (`name`(100))". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); } return true; }
php
private function createTables($etype = null) { $this->query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";'); if ($this->config['MySQL']['foreign_keys']) { $foreignKeyEntityTableGuid = " REFERENCES `{$this->prefix}guids`(`guid`) ON DELETE CASCADE"; $foreignKeyDataTableGuid = " REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE"; $foreignKeyDataComparisonsTableGuid = " REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE"; $foreignKeyReferencesTableGuid = " REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE"; } else { $foreignKeyEntityTableGuid = ''; $foreignKeyDataTableGuid = ''; $foreignKeyDataComparisonsTableGuid = ''; $foreignKeyReferencesTableGuid = ''; } if (isset($etype)) { $etype = '_'.mysqli_real_escape_string($this->link, $etype); // Create the entity table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}entities{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL{$foreignKeyEntityTableGuid}, ". "`tags` LONGTEXT, ". "`cdate` DECIMAL(18,6) NOT NULL, ". "`mdate` DECIMAL(18,6) NOT NULL, ". "PRIMARY KEY (`guid`), ". "INDEX `id_cdate` USING BTREE (`cdate`), ". "INDEX `id_mdate` USING BTREE (`mdate`), ". "FULLTEXT `id_tags` (`tags`) ". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the data table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}data{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL{$foreignKeyDataTableGuid}, ". "`name` TEXT NOT NULL, ". "`value` LONGTEXT NOT NULL, ". "PRIMARY KEY (`guid`,`name`(255)), ". "INDEX `id_name` USING HASH (`name`(255)), ". "INDEX `id_name_value` USING BTREE (`name`(255), `value`(512))". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the data comparisons table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}comparisons{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL". "{$foreignKeyDataComparisonsTableGuid}, ". "`name` TEXT NOT NULL, ". "`eq_true` BOOLEAN, ". "`eq_one` BOOLEAN, ". "`eq_zero` BOOLEAN, ". "`eq_negone` BOOLEAN, ". "`eq_emptyarray` BOOLEAN, ". "`string` LONGTEXT, ". "`int` BIGINT, ". "`float` DOUBLE, ". "`is_int` BOOLEAN NOT NULL, ". "PRIMARY KEY (`guid`, `name`(255)), ". "INDEX `id_name` USING HASH (`name`(255))". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the references table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}references{$etype}` (". "`guid` BIGINT(20) UNSIGNED NOT NULL". "{$foreignKeyDataComparisonsTableGuid}, ". "`name` TEXT NOT NULL, ". "`reference` BIGINT(20) UNSIGNED NOT NULL, ". "PRIMARY KEY (`guid`, `name`(255), `reference`), ". "INDEX `id_name_reference` USING BTREE (`name`(255), `reference`)". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); } else { // Create the GUID table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}guids` (". "`guid` BIGINT(20) UNSIGNED NOT NULL, ". "PRIMARY KEY (`guid`)". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); // Create the UID table. $this->query( "CREATE TABLE IF NOT EXISTS `{$this->prefix}uids` (". "`name` TEXT NOT NULL, ". "`cur_uid` BIGINT(20) UNSIGNED NOT NULL, ". "PRIMARY KEY (`name`(100))". ") ENGINE {$this->config['MySQL']['engine']} ". "CHARACTER SET utf8 COLLATE utf8_bin;" ); } return true; }
[ "private", "function", "createTables", "(", "$", "etype", "=", "null", ")", "{", "$", "this", "->", "query", "(", "'SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";'", ")", ";", "if", "(", "$", "this", "->", "config", "[", "'MySQL'", "]", "[", "'foreign_keys'", "]", ")", "{", "$", "foreignKeyEntityTableGuid", "=", "\" REFERENCES `{$this->prefix}guids`(`guid`) ON DELETE CASCADE\"", ";", "$", "foreignKeyDataTableGuid", "=", "\" REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE\"", ";", "$", "foreignKeyDataComparisonsTableGuid", "=", "\" REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE\"", ";", "$", "foreignKeyReferencesTableGuid", "=", "\" REFERENCES `{$this->prefix}entities{$etype}`(`guid`) ON DELETE CASCADE\"", ";", "}", "else", "{", "$", "foreignKeyEntityTableGuid", "=", "''", ";", "$", "foreignKeyDataTableGuid", "=", "''", ";", "$", "foreignKeyDataComparisonsTableGuid", "=", "''", ";", "$", "foreignKeyReferencesTableGuid", "=", "''", ";", "}", "if", "(", "isset", "(", "$", "etype", ")", ")", "{", "$", "etype", "=", "'_'", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "etype", ")", ";", "// Create the entity table.", "$", "this", "->", "query", "(", "\"CREATE TABLE IF NOT EXISTS `{$this->prefix}entities{$etype}` (\"", ".", "\"`guid` BIGINT(20) UNSIGNED NOT NULL{$foreignKeyEntityTableGuid}, \"", ".", "\"`tags` LONGTEXT, \"", ".", "\"`cdate` DECIMAL(18,6) NOT NULL, \"", ".", "\"`mdate` DECIMAL(18,6) NOT NULL, \"", ".", "\"PRIMARY KEY (`guid`), \"", ".", "\"INDEX `id_cdate` USING BTREE (`cdate`), \"", ".", "\"INDEX `id_mdate` USING BTREE (`mdate`), \"", ".", "\"FULLTEXT `id_tags` (`tags`) \"", ".", "\") ENGINE {$this->config['MySQL']['engine']} \"", ".", "\"CHARACTER SET utf8 COLLATE utf8_bin;\"", ")", ";", "// Create the data table.", "$", "this", "->", "query", "(", "\"CREATE TABLE IF NOT EXISTS `{$this->prefix}data{$etype}` (\"", ".", "\"`guid` BIGINT(20) UNSIGNED NOT NULL{$foreignKeyDataTableGuid}, \"", ".", "\"`name` TEXT NOT NULL, \"", ".", "\"`value` LONGTEXT NOT NULL, \"", ".", "\"PRIMARY KEY (`guid`,`name`(255)), \"", ".", "\"INDEX `id_name` USING HASH (`name`(255)), \"", ".", "\"INDEX `id_name_value` USING BTREE (`name`(255), `value`(512))\"", ".", "\") ENGINE {$this->config['MySQL']['engine']} \"", ".", "\"CHARACTER SET utf8 COLLATE utf8_bin;\"", ")", ";", "// Create the data comparisons table.", "$", "this", "->", "query", "(", "\"CREATE TABLE IF NOT EXISTS `{$this->prefix}comparisons{$etype}` (\"", ".", "\"`guid` BIGINT(20) UNSIGNED NOT NULL\"", ".", "\"{$foreignKeyDataComparisonsTableGuid}, \"", ".", "\"`name` TEXT NOT NULL, \"", ".", "\"`eq_true` BOOLEAN, \"", ".", "\"`eq_one` BOOLEAN, \"", ".", "\"`eq_zero` BOOLEAN, \"", ".", "\"`eq_negone` BOOLEAN, \"", ".", "\"`eq_emptyarray` BOOLEAN, \"", ".", "\"`string` LONGTEXT, \"", ".", "\"`int` BIGINT, \"", ".", "\"`float` DOUBLE, \"", ".", "\"`is_int` BOOLEAN NOT NULL, \"", ".", "\"PRIMARY KEY (`guid`, `name`(255)), \"", ".", "\"INDEX `id_name` USING HASH (`name`(255))\"", ".", "\") ENGINE {$this->config['MySQL']['engine']} \"", ".", "\"CHARACTER SET utf8 COLLATE utf8_bin;\"", ")", ";", "// Create the references table.", "$", "this", "->", "query", "(", "\"CREATE TABLE IF NOT EXISTS `{$this->prefix}references{$etype}` (\"", ".", "\"`guid` BIGINT(20) UNSIGNED NOT NULL\"", ".", "\"{$foreignKeyDataComparisonsTableGuid}, \"", ".", "\"`name` TEXT NOT NULL, \"", ".", "\"`reference` BIGINT(20) UNSIGNED NOT NULL, \"", ".", "\"PRIMARY KEY (`guid`, `name`(255), `reference`), \"", ".", "\"INDEX `id_name_reference` USING BTREE (`name`(255), `reference`)\"", ".", "\") ENGINE {$this->config['MySQL']['engine']} \"", ".", "\"CHARACTER SET utf8 COLLATE utf8_bin;\"", ")", ";", "}", "else", "{", "// Create the GUID table.", "$", "this", "->", "query", "(", "\"CREATE TABLE IF NOT EXISTS `{$this->prefix}guids` (\"", ".", "\"`guid` BIGINT(20) UNSIGNED NOT NULL, \"", ".", "\"PRIMARY KEY (`guid`)\"", ".", "\") ENGINE {$this->config['MySQL']['engine']} \"", ".", "\"CHARACTER SET utf8 COLLATE utf8_bin;\"", ")", ";", "// Create the UID table.", "$", "this", "->", "query", "(", "\"CREATE TABLE IF NOT EXISTS `{$this->prefix}uids` (\"", ".", "\"`name` TEXT NOT NULL, \"", ".", "\"`cur_uid` BIGINT(20) UNSIGNED NOT NULL, \"", ".", "\"PRIMARY KEY (`name`(100))\"", ".", "\") ENGINE {$this->config['MySQL']['engine']} \"", ".", "\"CHARACTER SET utf8 COLLATE utf8_bin;\"", ")", ";", "}", "return", "true", ";", "}" ]
Create entity tables in the database. @param string $etype The entity type to create a table for. If this is blank, the default tables are created. @return bool True on success, false on failure.
[ "Create", "entity", "tables", "in", "the", "database", "." ]
train
https://github.com/sciactive/nymph-server/blob/3c18dbf45c2750d07c798e14534dba87387beeba/src/Drivers/MySQLDriver.php#L123-L216
sciactive/nymph-server
src/Drivers/MySQLDriver.php
MySQLDriver.makeEntityQuery
private function makeEntityQuery( $options, $selectors, $etypeDirty, $subquery = false ) { $fullQueryCoverage = true; $sort = $options['sort'] ?? 'cdate'; $etype = '_'.mysqli_real_escape_string($this->link, $etypeDirty); $queryParts = $this->iterateSelectorsForQuery($selectors, function ($value) use ($options, $etypeDirty, &$fullQueryCoverage) { $subquery = $this->makeEntityQuery( $options, [$value], $etypeDirty, true ); $fullQueryCoverage = $fullQueryCoverage && $subquery['fullCoverage']; return $subquery['query']; }, function (&$curQuery, $key, $value, $typeIsOr, $typeIsNot) use ($etype, &$fullQueryCoverage) { $clauseNot = $key[0] === '!'; // Any options having to do with data only return if the // entity has the specified variables. foreach ($value as $curValue) { switch ($key) { case 'guid': case '!guid': foreach ($curValue as $curGuid) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`guid`=\''.(int) $curGuid.'\''; } break; case 'tag': case '!tag': if ($typeIsNot xor $clauseNot) { if ($typeIsOr) { foreach ($curValue as $curTag) { if ($curQuery) { $curQuery .= ' OR '; } $curQuery .= 'ie.`tags` NOT REGEXP \' '. mysqli_real_escape_string($this->link, $curTag). ' \''; } } else { $curQuery .= 'ie.`tags` NOT REGEXP \' ('. mysqli_real_escape_string( $this->link, implode('|', $curValue) ).') \''; } } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $groupQuery = ''; foreach ($curValue as $curTag) { $groupQuery .= ($typeIsOr ? ' ' : ' +'). '"'.mysqli_real_escape_string($this->link, $curTag).'"'; } $curQuery .= 'MATCH (ie.`tags`) AGAINST (\''. $groupQuery.'\' IN BOOLEAN MODE)'; } break; case 'isset': case '!isset': foreach ($curValue as $curVar) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'data', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curVar). '\' AND `value`!=\'N;\'', $typeIsNot xor $clauseNot ); } break; case 'ref': case '!ref': $guids = []; if (is_array($curValue[1])) { if (key_exists('guid', $curValue[1])) { $guids[] = (int) $curValue[1]['guid']; } else { foreach ($curValue[1] as $curEntity) { if (is_object($curEntity)) { $guids[] = (int) $curEntity->guid; } elseif (is_array($curEntity)) { $guids[] = (int) $curEntity['guid']; } else { $guids[] = (int) $curEntity; } } } } elseif (is_object($curValue[1])) { $guids[] = (int) $curValue[1]->guid; } else { $guids[] = (int) $curValue[1]; } foreach ($guids as $curQguid) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'references', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `reference`='. mysqli_real_escape_string($this->link, (int) $curQguid), $typeIsNot xor $clauseNot ); } break; case 'strict': case '!strict': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`='.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } if (is_callable([$curValue[1], 'toReference'])) { $svalue = serialize($curValue[1]->toReference()); } else { $svalue = serialize($curValue[1]); } $curQuery .= $this->makeDataPart( 'data', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `value`=\''. mysqli_real_escape_string($this->link, $svalue).'\'', $typeIsNot xor $clauseNot ); } break; case 'like': case '!like': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` LIKE \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` LIKE \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `string` LIKE \''. mysqli_real_escape_string($this->link, $curValue[1]). '\'', $typeIsNot xor $clauseNot ); } break; case 'ilike': case '!ilike': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` LIKE LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` LIKE LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND LOWER(`string`) LIKE LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\')', $typeIsNot xor $clauseNot ); } break; case 'pmatch': case '!pmatch': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` REGEXP \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` REGEXP \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `string` REGEXP \''. mysqli_real_escape_string($this->link, $curValue[1]). '\'', $typeIsNot xor $clauseNot ); } break; case 'ipmatch': case '!ipmatch': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` REGEXP LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` REGEXP LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND LOWER(`string`) REGEXP LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\')', $typeIsNot xor $clauseNot ); } break; case 'gt': case '!gt': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`>'.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`>'.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` > '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` > '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; case 'gte': case '!gte': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`>='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`>='.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` >= '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` >= '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; case 'lt': case '!lt': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`<'.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`<'.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` < '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` < '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; case 'lte': case '!lte': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`<='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`<='.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` <= '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` <= '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; // Cases after this point contains special values where // it can be solved by the query, but if those values // don't match, just check the variable exists. case 'equal': case '!equal': case 'data': case '!data': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie."cdate"='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie."mdate"='.((float) $curValue[1]); break; } elseif ($curValue[1] === true || $curValue[1] === false) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_true`='.($curValue[1] ? 'TRUE' : 'FALSE'), $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === 1) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_one`=TRUE', $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === 0) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_zero`=TRUE', $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === -1) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_negone`=TRUE', $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === []) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_emptyarray`=TRUE', $typeIsNot xor $clauseNot ); break; } // Fall through. case 'match': case '!match': case 'array': case '!array': if (!($typeIsNot xor $clauseNot) && $curValue[0] !== 'cdate' && $curValue[0] !== 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'data', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]).'\'', $typeIsNot xor $clauseNot ); } $fullQueryCoverage = false; break; } } }); switch ($sort) { case 'guid': $sort = '`guid`'; break; case 'mdate': $sort = '`mdate`'; break; case 'cdate': default: $sort = '`cdate`'; break; } if (isset($options['reverse']) && $options['reverse']) { $sort .= ' DESC'; } if ($queryParts) { if ($subquery) { $query = "((".implode(') AND (', $queryParts)."))"; } else { $limit = ""; if ($fullQueryCoverage && key_exists('limit', $options)) { $limit = " LIMIT ".((int) $options['limit']); } $offset = ""; if ($fullQueryCoverage && key_exists('offset', $options)) { $offset = " OFFSET ".((int) $options['offset']); } $query = "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ". "d.`name`, d.`value` ". "FROM `{$this->prefix}entities{$etype}` e ". "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ". "INNER JOIN (". "SELECT ie.`guid` FROM `{$this->prefix}entities{$etype}` ie ". "WHERE (". implode(') AND (', $queryParts). ") ". "ORDER BY ie.{$sort}{$limit}{$offset}". ") f ON e.`guid`=f.`guid` ". "ORDER BY e.{$sort};"; } } else { if ($subquery) { $query = ''; } else { $limit = ""; if (key_exists('limit', $options)) { $limit = " LIMIT ".((int) $options['limit']); } $offset = ""; if (key_exists('offset', $options)) { $offset = " OFFSET ".((int) $options['offset']); } if ($limit || $offset) { $query = "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ". "d.`name`, d.`value` ". "FROM `{$this->prefix}entities{$etype}` e ". "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ". "INNER JOIN (". "SELECT ie.`guid` ". "FROM `{$this->prefix}entities{$etype}` ie ". "ORDER BY ie.{$sort}{$limit}{$offset}". ") f ON e.`guid`=f.`guid` ". "ORDER BY e.{$sort};"; } else { $query = "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ". "d.`name`, d.`value` ". "FROM `{$this->prefix}entities{$etype}` e ". "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ". "ORDER BY e.{$sort};"; } } } return [ 'fullCoverage' => $fullQueryCoverage, 'limitOffsetCoverage' => $fullQueryCoverage, 'query' => $query ]; }
php
private function makeEntityQuery( $options, $selectors, $etypeDirty, $subquery = false ) { $fullQueryCoverage = true; $sort = $options['sort'] ?? 'cdate'; $etype = '_'.mysqli_real_escape_string($this->link, $etypeDirty); $queryParts = $this->iterateSelectorsForQuery($selectors, function ($value) use ($options, $etypeDirty, &$fullQueryCoverage) { $subquery = $this->makeEntityQuery( $options, [$value], $etypeDirty, true ); $fullQueryCoverage = $fullQueryCoverage && $subquery['fullCoverage']; return $subquery['query']; }, function (&$curQuery, $key, $value, $typeIsOr, $typeIsNot) use ($etype, &$fullQueryCoverage) { $clauseNot = $key[0] === '!'; // Any options having to do with data only return if the // entity has the specified variables. foreach ($value as $curValue) { switch ($key) { case 'guid': case '!guid': foreach ($curValue as $curGuid) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`guid`=\''.(int) $curGuid.'\''; } break; case 'tag': case '!tag': if ($typeIsNot xor $clauseNot) { if ($typeIsOr) { foreach ($curValue as $curTag) { if ($curQuery) { $curQuery .= ' OR '; } $curQuery .= 'ie.`tags` NOT REGEXP \' '. mysqli_real_escape_string($this->link, $curTag). ' \''; } } else { $curQuery .= 'ie.`tags` NOT REGEXP \' ('. mysqli_real_escape_string( $this->link, implode('|', $curValue) ).') \''; } } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $groupQuery = ''; foreach ($curValue as $curTag) { $groupQuery .= ($typeIsOr ? ' ' : ' +'). '"'.mysqli_real_escape_string($this->link, $curTag).'"'; } $curQuery .= 'MATCH (ie.`tags`) AGAINST (\''. $groupQuery.'\' IN BOOLEAN MODE)'; } break; case 'isset': case '!isset': foreach ($curValue as $curVar) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'data', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curVar). '\' AND `value`!=\'N;\'', $typeIsNot xor $clauseNot ); } break; case 'ref': case '!ref': $guids = []; if (is_array($curValue[1])) { if (key_exists('guid', $curValue[1])) { $guids[] = (int) $curValue[1]['guid']; } else { foreach ($curValue[1] as $curEntity) { if (is_object($curEntity)) { $guids[] = (int) $curEntity->guid; } elseif (is_array($curEntity)) { $guids[] = (int) $curEntity['guid']; } else { $guids[] = (int) $curEntity; } } } } elseif (is_object($curValue[1])) { $guids[] = (int) $curValue[1]->guid; } else { $guids[] = (int) $curValue[1]; } foreach ($guids as $curQguid) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'references', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `reference`='. mysqli_real_escape_string($this->link, (int) $curQguid), $typeIsNot xor $clauseNot ); } break; case 'strict': case '!strict': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`='.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } if (is_callable([$curValue[1], 'toReference'])) { $svalue = serialize($curValue[1]->toReference()); } else { $svalue = serialize($curValue[1]); } $curQuery .= $this->makeDataPart( 'data', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `value`=\''. mysqli_real_escape_string($this->link, $svalue).'\'', $typeIsNot xor $clauseNot ); } break; case 'like': case '!like': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` LIKE \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` LIKE \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `string` LIKE \''. mysqli_real_escape_string($this->link, $curValue[1]). '\'', $typeIsNot xor $clauseNot ); } break; case 'ilike': case '!ilike': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` LIKE LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` LIKE LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND LOWER(`string`) LIKE LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\')', $typeIsNot xor $clauseNot ); } break; case 'pmatch': case '!pmatch': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` REGEXP \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` REGEXP \''. mysqli_real_escape_string($this->link, $curValue[1]). '\')'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `string` REGEXP \''. mysqli_real_escape_string($this->link, $curValue[1]). '\'', $typeIsNot xor $clauseNot ); } break; case 'ipmatch': case '!ipmatch': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`cdate` REGEXP LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). '(ie.`mdate` REGEXP LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\'))'; break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND LOWER(`string`) REGEXP LOWER(\''. mysqli_real_escape_string($this->link, $curValue[1]). '\')', $typeIsNot xor $clauseNot ); } break; case 'gt': case '!gt': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`>'.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`>'.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` > '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` > '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; case 'gte': case '!gte': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`>='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`>='.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` >= '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` >= '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; case 'lt': case '!lt': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`<'.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`<'.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` < '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` < '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; case 'lte': case '!lte': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`cdate`<='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie.`mdate`<='.((float) $curValue[1]); break; } else { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND ((`is_int`=TRUE AND `int` <= '. ((int) $curValue[1]).') OR ('. '`is_int`=FALSE AND `float` <= '. ((float) $curValue[1]).'))', $typeIsNot xor $clauseNot ); } break; // Cases after this point contains special values where // it can be solved by the query, but if those values // don't match, just check the variable exists. case 'equal': case '!equal': case 'data': case '!data': if ($curValue[0] === 'cdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie."cdate"='.((float) $curValue[1]); break; } elseif ($curValue[0] === 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : ''). 'ie."mdate"='.((float) $curValue[1]); break; } elseif ($curValue[1] === true || $curValue[1] === false) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_true`='.($curValue[1] ? 'TRUE' : 'FALSE'), $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === 1) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_one`=TRUE', $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === 0) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_zero`=TRUE', $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === -1) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_negone`=TRUE', $typeIsNot xor $clauseNot ); break; } elseif ($curValue[1] === []) { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'comparisons', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]). '\' AND `eq_emptyarray`=TRUE', $typeIsNot xor $clauseNot ); break; } // Fall through. case 'match': case '!match': case 'array': case '!array': if (!($typeIsNot xor $clauseNot) && $curValue[0] !== 'cdate' && $curValue[0] !== 'mdate') { if ($curQuery) { $curQuery .= $typeIsOr ? ' OR ' : ' AND '; } $curQuery .= $this->makeDataPart( 'data', $etype, '`name`=\''. mysqli_real_escape_string($this->link, $curValue[0]).'\'', $typeIsNot xor $clauseNot ); } $fullQueryCoverage = false; break; } } }); switch ($sort) { case 'guid': $sort = '`guid`'; break; case 'mdate': $sort = '`mdate`'; break; case 'cdate': default: $sort = '`cdate`'; break; } if (isset($options['reverse']) && $options['reverse']) { $sort .= ' DESC'; } if ($queryParts) { if ($subquery) { $query = "((".implode(') AND (', $queryParts)."))"; } else { $limit = ""; if ($fullQueryCoverage && key_exists('limit', $options)) { $limit = " LIMIT ".((int) $options['limit']); } $offset = ""; if ($fullQueryCoverage && key_exists('offset', $options)) { $offset = " OFFSET ".((int) $options['offset']); } $query = "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ". "d.`name`, d.`value` ". "FROM `{$this->prefix}entities{$etype}` e ". "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ". "INNER JOIN (". "SELECT ie.`guid` FROM `{$this->prefix}entities{$etype}` ie ". "WHERE (". implode(') AND (', $queryParts). ") ". "ORDER BY ie.{$sort}{$limit}{$offset}". ") f ON e.`guid`=f.`guid` ". "ORDER BY e.{$sort};"; } } else { if ($subquery) { $query = ''; } else { $limit = ""; if (key_exists('limit', $options)) { $limit = " LIMIT ".((int) $options['limit']); } $offset = ""; if (key_exists('offset', $options)) { $offset = " OFFSET ".((int) $options['offset']); } if ($limit || $offset) { $query = "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ". "d.`name`, d.`value` ". "FROM `{$this->prefix}entities{$etype}` e ". "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ". "INNER JOIN (". "SELECT ie.`guid` ". "FROM `{$this->prefix}entities{$etype}` ie ". "ORDER BY ie.{$sort}{$limit}{$offset}". ") f ON e.`guid`=f.`guid` ". "ORDER BY e.{$sort};"; } else { $query = "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ". "d.`name`, d.`value` ". "FROM `{$this->prefix}entities{$etype}` e ". "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ". "ORDER BY e.{$sort};"; } } } return [ 'fullCoverage' => $fullQueryCoverage, 'limitOffsetCoverage' => $fullQueryCoverage, 'query' => $query ]; }
[ "private", "function", "makeEntityQuery", "(", "$", "options", ",", "$", "selectors", ",", "$", "etypeDirty", ",", "$", "subquery", "=", "false", ")", "{", "$", "fullQueryCoverage", "=", "true", ";", "$", "sort", "=", "$", "options", "[", "'sort'", "]", "??", "'cdate'", ";", "$", "etype", "=", "'_'", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "etypeDirty", ")", ";", "$", "queryParts", "=", "$", "this", "->", "iterateSelectorsForQuery", "(", "$", "selectors", ",", "function", "(", "$", "value", ")", "use", "(", "$", "options", ",", "$", "etypeDirty", ",", "&", "$", "fullQueryCoverage", ")", "{", "$", "subquery", "=", "$", "this", "->", "makeEntityQuery", "(", "$", "options", ",", "[", "$", "value", "]", ",", "$", "etypeDirty", ",", "true", ")", ";", "$", "fullQueryCoverage", "=", "$", "fullQueryCoverage", "&&", "$", "subquery", "[", "'fullCoverage'", "]", ";", "return", "$", "subquery", "[", "'query'", "]", ";", "}", ",", "function", "(", "&", "$", "curQuery", ",", "$", "key", ",", "$", "value", ",", "$", "typeIsOr", ",", "$", "typeIsNot", ")", "use", "(", "$", "etype", ",", "&", "$", "fullQueryCoverage", ")", "{", "$", "clauseNot", "=", "$", "key", "[", "0", "]", "===", "'!'", ";", "// Any options having to do with data only return if the", "// entity has the specified variables.", "foreach", "(", "$", "value", "as", "$", "curValue", ")", "{", "switch", "(", "$", "key", ")", "{", "case", "'guid'", ":", "case", "'!guid'", ":", "foreach", "(", "$", "curValue", "as", "$", "curGuid", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`guid`=\\''", ".", "(", "int", ")", "$", "curGuid", ".", "'\\''", ";", "}", "break", ";", "case", "'tag'", ":", "case", "'!tag'", ":", "if", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "{", "if", "(", "$", "typeIsOr", ")", "{", "foreach", "(", "$", "curValue", "as", "$", "curTag", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "' OR '", ";", "}", "$", "curQuery", ".=", "'ie.`tags` NOT REGEXP \\' '", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curTag", ")", ".", "' \\''", ";", "}", "}", "else", "{", "$", "curQuery", ".=", "'ie.`tags` NOT REGEXP \\' ('", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "implode", "(", "'|'", ",", "$", "curValue", ")", ")", ".", "') \\''", ";", "}", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "groupQuery", "=", "''", ";", "foreach", "(", "$", "curValue", "as", "$", "curTag", ")", "{", "$", "groupQuery", ".=", "(", "$", "typeIsOr", "?", "' '", ":", "' +'", ")", ".", "'\"'", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curTag", ")", ".", "'\"'", ";", "}", "$", "curQuery", ".=", "'MATCH (ie.`tags`) AGAINST (\\''", ".", "$", "groupQuery", ".", "'\\' IN BOOLEAN MODE)'", ";", "}", "break", ";", "case", "'isset'", ":", "case", "'!isset'", ":", "foreach", "(", "$", "curValue", "as", "$", "curVar", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'data'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curVar", ")", ".", "'\\' AND `value`!=\\'N;\\''", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'ref'", ":", "case", "'!ref'", ":", "$", "guids", "=", "[", "]", ";", "if", "(", "is_array", "(", "$", "curValue", "[", "1", "]", ")", ")", "{", "if", "(", "key_exists", "(", "'guid'", ",", "$", "curValue", "[", "1", "]", ")", ")", "{", "$", "guids", "[", "]", "=", "(", "int", ")", "$", "curValue", "[", "1", "]", "[", "'guid'", "]", ";", "}", "else", "{", "foreach", "(", "$", "curValue", "[", "1", "]", "as", "$", "curEntity", ")", "{", "if", "(", "is_object", "(", "$", "curEntity", ")", ")", "{", "$", "guids", "[", "]", "=", "(", "int", ")", "$", "curEntity", "->", "guid", ";", "}", "elseif", "(", "is_array", "(", "$", "curEntity", ")", ")", "{", "$", "guids", "[", "]", "=", "(", "int", ")", "$", "curEntity", "[", "'guid'", "]", ";", "}", "else", "{", "$", "guids", "[", "]", "=", "(", "int", ")", "$", "curEntity", ";", "}", "}", "}", "}", "elseif", "(", "is_object", "(", "$", "curValue", "[", "1", "]", ")", ")", "{", "$", "guids", "[", "]", "=", "(", "int", ")", "$", "curValue", "[", "1", "]", "->", "guid", ";", "}", "else", "{", "$", "guids", "[", "]", "=", "(", "int", ")", "$", "curValue", "[", "1", "]", ";", "}", "foreach", "(", "$", "guids", "as", "$", "curQguid", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'references'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `reference`='", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "(", "int", ")", "$", "curQguid", ")", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'strict'", ":", "case", "'!strict'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`cdate`='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`mdate`='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "if", "(", "is_callable", "(", "[", "$", "curValue", "[", "1", "]", ",", "'toReference'", "]", ")", ")", "{", "$", "svalue", "=", "serialize", "(", "$", "curValue", "[", "1", "]", "->", "toReference", "(", ")", ")", ";", "}", "else", "{", "$", "svalue", "=", "serialize", "(", "$", "curValue", "[", "1", "]", ")", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'data'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `value`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "svalue", ")", ".", "'\\''", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'like'", ":", "case", "'!like'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`cdate` LIKE \\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\')'", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`mdate` LIKE \\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\')'", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `string` LIKE \\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\''", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'ilike'", ":", "case", "'!ilike'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`cdate` LIKE LOWER(\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\'))'", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`mdate` LIKE LOWER(\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\'))'", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND LOWER(`string`) LIKE LOWER(\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\')'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'pmatch'", ":", "case", "'!pmatch'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`cdate` REGEXP \\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\')'", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`mdate` REGEXP \\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\')'", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `string` REGEXP \\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\''", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'ipmatch'", ":", "case", "'!ipmatch'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`cdate` REGEXP LOWER(\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\'))'", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'(ie.`mdate` REGEXP LOWER(\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\'))'", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND LOWER(`string`) REGEXP LOWER(\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "1", "]", ")", ".", "'\\')'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'gt'", ":", "case", "'!gt'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`cdate`>'", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`mdate`>'", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND ((`is_int`=TRUE AND `int` > '", ".", "(", "(", "int", ")", "$", "curValue", "[", "1", "]", ")", ".", "') OR ('", ".", "'`is_int`=FALSE AND `float` > '", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ".", "'))'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'gte'", ":", "case", "'!gte'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`cdate`>='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`mdate`>='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND ((`is_int`=TRUE AND `int` >= '", ".", "(", "(", "int", ")", "$", "curValue", "[", "1", "]", ")", ".", "') OR ('", ".", "'`is_int`=FALSE AND `float` >= '", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ".", "'))'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'lt'", ":", "case", "'!lt'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`cdate`<'", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`mdate`<'", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND ((`is_int`=TRUE AND `int` < '", ".", "(", "(", "int", ")", "$", "curValue", "[", "1", "]", ")", ".", "') OR ('", ".", "'`is_int`=FALSE AND `float` < '", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ".", "'))'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "case", "'lte'", ":", "case", "'!lte'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`cdate`<='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.`mdate`<='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "else", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND ((`is_int`=TRUE AND `int` <= '", ".", "(", "(", "int", ")", "$", "curValue", "[", "1", "]", ")", ".", "') OR ('", ".", "'`is_int`=FALSE AND `float` <= '", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ".", "'))'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "break", ";", "// Cases after this point contains special values where", "// it can be solved by the query, but if those values", "// don't match, just check the variable exists.", "case", "'equal'", ":", "case", "'!equal'", ":", "case", "'data'", ":", "case", "'!data'", ":", "if", "(", "$", "curValue", "[", "0", "]", "===", "'cdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.\"cdate\"='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "0", "]", "===", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "(", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "?", "'NOT '", ":", "''", ")", ".", "'ie.\"mdate\"='", ".", "(", "(", "float", ")", "$", "curValue", "[", "1", "]", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "1", "]", "===", "true", "||", "$", "curValue", "[", "1", "]", "===", "false", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `eq_true`='", ".", "(", "$", "curValue", "[", "1", "]", "?", "'TRUE'", ":", "'FALSE'", ")", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "1", "]", "===", "1", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `eq_one`=TRUE'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "1", "]", "===", "0", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `eq_zero`=TRUE'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "1", "]", "===", "-", "1", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `eq_negone`=TRUE'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "break", ";", "}", "elseif", "(", "$", "curValue", "[", "1", "]", "===", "[", "]", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'comparisons'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\' AND `eq_emptyarray`=TRUE'", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "break", ";", "}", "// Fall through.", "case", "'match'", ":", "case", "'!match'", ":", "case", "'array'", ":", "case", "'!array'", ":", "if", "(", "!", "(", "$", "typeIsNot", "xor", "$", "clauseNot", ")", "&&", "$", "curValue", "[", "0", "]", "!==", "'cdate'", "&&", "$", "curValue", "[", "0", "]", "!==", "'mdate'", ")", "{", "if", "(", "$", "curQuery", ")", "{", "$", "curQuery", ".=", "$", "typeIsOr", "?", "' OR '", ":", "' AND '", ";", "}", "$", "curQuery", ".=", "$", "this", "->", "makeDataPart", "(", "'data'", ",", "$", "etype", ",", "'`name`=\\''", ".", "mysqli_real_escape_string", "(", "$", "this", "->", "link", ",", "$", "curValue", "[", "0", "]", ")", ".", "'\\''", ",", "$", "typeIsNot", "xor", "$", "clauseNot", ")", ";", "}", "$", "fullQueryCoverage", "=", "false", ";", "break", ";", "}", "}", "}", ")", ";", "switch", "(", "$", "sort", ")", "{", "case", "'guid'", ":", "$", "sort", "=", "'`guid`'", ";", "break", ";", "case", "'mdate'", ":", "$", "sort", "=", "'`mdate`'", ";", "break", ";", "case", "'cdate'", ":", "default", ":", "$", "sort", "=", "'`cdate`'", ";", "break", ";", "}", "if", "(", "isset", "(", "$", "options", "[", "'reverse'", "]", ")", "&&", "$", "options", "[", "'reverse'", "]", ")", "{", "$", "sort", ".=", "' DESC'", ";", "}", "if", "(", "$", "queryParts", ")", "{", "if", "(", "$", "subquery", ")", "{", "$", "query", "=", "\"((\"", ".", "implode", "(", "') AND ('", ",", "$", "queryParts", ")", ".", "\"))\"", ";", "}", "else", "{", "$", "limit", "=", "\"\"", ";", "if", "(", "$", "fullQueryCoverage", "&&", "key_exists", "(", "'limit'", ",", "$", "options", ")", ")", "{", "$", "limit", "=", "\" LIMIT \"", ".", "(", "(", "int", ")", "$", "options", "[", "'limit'", "]", ")", ";", "}", "$", "offset", "=", "\"\"", ";", "if", "(", "$", "fullQueryCoverage", "&&", "key_exists", "(", "'offset'", ",", "$", "options", ")", ")", "{", "$", "offset", "=", "\" OFFSET \"", ".", "(", "(", "int", ")", "$", "options", "[", "'offset'", "]", ")", ";", "}", "$", "query", "=", "\"SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, \"", ".", "\"d.`name`, d.`value` \"", ".", "\"FROM `{$this->prefix}entities{$etype}` e \"", ".", "\"LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` \"", ".", "\"INNER JOIN (\"", ".", "\"SELECT ie.`guid` FROM `{$this->prefix}entities{$etype}` ie \"", ".", "\"WHERE (\"", ".", "implode", "(", "') AND ('", ",", "$", "queryParts", ")", ".", "\") \"", ".", "\"ORDER BY ie.{$sort}{$limit}{$offset}\"", ".", "\") f ON e.`guid`=f.`guid` \"", ".", "\"ORDER BY e.{$sort};\"", ";", "}", "}", "else", "{", "if", "(", "$", "subquery", ")", "{", "$", "query", "=", "''", ";", "}", "else", "{", "$", "limit", "=", "\"\"", ";", "if", "(", "key_exists", "(", "'limit'", ",", "$", "options", ")", ")", "{", "$", "limit", "=", "\" LIMIT \"", ".", "(", "(", "int", ")", "$", "options", "[", "'limit'", "]", ")", ";", "}", "$", "offset", "=", "\"\"", ";", "if", "(", "key_exists", "(", "'offset'", ",", "$", "options", ")", ")", "{", "$", "offset", "=", "\" OFFSET \"", ".", "(", "(", "int", ")", "$", "options", "[", "'offset'", "]", ")", ";", "}", "if", "(", "$", "limit", "||", "$", "offset", ")", "{", "$", "query", "=", "\"SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, \"", ".", "\"d.`name`, d.`value` \"", ".", "\"FROM `{$this->prefix}entities{$etype}` e \"", ".", "\"LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` \"", ".", "\"INNER JOIN (\"", ".", "\"SELECT ie.`guid` \"", ".", "\"FROM `{$this->prefix}entities{$etype}` ie \"", ".", "\"ORDER BY ie.{$sort}{$limit}{$offset}\"", ".", "\") f ON e.`guid`=f.`guid` \"", ".", "\"ORDER BY e.{$sort};\"", ";", "}", "else", "{", "$", "query", "=", "\"SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, \"", ".", "\"d.`name`, d.`value` \"", ".", "\"FROM `{$this->prefix}entities{$etype}` e \"", ".", "\"LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` \"", ".", "\"ORDER BY e.{$sort};\"", ";", "}", "}", "}", "return", "[", "'fullCoverage'", "=>", "$", "fullQueryCoverage", ",", "'limitOffsetCoverage'", "=>", "$", "fullQueryCoverage", ",", "'query'", "=>", "$", "query", "]", ";", "}" ]
Generate the MySQL query. @param array $options The options array. @param array $selectors The formatted selector array. @param string $etypeDirty @param bool $subquery Whether only a subquery should be returned. @return string The SQL query.
[ "Generate", "the", "MySQL", "query", "." ]
train
https://github.com/sciactive/nymph-server/blob/3c18dbf45c2750d07c798e14534dba87387beeba/src/Drivers/MySQLDriver.php#L367-L990
lokhman/silex-tools
src/Silex/Console/Command/Cache/ClearCommand.php
ClearCommand.configure
protected function configure() { foreach ((new \ReflectionClass($this))->getMethods() as $method) { if ($method->class == self::class || is_subclass_of($method->class, self::class)) { if (strpos($method->name, '_') === 0) { $targets[] = substr($method->name, 1); } } } sort($targets); $this ->setName('cache:clear') ->setDescription('Clears cache') ->addOption('target', 't', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Target cache to clear', $targets); }
php
protected function configure() { foreach ((new \ReflectionClass($this))->getMethods() as $method) { if ($method->class == self::class || is_subclass_of($method->class, self::class)) { if (strpos($method->name, '_') === 0) { $targets[] = substr($method->name, 1); } } } sort($targets); $this ->setName('cache:clear') ->setDescription('Clears cache') ->addOption('target', 't', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Target cache to clear', $targets); }
[ "protected", "function", "configure", "(", ")", "{", "foreach", "(", "(", "new", "\\", "ReflectionClass", "(", "$", "this", ")", ")", "->", "getMethods", "(", ")", "as", "$", "method", ")", "{", "if", "(", "$", "method", "->", "class", "==", "self", "::", "class", "||", "is_subclass_of", "(", "$", "method", "->", "class", ",", "self", "::", "class", ")", ")", "{", "if", "(", "strpos", "(", "$", "method", "->", "name", ",", "'_'", ")", "===", "0", ")", "{", "$", "targets", "[", "]", "=", "substr", "(", "$", "method", "->", "name", ",", "1", ")", ";", "}", "}", "}", "sort", "(", "$", "targets", ")", ";", "$", "this", "->", "setName", "(", "'cache:clear'", ")", "->", "setDescription", "(", "'Clears cache'", ")", "->", "addOption", "(", "'target'", ",", "'t'", ",", "InputOption", "::", "VALUE_REQUIRED", "|", "InputOption", "::", "VALUE_IS_ARRAY", ",", "'Target cache to clear'", ",", "$", "targets", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/lokhman/silex-tools/blob/91e84099479beb4e866abc88a55ed1e457a8a9e9/src/Silex/Console/Command/Cache/ClearCommand.php#L49-L65
lokhman/silex-tools
src/Silex/Console/Command/Cache/ClearCommand.php
ClearCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { foreach ($input->getOption('target') as $target) { if (method_exists($this, '_'.$target)) { call_user_func([$this, '_'.$target], $input, $output); } else { $output->writeln(sprintf('<error>Unknown target "%s"</error>', $target)); return; } } $output->writeln('<info>Cache cleared<info>'); }
php
protected function execute(InputInterface $input, OutputInterface $output) { foreach ($input->getOption('target') as $target) { if (method_exists($this, '_'.$target)) { call_user_func([$this, '_'.$target], $input, $output); } else { $output->writeln(sprintf('<error>Unknown target "%s"</error>', $target)); return; } } $output->writeln('<info>Cache cleared<info>'); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "foreach", "(", "$", "input", "->", "getOption", "(", "'target'", ")", "as", "$", "target", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'_'", ".", "$", "target", ")", ")", "{", "call_user_func", "(", "[", "$", "this", ",", "'_'", ".", "$", "target", "]", ",", "$", "input", ",", "$", "output", ")", ";", "}", "else", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<error>Unknown target \"%s\"</error>'", ",", "$", "target", ")", ")", ";", "return", ";", "}", "}", "$", "output", "->", "writeln", "(", "'<info>Cache cleared<info>'", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/lokhman/silex-tools/blob/91e84099479beb4e866abc88a55ed1e457a8a9e9/src/Silex/Console/Command/Cache/ClearCommand.php#L70-L83
ShaoZeMing/laravel-merchant
src/Grid/Tools/PerPageSelector.php
PerPageSelector.render
public function render() { Merchant::script($this->script()); $options = $this->getOptions()->map(function ($option) { $selected = ($option == $this->perPage) ? 'selected' : ''; $url = app('request')->fullUrlWithQuery([$this->perPageName => $option]); return "<option value=\"$url\" $selected>$option</option>"; })->implode("\r\n"); $show = trans('merchant.show'); $entries = trans('merchant.entries'); return <<<EOT <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;"> <small>$show</small>&nbsp; <select class="input-sm grid-per-pager" name="per-page"> $options </select> &nbsp;<small>$entries</small> </label> EOT; }
php
public function render() { Merchant::script($this->script()); $options = $this->getOptions()->map(function ($option) { $selected = ($option == $this->perPage) ? 'selected' : ''; $url = app('request')->fullUrlWithQuery([$this->perPageName => $option]); return "<option value=\"$url\" $selected>$option</option>"; })->implode("\r\n"); $show = trans('merchant.show'); $entries = trans('merchant.entries'); return <<<EOT <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;"> <small>$show</small>&nbsp; <select class="input-sm grid-per-pager" name="per-page"> $options </select> &nbsp;<small>$entries</small> </label> EOT; }
[ "public", "function", "render", "(", ")", "{", "Merchant", "::", "script", "(", "$", "this", "->", "script", "(", ")", ")", ";", "$", "options", "=", "$", "this", "->", "getOptions", "(", ")", "->", "map", "(", "function", "(", "$", "option", ")", "{", "$", "selected", "=", "(", "$", "option", "==", "$", "this", "->", "perPage", ")", "?", "'selected'", ":", "''", ";", "$", "url", "=", "app", "(", "'request'", ")", "->", "fullUrlWithQuery", "(", "[", "$", "this", "->", "perPageName", "=>", "$", "option", "]", ")", ";", "return", "\"<option value=\\\"$url\\\" $selected>$option</option>\"", ";", "}", ")", "->", "implode", "(", "\"\\r\\n\"", ")", ";", "$", "show", "=", "trans", "(", "'merchant.show'", ")", ";", "$", "entries", "=", "trans", "(", "'merchant.entries'", ")", ";", "return", " <<<EOT\n\n<label class=\"control-label pull-right\" style=\"margin-right: 10px; font-weight: 100;\">\n\n <small>$show</small>&nbsp;\n <select class=\"input-sm grid-per-pager\" name=\"per-page\">\n $options\n </select>\n &nbsp;<small>$entries</small>\n </label>\n\nEOT", ";", "}" ]
Render PerPageSelector。 @return string
[ "Render", "PerPageSelector。" ]
train
https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Grid/Tools/PerPageSelector.php#L66-L92
hametuha/wpametu
src/WPametu/API/Rewrite.php
Rewrite.rewrite_rules_array
public function rewrite_rules_array( array $rules ){ if( !empty($this->classes) ){ // Normal rewrite rules $new_rewrite = []; $error_message = []; foreach( $this->classes as $class_name ){ $prefix = $this->get_prefix($class_name); /** @var RestBase $class_name */ if( empty($prefix) ){ $error_message[] = sprintf($this->__('<code>%s</code> should have prefix property.'), $class_name); continue; } // API Rewrite rules $new_rewrite[trim($prefix, '/').'(/.*)?$'] = "index.php?{$this->api_class}={$class_name}&{$this->api_vars}=\$matches[1]"; } if( !empty($new_rewrite) ){ $rules = array_merge($new_rewrite, $rules); } if( !empty($error_message) ){ add_action('admin_notices', function() use ($error_message) { printf('<div class="error"><p>%s</p></div>', implode('<br />', $error_message)); }); } } return $rules; }
php
public function rewrite_rules_array( array $rules ){ if( !empty($this->classes) ){ // Normal rewrite rules $new_rewrite = []; $error_message = []; foreach( $this->classes as $class_name ){ $prefix = $this->get_prefix($class_name); /** @var RestBase $class_name */ if( empty($prefix) ){ $error_message[] = sprintf($this->__('<code>%s</code> should have prefix property.'), $class_name); continue; } // API Rewrite rules $new_rewrite[trim($prefix, '/').'(/.*)?$'] = "index.php?{$this->api_class}={$class_name}&{$this->api_vars}=\$matches[1]"; } if( !empty($new_rewrite) ){ $rules = array_merge($new_rewrite, $rules); } if( !empty($error_message) ){ add_action('admin_notices', function() use ($error_message) { printf('<div class="error"><p>%s</p></div>', implode('<br />', $error_message)); }); } } return $rules; }
[ "public", "function", "rewrite_rules_array", "(", "array", "$", "rules", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "classes", ")", ")", "{", "// Normal rewrite rules", "$", "new_rewrite", "=", "[", "]", ";", "$", "error_message", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "classes", "as", "$", "class_name", ")", "{", "$", "prefix", "=", "$", "this", "->", "get_prefix", "(", "$", "class_name", ")", ";", "/** @var RestBase $class_name */", "if", "(", "empty", "(", "$", "prefix", ")", ")", "{", "$", "error_message", "[", "]", "=", "sprintf", "(", "$", "this", "->", "__", "(", "'<code>%s</code> should have prefix property.'", ")", ",", "$", "class_name", ")", ";", "continue", ";", "}", "// API Rewrite rules", "$", "new_rewrite", "[", "trim", "(", "$", "prefix", ",", "'/'", ")", ".", "'(/.*)?$'", "]", "=", "\"index.php?{$this->api_class}={$class_name}&{$this->api_vars}=\\$matches[1]\"", ";", "}", "if", "(", "!", "empty", "(", "$", "new_rewrite", ")", ")", "{", "$", "rules", "=", "array_merge", "(", "$", "new_rewrite", ",", "$", "rules", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "error_message", ")", ")", "{", "add_action", "(", "'admin_notices'", ",", "function", "(", ")", "use", "(", "$", "error_message", ")", "{", "printf", "(", "'<div class=\"error\"><p>%s</p></div>'", ",", "implode", "(", "'<br />'", ",", "$", "error_message", ")", ")", ";", "}", ")", ";", "}", "}", "return", "$", "rules", ";", "}" ]
Add rewrite rules. @param array $rules @return array
[ "Add", "rewrite", "rules", "." ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/API/Rewrite.php#L95-L120
hametuha/wpametu
src/WPametu/API/Rewrite.php
Rewrite.pre_get_posts
public function pre_get_posts( \WP_Query &$wp_query ){ if( !is_admin() && $wp_query->is_main_query() && ($api_class = $wp_query->get($this->api_class)) ){ // Detect class is valid try{ // Fix escaped namespace delimiter $api_class = str_replace('\\\\', '\\', $api_class); // Check class existence if( !$this->is_valid_class($api_class) ){ throw new \Exception($this->__('Specified URL is invalid.'), 404); } /** @var RestBase $instance */ $instance = $api_class::get_instance(); $instance->parse_request($wp_query->get($this->api_vars), $wp_query); }catch ( \Exception $e ){ switch( $e->getCode() ){ case 404: $wp_query->set_404(); break; case 200: case 201: // If status is O.K. // Do nothing. break; default: wp_die($e->getMessage(), get_status_header_desc($e->getCode()), [ 'response' => $e->getCode(), 'back_link' => true, ]); break; } } } }
php
public function pre_get_posts( \WP_Query &$wp_query ){ if( !is_admin() && $wp_query->is_main_query() && ($api_class = $wp_query->get($this->api_class)) ){ // Detect class is valid try{ // Fix escaped namespace delimiter $api_class = str_replace('\\\\', '\\', $api_class); // Check class existence if( !$this->is_valid_class($api_class) ){ throw new \Exception($this->__('Specified URL is invalid.'), 404); } /** @var RestBase $instance */ $instance = $api_class::get_instance(); $instance->parse_request($wp_query->get($this->api_vars), $wp_query); }catch ( \Exception $e ){ switch( $e->getCode() ){ case 404: $wp_query->set_404(); break; case 200: case 201: // If status is O.K. // Do nothing. break; default: wp_die($e->getMessage(), get_status_header_desc($e->getCode()), [ 'response' => $e->getCode(), 'back_link' => true, ]); break; } } } }
[ "public", "function", "pre_get_posts", "(", "\\", "WP_Query", "&", "$", "wp_query", ")", "{", "if", "(", "!", "is_admin", "(", ")", "&&", "$", "wp_query", "->", "is_main_query", "(", ")", "&&", "(", "$", "api_class", "=", "$", "wp_query", "->", "get", "(", "$", "this", "->", "api_class", ")", ")", ")", "{", "// Detect class is valid", "try", "{", "// Fix escaped namespace delimiter", "$", "api_class", "=", "str_replace", "(", "'\\\\\\\\'", ",", "'\\\\'", ",", "$", "api_class", ")", ";", "// Check class existence", "if", "(", "!", "$", "this", "->", "is_valid_class", "(", "$", "api_class", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "$", "this", "->", "__", "(", "'Specified URL is invalid.'", ")", ",", "404", ")", ";", "}", "/** @var RestBase $instance */", "$", "instance", "=", "$", "api_class", "::", "get_instance", "(", ")", ";", "$", "instance", "->", "parse_request", "(", "$", "wp_query", "->", "get", "(", "$", "this", "->", "api_vars", ")", ",", "$", "wp_query", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "switch", "(", "$", "e", "->", "getCode", "(", ")", ")", "{", "case", "404", ":", "$", "wp_query", "->", "set_404", "(", ")", ";", "break", ";", "case", "200", ":", "case", "201", ":", "// If status is O.K.", "// Do nothing.", "break", ";", "default", ":", "wp_die", "(", "$", "e", "->", "getMessage", "(", ")", ",", "get_status_header_desc", "(", "$", "e", "->", "getCode", "(", ")", ")", ",", "[", "'response'", "=>", "$", "e", "->", "getCode", "(", ")", ",", "'back_link'", "=>", "true", ",", "]", ")", ";", "break", ";", "}", "}", "}", "}" ]
Parse request and invoke REST class if possible @param \WP_Query $wp_query
[ "Parse", "request", "and", "invoke", "REST", "class", "if", "possible" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/API/Rewrite.php#L127-L159
hametuha/wpametu
src/WPametu/API/Rewrite.php
Rewrite.admin_init
public function admin_init(){ if( !AjaxBase::is_ajax() && current_user_can('manage_options') ){ if( !empty($this->classes) ){ $rewrites = ''; foreach( $this->classes as $class_name ){ $rewrites .= $this->get_prefix($class_name); } $rewrites = md5($rewrites); if( get_option('rewrite_rules') && $this->rewrite_md5 != $rewrites ){ flush_rewrite_rules(); $last_updated = current_time('timestamp'); update_option($this->option_name, $last_updated); update_option($this->rewrite_md5_name, $rewrites); $message = sprintf($this->__('Rewrite rules updated. Last modified date is %s'), date_i18n(get_option('date_format').' '.get_option('time_format'), $last_updated)); add_action('admin_notices', function() use ($message){ printf('<div class="updated"><p>%s</p></div>', $message); }); } } } }
php
public function admin_init(){ if( !AjaxBase::is_ajax() && current_user_can('manage_options') ){ if( !empty($this->classes) ){ $rewrites = ''; foreach( $this->classes as $class_name ){ $rewrites .= $this->get_prefix($class_name); } $rewrites = md5($rewrites); if( get_option('rewrite_rules') && $this->rewrite_md5 != $rewrites ){ flush_rewrite_rules(); $last_updated = current_time('timestamp'); update_option($this->option_name, $last_updated); update_option($this->rewrite_md5_name, $rewrites); $message = sprintf($this->__('Rewrite rules updated. Last modified date is %s'), date_i18n(get_option('date_format').' '.get_option('time_format'), $last_updated)); add_action('admin_notices', function() use ($message){ printf('<div class="updated"><p>%s</p></div>', $message); }); } } } }
[ "public", "function", "admin_init", "(", ")", "{", "if", "(", "!", "AjaxBase", "::", "is_ajax", "(", ")", "&&", "current_user_can", "(", "'manage_options'", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "classes", ")", ")", "{", "$", "rewrites", "=", "''", ";", "foreach", "(", "$", "this", "->", "classes", "as", "$", "class_name", ")", "{", "$", "rewrites", ".=", "$", "this", "->", "get_prefix", "(", "$", "class_name", ")", ";", "}", "$", "rewrites", "=", "md5", "(", "$", "rewrites", ")", ";", "if", "(", "get_option", "(", "'rewrite_rules'", ")", "&&", "$", "this", "->", "rewrite_md5", "!=", "$", "rewrites", ")", "{", "flush_rewrite_rules", "(", ")", ";", "$", "last_updated", "=", "current_time", "(", "'timestamp'", ")", ";", "update_option", "(", "$", "this", "->", "option_name", ",", "$", "last_updated", ")", ";", "update_option", "(", "$", "this", "->", "rewrite_md5_name", ",", "$", "rewrites", ")", ";", "$", "message", "=", "sprintf", "(", "$", "this", "->", "__", "(", "'Rewrite rules updated. Last modified date is %s'", ")", ",", "date_i18n", "(", "get_option", "(", "'date_format'", ")", ".", "' '", ".", "get_option", "(", "'time_format'", ")", ",", "$", "last_updated", ")", ")", ";", "add_action", "(", "'admin_notices'", ",", "function", "(", ")", "use", "(", "$", "message", ")", "{", "printf", "(", "'<div class=\"updated\"><p>%s</p></div>'", ",", "$", "message", ")", ";", "}", ")", ";", "}", "}", "}", "}" ]
Update rewrite rules if possible
[ "Update", "rewrite", "rules", "if", "possible" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/API/Rewrite.php#L187-L207
hametuha/wpametu
src/WPametu/API/Rewrite.php
Rewrite.get_prefix
public function get_prefix($class_name){ /** @var RestBase $class_name */ if( !empty($class_name::$prefix) ){ return $class_name::$prefix; }else{ $seg = explode('\\', $class_name); $base = $seg[count($seg) - 1]; return $this->str->camel_to_hyphen($base); } }
php
public function get_prefix($class_name){ /** @var RestBase $class_name */ if( !empty($class_name::$prefix) ){ return $class_name::$prefix; }else{ $seg = explode('\\', $class_name); $base = $seg[count($seg) - 1]; return $this->str->camel_to_hyphen($base); } }
[ "public", "function", "get_prefix", "(", "$", "class_name", ")", "{", "/** @var RestBase $class_name */", "if", "(", "!", "empty", "(", "$", "class_name", "::", "$", "prefix", ")", ")", "{", "return", "$", "class_name", "::", "$", "prefix", ";", "}", "else", "{", "$", "seg", "=", "explode", "(", "'\\\\'", ",", "$", "class_name", ")", ";", "$", "base", "=", "$", "seg", "[", "count", "(", "$", "seg", ")", "-", "1", "]", ";", "return", "$", "this", "->", "str", "->", "camel_to_hyphen", "(", "$", "base", ")", ";", "}", "}" ]
Get class prefix @param string $class_name @return string
[ "Get", "class", "prefix" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/API/Rewrite.php#L215-L224
DotZecker/Larafeed
src/Entry.php
Entry.prepare
public function prepare() { // The date format method to use with Carbon to convert the dates $dateFormatMethod = 'to' . strtolower($this->format) . 'String'; if (null !== $this->pubDate) { $this->pubDate = Carbon::parse($this->pubDate)->{$dateFormatMethod}(); } if (null !== $this->updated) { $this->updated = Carbon::parse($this->updated)->{$dateFormatMethod}(); } $this->title = strip_tags($this->title); $this->autoFill(); }
php
public function prepare() { // The date format method to use with Carbon to convert the dates $dateFormatMethod = 'to' . strtolower($this->format) . 'String'; if (null !== $this->pubDate) { $this->pubDate = Carbon::parse($this->pubDate)->{$dateFormatMethod}(); } if (null !== $this->updated) { $this->updated = Carbon::parse($this->updated)->{$dateFormatMethod}(); } $this->title = strip_tags($this->title); $this->autoFill(); }
[ "public", "function", "prepare", "(", ")", "{", "// The date format method to use with Carbon to convert the dates", "$", "dateFormatMethod", "=", "'to'", ".", "strtolower", "(", "$", "this", "->", "format", ")", ".", "'String'", ";", "if", "(", "null", "!==", "$", "this", "->", "pubDate", ")", "{", "$", "this", "->", "pubDate", "=", "Carbon", "::", "parse", "(", "$", "this", "->", "pubDate", ")", "->", "{", "$", "dateFormatMethod", "}", "(", ")", ";", "}", "if", "(", "null", "!==", "$", "this", "->", "updated", ")", "{", "$", "this", "->", "updated", "=", "Carbon", "::", "parse", "(", "$", "this", "->", "updated", ")", "->", "{", "$", "dateFormatMethod", "}", "(", ")", ";", "}", "$", "this", "->", "title", "=", "strip_tags", "(", "$", "this", "->", "title", ")", ";", "$", "this", "->", "autoFill", "(", ")", ";", "}" ]
Validate, auto-fill and sanitize the entry @return void
[ "Validate", "auto", "-", "fill", "and", "sanitize", "the", "entry" ]
train
https://github.com/DotZecker/Larafeed/blob/d696e2f97b584ed690fe7ba4ac5d739e266c75dd/src/Entry.php#L33-L49
DotZecker/Larafeed
src/Entry.php
Entry.autoFill
public function autoFill() { // The date format method to use with Carbon to convert the dates $dateFormatMethod = 'to' . strtolower($this->format) . 'String'; if (null === $this->pubDate) { $this->pubDate = Carbon::parse('now')->{$dateFormatMethod}(); } if (null === $this->summary) { $summary = strip_tags($this->content); $this->summary = substr($summary, 0, 144) . '...'; } }
php
public function autoFill() { // The date format method to use with Carbon to convert the dates $dateFormatMethod = 'to' . strtolower($this->format) . 'String'; if (null === $this->pubDate) { $this->pubDate = Carbon::parse('now')->{$dateFormatMethod}(); } if (null === $this->summary) { $summary = strip_tags($this->content); $this->summary = substr($summary, 0, 144) . '...'; } }
[ "public", "function", "autoFill", "(", ")", "{", "// The date format method to use with Carbon to convert the dates", "$", "dateFormatMethod", "=", "'to'", ".", "strtolower", "(", "$", "this", "->", "format", ")", ".", "'String'", ";", "if", "(", "null", "===", "$", "this", "->", "pubDate", ")", "{", "$", "this", "->", "pubDate", "=", "Carbon", "::", "parse", "(", "'now'", ")", "->", "{", "$", "dateFormatMethod", "}", "(", ")", ";", "}", "if", "(", "null", "===", "$", "this", "->", "summary", ")", "{", "$", "summary", "=", "strip_tags", "(", "$", "this", "->", "content", ")", ";", "$", "this", "->", "summary", "=", "substr", "(", "$", "summary", ",", "0", ",", "144", ")", ".", "'...'", ";", "}", "}" ]
Fill the attributes that can be auto-generated @return void
[ "Fill", "the", "attributes", "that", "can", "be", "auto", "-", "generated" ]
train
https://github.com/DotZecker/Larafeed/blob/d696e2f97b584ed690fe7ba4ac5d739e266c75dd/src/Entry.php#L56-L70
alevilar/ristorantino-vendor
Compras/Model/Mercaderia.php
Mercaderia.unificarMercaderia
public function unificarMercaderia($id_mercaderia, $id) { $datosMercaderia = $this->buscarMercaderiaPorId($id); $name = $datosMercaderia[0]['Mercaderia']['name']; if ($this->deleteall(array('Mercaderia.name' => $name, 'Mercaderia.id' => $id_mercaderia), false)) { return $this->PedidoMercaderia->updateAll(array('mercaderia_id' => $id),array('mercaderia_id' => $id_mercaderia)); } return false; }
php
public function unificarMercaderia($id_mercaderia, $id) { $datosMercaderia = $this->buscarMercaderiaPorId($id); $name = $datosMercaderia[0]['Mercaderia']['name']; if ($this->deleteall(array('Mercaderia.name' => $name, 'Mercaderia.id' => $id_mercaderia), false)) { return $this->PedidoMercaderia->updateAll(array('mercaderia_id' => $id),array('mercaderia_id' => $id_mercaderia)); } return false; }
[ "public", "function", "unificarMercaderia", "(", "$", "id_mercaderia", ",", "$", "id", ")", "{", "$", "datosMercaderia", "=", "$", "this", "->", "buscarMercaderiaPorId", "(", "$", "id", ")", ";", "$", "name", "=", "$", "datosMercaderia", "[", "0", "]", "[", "'Mercaderia'", "]", "[", "'name'", "]", ";", "if", "(", "$", "this", "->", "deleteall", "(", "array", "(", "'Mercaderia.name'", "=>", "$", "name", ",", "'Mercaderia.id'", "=>", "$", "id_mercaderia", ")", ",", "false", ")", ")", "{", "return", "$", "this", "->", "PedidoMercaderia", "->", "updateAll", "(", "array", "(", "'mercaderia_id'", "=>", "$", "id", ")", ",", "array", "(", "'mercaderia_id'", "=>", "$", "id_mercaderia", ")", ")", ";", "}", "return", "false", ";", "}" ]
Borra todas las mercaderías duplicadas, y despues actualiza la tabla compras_pedidos_mercaderias con el id del producto que se unifico. @param $id_mercaderia = id de la mercadería duplicada usada como condición para borrar. @param $id = id de la mercadería que tenia las duplicaciones para actualizar la tabla compras_pedidos_mercaderias
[ "Borra", "todas", "las", "mercaderías", "duplicadas", "y", "despues", "actualiza", "la", "tabla", "compras_pedidos_mercaderias", "con", "el", "id", "del", "producto", "que", "se", "unifico", "." ]
train
https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Compras/Model/Mercaderia.php#L125-L136
DevGroup-ru/yii2-users-module
src/UsersModule.php
UsersModule.buildAliases
protected function buildAliases() { $this->routes = ArrayHelper::merge($this->defaultRoutes, $this->routes); foreach ($this->routes as $alias => $route) { Yii::setAlias($alias, $route); } }
php
protected function buildAliases() { $this->routes = ArrayHelper::merge($this->defaultRoutes, $this->routes); foreach ($this->routes as $alias => $route) { Yii::setAlias($alias, $route); } }
[ "protected", "function", "buildAliases", "(", ")", "{", "$", "this", "->", "routes", "=", "ArrayHelper", "::", "merge", "(", "$", "this", "->", "defaultRoutes", ",", "$", "this", "->", "routes", ")", ";", "foreach", "(", "$", "this", "->", "routes", "as", "$", "alias", "=>", "$", "route", ")", "{", "Yii", "::", "setAlias", "(", "$", "alias", ",", "$", "route", ")", ";", "}", "}" ]
Sets needed routes aliases
[ "Sets", "needed", "routes", "aliases" ]
train
https://github.com/DevGroup-ru/yii2-users-module/blob/ff0103dc55c3462627ccc704c33e70c96053f750/src/UsersModule.php#L165-L171
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.saveToDb
public function saveToDb( ezcDbHandler $db, ezcDbSchema $dbSchema ) { $db->beginTransaction(); foreach ( $this->convertToDDL( $dbSchema ) as $query ) { if ( $this->isQueryAllowed( $db, $query ) ) { $db->exec( $query ); } else { // workarounds for SQL syntax // "ALTER TABLE tab ALTER col TYPE type" // and "ALTER TABLE tab ADD col type NOT NULL" // that works in PostgreSQL 8.x but not // supported in PostgreSQL 7.x if ( preg_match( "/ALTER TABLE (.*) ALTER (.*) TYPE (.*) USING CAST\((.*)\)/" , $query, $matches ) ) { $tableName = $matches[1]; $fieldName = $matches[2]; $fieldType = $matches[3]; $this->changeField( $db, $tableName, $fieldName, $fieldType ); } else if ( preg_match( "/ALTER TABLE (.*) ADD (.*) (.*) NOT NULL/" , $query, $matches ) ) { $tableName = $matches[1]; $fieldName = $matches[2]; $fieldType = $matches[3]; $this->addField( $db, $tableName, $fieldName, $fieldType ); } } } $db->commit(); }
php
public function saveToDb( ezcDbHandler $db, ezcDbSchema $dbSchema ) { $db->beginTransaction(); foreach ( $this->convertToDDL( $dbSchema ) as $query ) { if ( $this->isQueryAllowed( $db, $query ) ) { $db->exec( $query ); } else { // workarounds for SQL syntax // "ALTER TABLE tab ALTER col TYPE type" // and "ALTER TABLE tab ADD col type NOT NULL" // that works in PostgreSQL 8.x but not // supported in PostgreSQL 7.x if ( preg_match( "/ALTER TABLE (.*) ALTER (.*) TYPE (.*) USING CAST\((.*)\)/" , $query, $matches ) ) { $tableName = $matches[1]; $fieldName = $matches[2]; $fieldType = $matches[3]; $this->changeField( $db, $tableName, $fieldName, $fieldType ); } else if ( preg_match( "/ALTER TABLE (.*) ADD (.*) (.*) NOT NULL/" , $query, $matches ) ) { $tableName = $matches[1]; $fieldName = $matches[2]; $fieldType = $matches[3]; $this->addField( $db, $tableName, $fieldName, $fieldType ); } } } $db->commit(); }
[ "public", "function", "saveToDb", "(", "ezcDbHandler", "$", "db", ",", "ezcDbSchema", "$", "dbSchema", ")", "{", "$", "db", "->", "beginTransaction", "(", ")", ";", "foreach", "(", "$", "this", "->", "convertToDDL", "(", "$", "dbSchema", ")", "as", "$", "query", ")", "{", "if", "(", "$", "this", "->", "isQueryAllowed", "(", "$", "db", ",", "$", "query", ")", ")", "{", "$", "db", "->", "exec", "(", "$", "query", ")", ";", "}", "else", "{", "// workarounds for SQL syntax", "// \"ALTER TABLE tab ALTER col TYPE type\"", "// and \"ALTER TABLE tab ADD col type NOT NULL\"", "// that works in PostgreSQL 8.x but not ", "// supported in PostgreSQL 7.x", "if", "(", "preg_match", "(", "\"/ALTER TABLE (.*) ALTER (.*) TYPE (.*) USING CAST\\((.*)\\)/\"", ",", "$", "query", ",", "$", "matches", ")", ")", "{", "$", "tableName", "=", "$", "matches", "[", "1", "]", ";", "$", "fieldName", "=", "$", "matches", "[", "2", "]", ";", "$", "fieldType", "=", "$", "matches", "[", "3", "]", ";", "$", "this", "->", "changeField", "(", "$", "db", ",", "$", "tableName", ",", "$", "fieldName", ",", "$", "fieldType", ")", ";", "}", "else", "if", "(", "preg_match", "(", "\"/ALTER TABLE (.*) ADD (.*) (.*) NOT NULL/\"", ",", "$", "query", ",", "$", "matches", ")", ")", "{", "$", "tableName", "=", "$", "matches", "[", "1", "]", ";", "$", "fieldName", "=", "$", "matches", "[", "2", "]", ";", "$", "fieldType", "=", "$", "matches", "[", "3", "]", ";", "$", "this", "->", "addField", "(", "$", "db", ",", "$", "tableName", ",", "$", "fieldName", ",", "$", "fieldType", ")", ";", "}", "}", "}", "$", "db", "->", "commit", "(", ")", ";", "}" ]
Creates tables defined in $dbSchema in the database referenced by $db. If table already exists it will be removed first. This method uses {@link convertToDDL} to create SQL for the schema definition and then executes the return SQL statements on the database handler $db. @todo check for failed transaction @param ezcDbHandler $db @param ezcDbSchema $dbSchema
[ "Creates", "tables", "defined", "in", "$dbSchema", "in", "the", "database", "referenced", "by", "$db", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L49-L83
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.isQueryAllowed
public function isQueryAllowed( ezcDbHandler $db, $query ) { if ( substr( $query, 0, 10 ) == 'DROP TABLE' ) { $tableName = trim( substr( $query, strlen( 'DROP TABLE ' ) ), '"' ); $result = $db->query( "SELECT count(*) FROM pg_tables WHERE tablename='$tableName'" )->fetchAll(); if ( $result[0]['count'] == 1 ) { return true; } else { return false; } } if ( preg_match( "/ALTER TABLE (.*) ALTER (.*) TYPE (.*)/" , $query, $matches ) || preg_match( "/ALTER TABLE (.*) ADD (.*) NOT NULL/" , $query, $matches ) ) { return false; } return true; }
php
public function isQueryAllowed( ezcDbHandler $db, $query ) { if ( substr( $query, 0, 10 ) == 'DROP TABLE' ) { $tableName = trim( substr( $query, strlen( 'DROP TABLE ' ) ), '"' ); $result = $db->query( "SELECT count(*) FROM pg_tables WHERE tablename='$tableName'" )->fetchAll(); if ( $result[0]['count'] == 1 ) { return true; } else { return false; } } if ( preg_match( "/ALTER TABLE (.*) ALTER (.*) TYPE (.*)/" , $query, $matches ) || preg_match( "/ALTER TABLE (.*) ADD (.*) NOT NULL/" , $query, $matches ) ) { return false; } return true; }
[ "public", "function", "isQueryAllowed", "(", "ezcDbHandler", "$", "db", ",", "$", "query", ")", "{", "if", "(", "substr", "(", "$", "query", ",", "0", ",", "10", ")", "==", "'DROP TABLE'", ")", "{", "$", "tableName", "=", "trim", "(", "substr", "(", "$", "query", ",", "strlen", "(", "'DROP TABLE '", ")", ")", ",", "'\"'", ")", ";", "$", "result", "=", "$", "db", "->", "query", "(", "\"SELECT count(*) FROM pg_tables WHERE tablename='$tableName'\"", ")", "->", "fetchAll", "(", ")", ";", "if", "(", "$", "result", "[", "0", "]", "[", "'count'", "]", "==", "1", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "if", "(", "preg_match", "(", "\"/ALTER TABLE (.*) ALTER (.*) TYPE (.*)/\"", ",", "$", "query", ",", "$", "matches", ")", "||", "preg_match", "(", "\"/ALTER TABLE (.*) ADD (.*) NOT NULL/\"", ",", "$", "query", ",", "$", "matches", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Checks if certain query allowed. Perform testing if table exist for DROP TABLE query to avoid stoping execution while try to drop not existent table. @param ezcDbHandler $db @param string $query @return boolean false if query should not be executed.
[ "Checks", "if", "certain", "query", "allowed", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L97-L120
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.applyDiffToDb
public function applyDiffToDb( ezcDbHandler $db, ezcDbSchemaDiff $dbSchemaDiff ) { $db->beginTransaction(); foreach ( $this->convertDiffToDDL( $dbSchemaDiff ) as $query ) { if ( $this->isQueryAllowed( $db, $query ) ) { $db->exec( $query ); } else { // workarounds for SQL syntax // "ALTER TABLE tab ALTER col TYPE type" // and "ALTER TABLE tab ADD col type NOT NULL" // that works in PostgreSQL 8.x but not // supported in PostgreSQL 7.x if ( preg_match( "/ALTER TABLE (.*) ALTER (.*) TYPE (.*) USING CAST\((.*)\)/" , $query, $matches ) ) { $tableName = trim( $matches[1], '"' ); $fieldName = trim( $matches[2], '"' ); $fieldType = trim( $matches[3], '"' ); $this->changeField( $db, $tableName, $fieldName, $fieldType ); } else if ( preg_match( "/ALTER TABLE (.*) ADD (.*) (.*) NOT NULL/" , $query, $matches ) ) { $tableName = trim( $matches[1], '"' ); $fieldName = trim( $matches[2], '"' ); $fieldType = trim( $matches[3], '"' ); $this->addField( $db, $tableName, $fieldName, $fieldType ); } } } $db->commit(); }
php
public function applyDiffToDb( ezcDbHandler $db, ezcDbSchemaDiff $dbSchemaDiff ) { $db->beginTransaction(); foreach ( $this->convertDiffToDDL( $dbSchemaDiff ) as $query ) { if ( $this->isQueryAllowed( $db, $query ) ) { $db->exec( $query ); } else { // workarounds for SQL syntax // "ALTER TABLE tab ALTER col TYPE type" // and "ALTER TABLE tab ADD col type NOT NULL" // that works in PostgreSQL 8.x but not // supported in PostgreSQL 7.x if ( preg_match( "/ALTER TABLE (.*) ALTER (.*) TYPE (.*) USING CAST\((.*)\)/" , $query, $matches ) ) { $tableName = trim( $matches[1], '"' ); $fieldName = trim( $matches[2], '"' ); $fieldType = trim( $matches[3], '"' ); $this->changeField( $db, $tableName, $fieldName, $fieldType ); } else if ( preg_match( "/ALTER TABLE (.*) ADD (.*) (.*) NOT NULL/" , $query, $matches ) ) { $tableName = trim( $matches[1], '"' ); $fieldName = trim( $matches[2], '"' ); $fieldType = trim( $matches[3], '"' ); $this->addField( $db, $tableName, $fieldName, $fieldType ); } } } $db->commit(); }
[ "public", "function", "applyDiffToDb", "(", "ezcDbHandler", "$", "db", ",", "ezcDbSchemaDiff", "$", "dbSchemaDiff", ")", "{", "$", "db", "->", "beginTransaction", "(", ")", ";", "foreach", "(", "$", "this", "->", "convertDiffToDDL", "(", "$", "dbSchemaDiff", ")", "as", "$", "query", ")", "{", "if", "(", "$", "this", "->", "isQueryAllowed", "(", "$", "db", ",", "$", "query", ")", ")", "{", "$", "db", "->", "exec", "(", "$", "query", ")", ";", "}", "else", "{", "// workarounds for SQL syntax", "// \"ALTER TABLE tab ALTER col TYPE type\"", "// and \"ALTER TABLE tab ADD col type NOT NULL\"", "// that works in PostgreSQL 8.x but not ", "// supported in PostgreSQL 7.x", "if", "(", "preg_match", "(", "\"/ALTER TABLE (.*) ALTER (.*) TYPE (.*) USING CAST\\((.*)\\)/\"", ",", "$", "query", ",", "$", "matches", ")", ")", "{", "$", "tableName", "=", "trim", "(", "$", "matches", "[", "1", "]", ",", "'\"'", ")", ";", "$", "fieldName", "=", "trim", "(", "$", "matches", "[", "2", "]", ",", "'\"'", ")", ";", "$", "fieldType", "=", "trim", "(", "$", "matches", "[", "3", "]", ",", "'\"'", ")", ";", "$", "this", "->", "changeField", "(", "$", "db", ",", "$", "tableName", ",", "$", "fieldName", ",", "$", "fieldType", ")", ";", "}", "else", "if", "(", "preg_match", "(", "\"/ALTER TABLE (.*) ADD (.*) (.*) NOT NULL/\"", ",", "$", "query", ",", "$", "matches", ")", ")", "{", "$", "tableName", "=", "trim", "(", "$", "matches", "[", "1", "]", ",", "'\"'", ")", ";", "$", "fieldName", "=", "trim", "(", "$", "matches", "[", "2", "]", ",", "'\"'", ")", ";", "$", "fieldType", "=", "trim", "(", "$", "matches", "[", "3", "]", ",", "'\"'", ")", ";", "$", "this", "->", "addField", "(", "$", "db", ",", "$", "tableName", ",", "$", "fieldName", ",", "$", "fieldType", ")", ";", "}", "}", "}", "$", "db", "->", "commit", "(", ")", ";", "}" ]
Applies the differences defined in $dbSchemaDiff to the database referenced by $db. This method uses {@link convertDiffToDDL} to create SQL for the differences and then executes the returned SQL statements on the database handler $db. @todo check for failed transaction @param ezcDbHandler $db @param ezcDbSchemaDiff $dbSchemaDiff
[ "Applies", "the", "differences", "defined", "in", "$dbSchemaDiff", "to", "the", "database", "referenced", "by", "$db", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L146-L180
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.changeField
private function changeField( ezcDbHandler $db, $tableName, $changeFieldName, $changeFieldType ) { $db->exec( "ALTER TABLE \"{$tableName}\" RENAME COLUMN \"{$changeFieldName}\" TO \"{$changeFieldName}_old\";" ); $db->exec( "ALTER TABLE \"{$tableName}\" ADD COLUMN \"{$changeFieldName}\" {$changeFieldType};" ); $db->exec( "UPDATE \"{$tableName}\" SET \"{$changeFieldName}\" = \"{$changeFieldName}_old\";" ); $db->exec( "ALTER TABLE \"{$tableName}\" DROP COLUMN \"{$changeFieldName}_old\";" ); }
php
private function changeField( ezcDbHandler $db, $tableName, $changeFieldName, $changeFieldType ) { $db->exec( "ALTER TABLE \"{$tableName}\" RENAME COLUMN \"{$changeFieldName}\" TO \"{$changeFieldName}_old\";" ); $db->exec( "ALTER TABLE \"{$tableName}\" ADD COLUMN \"{$changeFieldName}\" {$changeFieldType};" ); $db->exec( "UPDATE \"{$tableName}\" SET \"{$changeFieldName}\" = \"{$changeFieldName}_old\";" ); $db->exec( "ALTER TABLE \"{$tableName}\" DROP COLUMN \"{$changeFieldName}_old\";" ); }
[ "private", "function", "changeField", "(", "ezcDbHandler", "$", "db", ",", "$", "tableName", ",", "$", "changeFieldName", ",", "$", "changeFieldType", ")", "{", "$", "db", "->", "exec", "(", "\"ALTER TABLE \\\"{$tableName}\\\" RENAME COLUMN \\\"{$changeFieldName}\\\" TO \\\"{$changeFieldName}_old\\\";\"", ")", ";", "$", "db", "->", "exec", "(", "\"ALTER TABLE \\\"{$tableName}\\\" ADD COLUMN \\\"{$changeFieldName}\\\" {$changeFieldType};\"", ")", ";", "$", "db", "->", "exec", "(", "\"UPDATE \\\"{$tableName}\\\" SET \\\"{$changeFieldName}\\\" = \\\"{$changeFieldName}_old\\\";\"", ")", ";", "$", "db", "->", "exec", "(", "\"ALTER TABLE \\\"{$tableName}\\\" DROP COLUMN \\\"{$changeFieldName}_old\\\";\"", ")", ";", "}" ]
Performs changing field in PostgreSQL table. ( workaround for "ALTER TABLE table ALTER field TYPE fieldDefinition" that not alowed in PostgreSQL 7.x but works in PostgreSQL 8.x ). @param ezcDbHandler $db @param string $tableName @param string $changeFieldName @param string $changeFieldType
[ "Performs", "changing", "field", "in", "PostgreSQL", "table", ".", "(", "workaround", "for", "ALTER", "TABLE", "table", "ALTER", "field", "TYPE", "fieldDefinition", "that", "not", "alowed", "in", "PostgreSQL", "7", ".", "x", "but", "works", "in", "PostgreSQL", "8", ".", "x", ")", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L204-L210
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.addField
private function addField( ezcDbHandler $db, $tableName, $fieldName, $fieldType ) { $db->exec( "ALTER TABLE \"{$tableName}\" ADD \"{$fieldName}\" {$fieldType}" ); $db->exec( "ALTER TABLE \"{$tableName}\" ALTER \"{$fieldName}\" SET NOT NULL" ); }
php
private function addField( ezcDbHandler $db, $tableName, $fieldName, $fieldType ) { $db->exec( "ALTER TABLE \"{$tableName}\" ADD \"{$fieldName}\" {$fieldType}" ); $db->exec( "ALTER TABLE \"{$tableName}\" ALTER \"{$fieldName}\" SET NOT NULL" ); }
[ "private", "function", "addField", "(", "ezcDbHandler", "$", "db", ",", "$", "tableName", ",", "$", "fieldName", ",", "$", "fieldType", ")", "{", "$", "db", "->", "exec", "(", "\"ALTER TABLE \\\"{$tableName}\\\" ADD \\\"{$fieldName}\\\" {$fieldType}\"", ")", ";", "$", "db", "->", "exec", "(", "\"ALTER TABLE \\\"{$tableName}\\\" ALTER \\\"{$fieldName}\\\" SET NOT NULL\"", ")", ";", "}" ]
Performs adding field in PostgreSQL table. ( workaround for "ALTER TABLE table ADD field fieldDefinition NOT NULL" that not alowed in PostgreSQL 7.x but works in PostgreSQL 8.x ). @param ezcDbHandler $db @param string $tableName @param string $fieldName @param string $fieldType
[ "Performs", "adding", "field", "in", "PostgreSQL", "table", ".", "(", "workaround", "for", "ALTER", "TABLE", "table", "ADD", "field", "fieldDefinition", "NOT", "NULL", "that", "not", "alowed", "in", "PostgreSQL", "7", ".", "x", "but", "works", "in", "PostgreSQL", "8", ".", "x", ")", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L223-L227
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.generateAddFieldSql
protected function generateAddFieldSql( $tableName, $fieldName, ezcDbSchemaField $fieldDefinition ) { $this->queries[] = "ALTER TABLE \"$tableName\" ADD " . $this->generateFieldSql( $fieldName, $fieldDefinition ); }
php
protected function generateAddFieldSql( $tableName, $fieldName, ezcDbSchemaField $fieldDefinition ) { $this->queries[] = "ALTER TABLE \"$tableName\" ADD " . $this->generateFieldSql( $fieldName, $fieldDefinition ); }
[ "protected", "function", "generateAddFieldSql", "(", "$", "tableName", ",", "$", "fieldName", ",", "ezcDbSchemaField", "$", "fieldDefinition", ")", "{", "$", "this", "->", "queries", "[", "]", "=", "\"ALTER TABLE \\\"$tableName\\\" ADD \"", ".", "$", "this", "->", "generateFieldSql", "(", "$", "fieldName", ",", "$", "fieldDefinition", ")", ";", "}" ]
Adds a "alter table" query to add the field $fieldName to $tableName with the definition $fieldDefinition. @param string $tableName @param string $fieldName @param ezcDbSchemaField $fieldDefinition
[ "Adds", "a", "alter", "table", "query", "to", "add", "the", "field", "$fieldName", "to", "$tableName", "with", "the", "definition", "$fieldDefinition", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L325-L328
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php
ezcDbSchemaPgsqlWriter.generateChangeFieldSql
protected function generateChangeFieldSql( $tableName, $fieldName, ezcDbSchemaField $fieldDefinition ) { $fieldType = strstr( $this->generateFieldSql( $fieldName, $fieldDefinition ), ' ' ); if ( $fieldDefinition->autoIncrement ) { $this->queries[] = "CREATE SEQUENCE \"{$tableName}_{$fieldName}_seq\""; $this->queries[] = "ALTER TABLE \"$tableName\" ALTER \"$fieldName\" TYPE INTEGER"; $this->queries[] = "ALTER TABLE \"$tableName\" ALTER COLUMN \"$fieldName\" SET DEFAULT nextval('{$tableName}_{$fieldName}_seq')"; $this->queries[] = "ALTER TABLE \"$tableName\" ALTER COLUMN \"$fieldName\" SET NOT NULL"; } else { $this->queries[] = "ALTER TABLE \"$tableName\" ALTER \"$fieldName\" TYPE".$fieldType." USING CAST(\"$fieldName\" AS $fieldType)"; } }
php
protected function generateChangeFieldSql( $tableName, $fieldName, ezcDbSchemaField $fieldDefinition ) { $fieldType = strstr( $this->generateFieldSql( $fieldName, $fieldDefinition ), ' ' ); if ( $fieldDefinition->autoIncrement ) { $this->queries[] = "CREATE SEQUENCE \"{$tableName}_{$fieldName}_seq\""; $this->queries[] = "ALTER TABLE \"$tableName\" ALTER \"$fieldName\" TYPE INTEGER"; $this->queries[] = "ALTER TABLE \"$tableName\" ALTER COLUMN \"$fieldName\" SET DEFAULT nextval('{$tableName}_{$fieldName}_seq')"; $this->queries[] = "ALTER TABLE \"$tableName\" ALTER COLUMN \"$fieldName\" SET NOT NULL"; } else { $this->queries[] = "ALTER TABLE \"$tableName\" ALTER \"$fieldName\" TYPE".$fieldType." USING CAST(\"$fieldName\" AS $fieldType)"; } }
[ "protected", "function", "generateChangeFieldSql", "(", "$", "tableName", ",", "$", "fieldName", ",", "ezcDbSchemaField", "$", "fieldDefinition", ")", "{", "$", "fieldType", "=", "strstr", "(", "$", "this", "->", "generateFieldSql", "(", "$", "fieldName", ",", "$", "fieldDefinition", ")", ",", "' '", ")", ";", "if", "(", "$", "fieldDefinition", "->", "autoIncrement", ")", "{", "$", "this", "->", "queries", "[", "]", "=", "\"CREATE SEQUENCE \\\"{$tableName}_{$fieldName}_seq\\\"\"", ";", "$", "this", "->", "queries", "[", "]", "=", "\"ALTER TABLE \\\"$tableName\\\" ALTER \\\"$fieldName\\\" TYPE INTEGER\"", ";", "$", "this", "->", "queries", "[", "]", "=", "\"ALTER TABLE \\\"$tableName\\\" ALTER COLUMN \\\"$fieldName\\\" SET DEFAULT nextval('{$tableName}_{$fieldName}_seq')\"", ";", "$", "this", "->", "queries", "[", "]", "=", "\"ALTER TABLE \\\"$tableName\\\" ALTER COLUMN \\\"$fieldName\\\" SET NOT NULL\"", ";", "}", "else", "{", "$", "this", "->", "queries", "[", "]", "=", "\"ALTER TABLE \\\"$tableName\\\" ALTER \\\"$fieldName\\\" TYPE\"", ".", "$", "fieldType", ".", "\" USING CAST(\\\"$fieldName\\\" AS $fieldType)\"", ";", "}", "}" ]
Adds a "alter table" query to change the field $fieldName to $tableName with the definition $fieldDefinition. @param string $tableName @param string $fieldName @param ezcDbSchemaField $fieldDefinition
[ "Adds", "a", "alter", "table", "query", "to", "change", "the", "field", "$fieldName", "to", "$tableName", "with", "the", "definition", "$fieldDefinition", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/writer.php#L337-L351
phpnfe/tools
src/Validar.php
Validar.validar
public static function validar($xml, $schemaFile) { //Para poder pegar os erros caso houver libxml_use_internal_errors(true); libxml_clear_errors(); if (is_file($xml)) { $xml = file_get_contents($xml); } $dom = new DOMDocument('1.0', 'utf-8'); $dom->loadXML($xml, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG); if (! $dom->schemaValidate($schemaFile)) { $errors = libxml_get_errors(); $returnErrors = []; foreach ($errors as $error) { $returnErrors[] = $error->message . 'at line ' . $error->line; } $msg = "Erro ao validar XML:\r\n" . implode("\r\n", $returnErrors); throw new \Exception($msg); } return true; }
php
public static function validar($xml, $schemaFile) { //Para poder pegar os erros caso houver libxml_use_internal_errors(true); libxml_clear_errors(); if (is_file($xml)) { $xml = file_get_contents($xml); } $dom = new DOMDocument('1.0', 'utf-8'); $dom->loadXML($xml, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG); if (! $dom->schemaValidate($schemaFile)) { $errors = libxml_get_errors(); $returnErrors = []; foreach ($errors as $error) { $returnErrors[] = $error->message . 'at line ' . $error->line; } $msg = "Erro ao validar XML:\r\n" . implode("\r\n", $returnErrors); throw new \Exception($msg); } return true; }
[ "public", "static", "function", "validar", "(", "$", "xml", ",", "$", "schemaFile", ")", "{", "//Para poder pegar os erros caso houver", "libxml_use_internal_errors", "(", "true", ")", ";", "libxml_clear_errors", "(", ")", ";", "if", "(", "is_file", "(", "$", "xml", ")", ")", "{", "$", "xml", "=", "file_get_contents", "(", "$", "xml", ")", ";", "}", "$", "dom", "=", "new", "DOMDocument", "(", "'1.0'", ",", "'utf-8'", ")", ";", "$", "dom", "->", "loadXML", "(", "$", "xml", ",", "LIBXML_NOBLANKS", "|", "LIBXML_NOEMPTYTAG", ")", ";", "if", "(", "!", "$", "dom", "->", "schemaValidate", "(", "$", "schemaFile", ")", ")", "{", "$", "errors", "=", "libxml_get_errors", "(", ")", ";", "$", "returnErrors", "=", "[", "]", ";", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "returnErrors", "[", "]", "=", "$", "error", "->", "message", ".", "'at line '", ".", "$", "error", "->", "line", ";", "}", "$", "msg", "=", "\"Erro ao validar XML:\\r\\n\"", ".", "implode", "(", "\"\\r\\n\"", ",", "$", "returnErrors", ")", ";", "throw", "new", "\\", "Exception", "(", "$", "msg", ")", ";", "}", "return", "true", ";", "}" ]
Valida um xml assinado. @param $xml @param $schemaFile @return bool @throws \Exception
[ "Valida", "um", "xml", "assinado", "." ]
train
https://github.com/phpnfe/tools/blob/303ca311989e0b345071f61b71d2b3bf7ee80454/src/Validar.php#L15-L42
xiewulong/yii2-fileupload
oss/libs/guzzle/stream/Guzzle/Stream/PhpStreamRequestFactory.php
PhpStreamRequestFactory.addDefaultContextOptions
protected function addDefaultContextOptions(RequestInterface $request) { $this->setContextValue('http', 'method', $request->getMethod()); $this->setContextValue('http', 'header', $request->getHeaderLines()); // Force 1.0 for now until PHP fully support chunked transfer-encoding decoding $this->setContextValue('http', 'protocol_version', '1.0'); $this->setContextValue('http', 'ignore_errors', true); }
php
protected function addDefaultContextOptions(RequestInterface $request) { $this->setContextValue('http', 'method', $request->getMethod()); $this->setContextValue('http', 'header', $request->getHeaderLines()); // Force 1.0 for now until PHP fully support chunked transfer-encoding decoding $this->setContextValue('http', 'protocol_version', '1.0'); $this->setContextValue('http', 'ignore_errors', true); }
[ "protected", "function", "addDefaultContextOptions", "(", "RequestInterface", "$", "request", ")", "{", "$", "this", "->", "setContextValue", "(", "'http'", ",", "'method'", ",", "$", "request", "->", "getMethod", "(", ")", ")", ";", "$", "this", "->", "setContextValue", "(", "'http'", ",", "'header'", ",", "$", "request", "->", "getHeaderLines", "(", ")", ")", ";", "// Force 1.0 for now until PHP fully support chunked transfer-encoding decoding", "$", "this", "->", "setContextValue", "(", "'http'", ",", "'protocol_version'", ",", "'1.0'", ")", ";", "$", "this", "->", "setContextValue", "(", "'http'", ",", "'ignore_errors'", ",", "true", ")", ";", "}" ]
Adds the default context options to the stream context options @param RequestInterface $request Request
[ "Adds", "the", "default", "context", "options", "to", "the", "stream", "context", "options" ]
train
https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/stream/Guzzle/Stream/PhpStreamRequestFactory.php#L114-L121
xiewulong/yii2-fileupload
oss/libs/guzzle/stream/Guzzle/Stream/PhpStreamRequestFactory.php
PhpStreamRequestFactory.createResource
protected function createResource($callback) { // Turn off error reporting while we try to initiate the request $level = error_reporting(0); $resource = call_user_func($callback); error_reporting($level); // If the resource could not be created, then grab the last error and throw an exception if (false === $resource) { $message = 'Error creating resource. '; foreach (error_get_last() as $key => $value) { $message .= "[{$key}] {$value} "; } throw new RuntimeException(trim($message)); } return $resource; }
php
protected function createResource($callback) { // Turn off error reporting while we try to initiate the request $level = error_reporting(0); $resource = call_user_func($callback); error_reporting($level); // If the resource could not be created, then grab the last error and throw an exception if (false === $resource) { $message = 'Error creating resource. '; foreach (error_get_last() as $key => $value) { $message .= "[{$key}] {$value} "; } throw new RuntimeException(trim($message)); } return $resource; }
[ "protected", "function", "createResource", "(", "$", "callback", ")", "{", "// Turn off error reporting while we try to initiate the request", "$", "level", "=", "error_reporting", "(", "0", ")", ";", "$", "resource", "=", "call_user_func", "(", "$", "callback", ")", ";", "error_reporting", "(", "$", "level", ")", ";", "// If the resource could not be created, then grab the last error and throw an exception", "if", "(", "false", "===", "$", "resource", ")", "{", "$", "message", "=", "'Error creating resource. '", ";", "foreach", "(", "error_get_last", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "message", ".=", "\"[{$key}] {$value} \"", ";", "}", "throw", "new", "RuntimeException", "(", "trim", "(", "$", "message", ")", ")", ";", "}", "return", "$", "resource", ";", "}" ]
Create a resource and check to ensure it was created successfully @param callable $callback Closure to invoke that must return a valid resource @return resource @throws RuntimeException on error
[ "Create", "a", "resource", "and", "check", "to", "ensure", "it", "was", "created", "successfully" ]
train
https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/stream/Guzzle/Stream/PhpStreamRequestFactory.php#L252-L269
hametuha/wpametu
src/WPametu/UI/MetaBox.php
MetaBox.override
public function override($post_type, $post){ if( $this->is_valid_post_type($post_type) ){ foreach( $this->fields as $name => $vars ){ switch( $name ){ case 'excerpt': remove_meta_box('postexcerpt', $post_type, 'normal'); break; case 'post_format': remove_meta_box('formatdiv', $post_type, 'side'); break; default: if( false !== array_search(Taxonomy::class, class_uses($vars['class'])) ){ if( taxonomy_exists($name) ){ if( is_taxonomy_hierarchical($name) ){ $box_id = $name.'div'; }else{ $box_id = 'tagsdiv-'.$name; } remove_meta_box($box_id, $post_type, 'side'); } }else{ // Do nothing } break; } } } }
php
public function override($post_type, $post){ if( $this->is_valid_post_type($post_type) ){ foreach( $this->fields as $name => $vars ){ switch( $name ){ case 'excerpt': remove_meta_box('postexcerpt', $post_type, 'normal'); break; case 'post_format': remove_meta_box('formatdiv', $post_type, 'side'); break; default: if( false !== array_search(Taxonomy::class, class_uses($vars['class'])) ){ if( taxonomy_exists($name) ){ if( is_taxonomy_hierarchical($name) ){ $box_id = $name.'div'; }else{ $box_id = 'tagsdiv-'.$name; } remove_meta_box($box_id, $post_type, 'side'); } }else{ // Do nothing } break; } } } }
[ "public", "function", "override", "(", "$", "post_type", ",", "$", "post", ")", "{", "if", "(", "$", "this", "->", "is_valid_post_type", "(", "$", "post_type", ")", ")", "{", "foreach", "(", "$", "this", "->", "fields", "as", "$", "name", "=>", "$", "vars", ")", "{", "switch", "(", "$", "name", ")", "{", "case", "'excerpt'", ":", "remove_meta_box", "(", "'postexcerpt'", ",", "$", "post_type", ",", "'normal'", ")", ";", "break", ";", "case", "'post_format'", ":", "remove_meta_box", "(", "'formatdiv'", ",", "$", "post_type", ",", "'side'", ")", ";", "break", ";", "default", ":", "if", "(", "false", "!==", "array_search", "(", "Taxonomy", "::", "class", ",", "class_uses", "(", "$", "vars", "[", "'class'", "]", ")", ")", ")", "{", "if", "(", "taxonomy_exists", "(", "$", "name", ")", ")", "{", "if", "(", "is_taxonomy_hierarchical", "(", "$", "name", ")", ")", "{", "$", "box_id", "=", "$", "name", ".", "'div'", ";", "}", "else", "{", "$", "box_id", "=", "'tagsdiv-'", ".", "$", "name", ";", "}", "remove_meta_box", "(", "$", "box_id", ",", "$", "post_type", ",", "'side'", ")", ";", "}", "}", "else", "{", "// Do nothing", "}", "break", ";", "}", "}", "}", "}" ]
Override default meta box @param string $post_type @param \WP_Post $post
[ "Override", "default", "meta", "box" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/MetaBox.php#L117-L144
hametuha/wpametu
src/WPametu/UI/MetaBox.php
MetaBox.save_post
public function save_post($post_id, \WP_Post $post ){ // Skip auto save if( wp_is_post_revision($post) || wp_is_post_autosave($post) ){ return; } // Check Nonce if( !$this->verify_nonce() ){ return; } // O.K., let's save foreach( $this->loop_fields() as $field ){ try{ if( is_wp_error($field) ){ /** @var \WP_Error $field */ throw new \Exception($field->get_error_message(), $field->get_error_code()); } if( !$this->is_override_field($field->name) ){ /** @var \WPametu\UI\Field\Base $field */ $field->update($this->input->post($field->name), $post); } }catch ( \Exception $e ){ $this->prg->addErrorMessage($e->getMessage()); } } }
php
public function save_post($post_id, \WP_Post $post ){ // Skip auto save if( wp_is_post_revision($post) || wp_is_post_autosave($post) ){ return; } // Check Nonce if( !$this->verify_nonce() ){ return; } // O.K., let's save foreach( $this->loop_fields() as $field ){ try{ if( is_wp_error($field) ){ /** @var \WP_Error $field */ throw new \Exception($field->get_error_message(), $field->get_error_code()); } if( !$this->is_override_field($field->name) ){ /** @var \WPametu\UI\Field\Base $field */ $field->update($this->input->post($field->name), $post); } }catch ( \Exception $e ){ $this->prg->addErrorMessage($e->getMessage()); } } }
[ "public", "function", "save_post", "(", "$", "post_id", ",", "\\", "WP_Post", "$", "post", ")", "{", "// Skip auto save", "if", "(", "wp_is_post_revision", "(", "$", "post", ")", "||", "wp_is_post_autosave", "(", "$", "post", ")", ")", "{", "return", ";", "}", "// Check Nonce", "if", "(", "!", "$", "this", "->", "verify_nonce", "(", ")", ")", "{", "return", ";", "}", "// O.K., let's save", "foreach", "(", "$", "this", "->", "loop_fields", "(", ")", "as", "$", "field", ")", "{", "try", "{", "if", "(", "is_wp_error", "(", "$", "field", ")", ")", "{", "/** @var \\WP_Error $field */", "throw", "new", "\\", "Exception", "(", "$", "field", "->", "get_error_message", "(", ")", ",", "$", "field", "->", "get_error_code", "(", ")", ")", ";", "}", "if", "(", "!", "$", "this", "->", "is_override_field", "(", "$", "field", "->", "name", ")", ")", "{", "/** @var \\WPametu\\UI\\Field\\Base $field */", "$", "field", "->", "update", "(", "$", "this", "->", "input", "->", "post", "(", "$", "field", "->", "name", ")", ",", "$", "post", ")", ";", "}", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "this", "->", "prg", "->", "addErrorMessage", "(", "$", "e", "->", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Save post data @param int $post_id @param \WP_Post $post
[ "Save", "post", "data" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/MetaBox.php#L166-L191
hametuha/wpametu
src/WPametu/UI/MetaBox.php
MetaBox.render
public function render( \WP_Post $post ){ $this->nonce_field(); $this->desc(); echo '<table class="table form-table wpametu-meta-table">'; foreach( $this->loop_fields() as $field ){ if( !is_wp_error($field) ){ /** @var \WPametu\UI\Field\Base $field */ $field->render($post); }else{ /** @var \WP_Error $field */ printf('<div class="error"><p>%s</p></div>', $field->get_error_message()); } } echo '</table>'; }
php
public function render( \WP_Post $post ){ $this->nonce_field(); $this->desc(); echo '<table class="table form-table wpametu-meta-table">'; foreach( $this->loop_fields() as $field ){ if( !is_wp_error($field) ){ /** @var \WPametu\UI\Field\Base $field */ $field->render($post); }else{ /** @var \WP_Error $field */ printf('<div class="error"><p>%s</p></div>', $field->get_error_message()); } } echo '</table>'; }
[ "public", "function", "render", "(", "\\", "WP_Post", "$", "post", ")", "{", "$", "this", "->", "nonce_field", "(", ")", ";", "$", "this", "->", "desc", "(", ")", ";", "echo", "'<table class=\"table form-table wpametu-meta-table\">'", ";", "foreach", "(", "$", "this", "->", "loop_fields", "(", ")", "as", "$", "field", ")", "{", "if", "(", "!", "is_wp_error", "(", "$", "field", ")", ")", "{", "/** @var \\WPametu\\UI\\Field\\Base $field */", "$", "field", "->", "render", "(", "$", "post", ")", ";", "}", "else", "{", "/** @var \\WP_Error $field */", "printf", "(", "'<div class=\"error\"><p>%s</p></div>'", ",", "$", "field", "->", "get_error_message", "(", ")", ")", ";", "}", "}", "echo", "'</table>'", ";", "}" ]
Render meta box content @param \WP_Post $post
[ "Render", "meta", "box", "content" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/MetaBox.php#L198-L212
hametuha/wpametu
src/WPametu/UI/MetaBox.php
MetaBox.loop_fields
protected function loop_fields(){ foreach( $this->fields as $name => $args ){ $return = null; if( isset($args['class']) && class_exists($args['class']) ){ $class_name = $args['class']; unset($args['class']); $args['name'] = $name; try{ $return = new $class_name($args); }catch ( \Exception $e ){ $return = new \WP_Error($e->getCode(), $e->getMessage()); } }else{ $return = new \WP_Error(500, sprintf($this->__('%s\'s argument setting is invalid.'), $name)); } yield $return; } }
php
protected function loop_fields(){ foreach( $this->fields as $name => $args ){ $return = null; if( isset($args['class']) && class_exists($args['class']) ){ $class_name = $args['class']; unset($args['class']); $args['name'] = $name; try{ $return = new $class_name($args); }catch ( \Exception $e ){ $return = new \WP_Error($e->getCode(), $e->getMessage()); } }else{ $return = new \WP_Error(500, sprintf($this->__('%s\'s argument setting is invalid.'), $name)); } yield $return; } }
[ "protected", "function", "loop_fields", "(", ")", "{", "foreach", "(", "$", "this", "->", "fields", "as", "$", "name", "=>", "$", "args", ")", "{", "$", "return", "=", "null", ";", "if", "(", "isset", "(", "$", "args", "[", "'class'", "]", ")", "&&", "class_exists", "(", "$", "args", "[", "'class'", "]", ")", ")", "{", "$", "class_name", "=", "$", "args", "[", "'class'", "]", ";", "unset", "(", "$", "args", "[", "'class'", "]", ")", ";", "$", "args", "[", "'name'", "]", "=", "$", "name", ";", "try", "{", "$", "return", "=", "new", "$", "class_name", "(", "$", "args", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "return", "=", "new", "\\", "WP_Error", "(", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", "->", "getMessage", "(", ")", ")", ";", "}", "}", "else", "{", "$", "return", "=", "new", "\\", "WP_Error", "(", "500", ",", "sprintf", "(", "$", "this", "->", "__", "(", "'%s\\'s argument setting is invalid.'", ")", ",", "$", "name", ")", ")", ";", "}", "yield", "$", "return", ";", "}", "}" ]
Generator @return \Generator
[ "Generator" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/MetaBox.php#L219-L236
willhoffmann/domuserp-php
src/Resources/Brands/Secondary/Models.php
Models.getList
public function getList(array $query = []) { $list = $this->pagination( self::DOMUSERP_API_OPERACIONAL . '/marcas/' . $this->brandId . '/modelos', $query ); return $list; }
php
public function getList(array $query = []) { $list = $this->pagination( self::DOMUSERP_API_OPERACIONAL . '/marcas/' . $this->brandId . '/modelos', $query ); return $list; }
[ "public", "function", "getList", "(", "array", "$", "query", "=", "[", "]", ")", "{", "$", "list", "=", "$", "this", "->", "pagination", "(", "self", "::", "DOMUSERP_API_OPERACIONAL", ".", "'/marcas/'", ".", "$", "this", "->", "brandId", ".", "'/modelos'", ",", "$", "query", ")", ";", "return", "$", "list", ";", "}" ]
List of product models @param array $query @return array|string @throws \GuzzleHttp\Exception\GuzzleException
[ "List", "of", "product", "models" ]
train
https://github.com/willhoffmann/domuserp-php/blob/44e77a4f02b0252bc26cae4c0e6b2b7d578f10a6/src/Resources/Brands/Secondary/Models.php#L35-L43
willhoffmann/domuserp-php
src/Resources/Brands/Secondary/Models.php
Models.get
public function get($id) { $data = $this->execute( self::HTTP_GET, self::DOMUSERP_API_OPERACIONAL . '/marcas/' . $this->brandId . '/modelos/' . $id ); return $data; }
php
public function get($id) { $data = $this->execute( self::HTTP_GET, self::DOMUSERP_API_OPERACIONAL . '/marcas/' . $this->brandId . '/modelos/' . $id ); return $data; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "$", "data", "=", "$", "this", "->", "execute", "(", "self", "::", "HTTP_GET", ",", "self", "::", "DOMUSERP_API_OPERACIONAL", ".", "'/marcas/'", ".", "$", "this", "->", "brandId", ".", "'/modelos/'", ".", "$", "id", ")", ";", "return", "$", "data", ";", "}" ]
Gets the product models data according to the id parameter @param int $id @return array|string @throws \GuzzleHttp\Exception\GuzzleException
[ "Gets", "the", "product", "models", "data", "according", "to", "the", "id", "parameter" ]
train
https://github.com/willhoffmann/domuserp-php/blob/44e77a4f02b0252bc26cae4c0e6b2b7d578f10a6/src/Resources/Brands/Secondary/Models.php#L52-L60
WellCommerce/AppBundle
Form/DataTransformer/UserGroupPermissionToArrayTransformer.php
UserGroupPermissionToArrayTransformer.transform
public function transform($modelData) { $values = []; if ($modelData instanceof Collection) { $modelData->map(function (UserGroupPermission $userGroupPermission) use (&$values) { list($permissionType, $action) = explode('.', $userGroupPermission->getName()); $values[$permissionType][$action] = $userGroupPermission->isEnabled(); }); } return $values; }
php
public function transform($modelData) { $values = []; if ($modelData instanceof Collection) { $modelData->map(function (UserGroupPermission $userGroupPermission) use (&$values) { list($permissionType, $action) = explode('.', $userGroupPermission->getName()); $values[$permissionType][$action] = $userGroupPermission->isEnabled(); }); } return $values; }
[ "public", "function", "transform", "(", "$", "modelData", ")", "{", "$", "values", "=", "[", "]", ";", "if", "(", "$", "modelData", "instanceof", "Collection", ")", "{", "$", "modelData", "->", "map", "(", "function", "(", "UserGroupPermission", "$", "userGroupPermission", ")", "use", "(", "&", "$", "values", ")", "{", "list", "(", "$", "permissionType", ",", "$", "action", ")", "=", "explode", "(", "'.'", ",", "$", "userGroupPermission", "->", "getName", "(", ")", ")", ";", "$", "values", "[", "$", "permissionType", "]", "[", "$", "action", "]", "=", "$", "userGroupPermission", "->", "isEnabled", "(", ")", ";", "}", ")", ";", "}", "return", "$", "values", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Form/DataTransformer/UserGroupPermissionToArrayTransformer.php#L32-L44
WellCommerce/AppBundle
Form/DataTransformer/UserGroupPermissionToArrayTransformer.php
UserGroupPermissionToArrayTransformer.clearPreviousCollection
protected function clearPreviousCollection(Collection $collection) { if ($collection->count()) { foreach ($collection as $item) { $collection->removeElement($item); } } }
php
protected function clearPreviousCollection(Collection $collection) { if ($collection->count()) { foreach ($collection as $item) { $collection->removeElement($item); } } }
[ "protected", "function", "clearPreviousCollection", "(", "Collection", "$", "collection", ")", "{", "if", "(", "$", "collection", "->", "count", "(", ")", ")", "{", "foreach", "(", "$", "collection", "as", "$", "item", ")", "{", "$", "collection", "->", "removeElement", "(", "$", "item", ")", ";", "}", "}", "}" ]
Resets previous photo collection @param Collection $collection
[ "Resets", "previous", "photo", "collection" ]
train
https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Form/DataTransformer/UserGroupPermissionToArrayTransformer.php#L78-L85
mvccore/ext-router-module
src/MvcCore/Ext/Routers/Module/UrlByRouteSections.php
UrlByRouteSections.urlByRouteSections
protected function urlByRouteSections (\MvcCore\IRoute & $route, array & $params = [], $urlParamRouteName = NULL) { /** @var $route \MvcCore\Route */ $defaultParams = array_merge([], $this->GetDefaultParams() ?: []); if ($urlParamRouteName == 'self') $params = array_merge($this->requestedParams ?: [], $params); // complete by given route base URL address part and part with path and query string list($urlBaseSection, $urlPathWithQuerySection) = $route->Url( $this->request, $params, $defaultParams, $this->getQueryStringParamsSepatator(), TRUE ); return [ $urlBaseSection, $urlPathWithQuerySection, [] ]; }
php
protected function urlByRouteSections (\MvcCore\IRoute & $route, array & $params = [], $urlParamRouteName = NULL) { /** @var $route \MvcCore\Route */ $defaultParams = array_merge([], $this->GetDefaultParams() ?: []); if ($urlParamRouteName == 'self') $params = array_merge($this->requestedParams ?: [], $params); // complete by given route base URL address part and part with path and query string list($urlBaseSection, $urlPathWithQuerySection) = $route->Url( $this->request, $params, $defaultParams, $this->getQueryStringParamsSepatator(), TRUE ); return [ $urlBaseSection, $urlPathWithQuerySection, [] ]; }
[ "protected", "function", "urlByRouteSections", "(", "\\", "MvcCore", "\\", "IRoute", "&", "$", "route", ",", "array", "&", "$", "params", "=", "[", "]", ",", "$", "urlParamRouteName", "=", "NULL", ")", "{", "/** @var $route \\MvcCore\\Route */", "$", "defaultParams", "=", "array_merge", "(", "[", "]", ",", "$", "this", "->", "GetDefaultParams", "(", ")", "?", ":", "[", "]", ")", ";", "if", "(", "$", "urlParamRouteName", "==", "'self'", ")", "$", "params", "=", "array_merge", "(", "$", "this", "->", "requestedParams", "?", ":", "[", "]", ",", "$", "params", ")", ";", "// complete by given route base URL address part and part with path and query string", "list", "(", "$", "urlBaseSection", ",", "$", "urlPathWithQuerySection", ")", "=", "$", "route", "->", "Url", "(", "$", "this", "->", "request", ",", "$", "params", ",", "$", "defaultParams", ",", "$", "this", "->", "getQueryStringParamsSepatator", "(", ")", ",", "TRUE", ")", ";", "return", "[", "$", "urlBaseSection", ",", "$", "urlPathWithQuerySection", ",", "[", "]", "]", ";", "}" ]
Complete semi-finished result URL as two section strings and system params array. First section as base section with scheme, domain and base path, second section as application requested path and query string and third section as system params like `media_version` and/or `localization`. Those params could be inserted between first two sections as system params in result URL by media and localization router behaviour and default values. Example: Input (`\MvcCore\Route::$reverse`): `"/products-list/<name>/<color>"` Input ($params): `array( "name" => "cool-product-name", "color" => "red", "variant" => ["L", "XL"], "media_version" => "mobile", "localization" => "en-US", );` Output: `[ "/application/base/bath", "/products-list/cool-product-name/blue?variant[]=L&amp;variant[]=XL", ["media_version" => "m", "localization" => "en-US"] ]` @param \MvcCore\Route|\MvcCore\IRoute &$route @param array $params @param string $urlParamRouteName @return array `string $urlBaseSection, string $urlPathWithQuerySection, array $systemParams`
[ "Complete", "semi", "-", "finished", "result", "URL", "as", "two", "section", "strings", "and", "system", "params", "array", ".", "First", "section", "as", "base", "section", "with", "scheme", "domain", "and", "base", "path", "second", "section", "as", "application", "requested", "path", "and", "query", "string", "and", "third", "section", "as", "system", "params", "like", "media_version", "and", "/", "or", "localization", ".", "Those", "params", "could", "be", "inserted", "between", "first", "two", "sections", "as", "system", "params", "in", "result", "URL", "by", "media", "and", "localization", "router", "behaviour", "and", "default", "values", ".", "Example", ":", "Input", "(", "\\", "MvcCore", "\\", "Route", "::", "$reverse", ")", ":", "/", "products", "-", "list", "/", "<name", ">", "/", "<color", ">", "Input", "(", "$params", ")", ":", "array", "(", "name", "=", ">", "cool", "-", "product", "-", "name", "color", "=", ">", "red", "variant", "=", ">", "[", "L", "XL", "]", "media_version", "=", ">", "mobile", "localization", "=", ">", "en", "-", "US", ")", ";", "Output", ":", "[", "/", "application", "/", "base", "/", "bath", "/", "products", "-", "list", "/", "cool", "-", "product", "-", "name", "/", "blue?variant", "[]", "=", "L&amp", ";", "variant", "[]", "=", "XL", "[", "media_version", "=", ">", "m", "localization", "=", ">", "en", "-", "US", "]", "]" ]
train
https://github.com/mvccore/ext-router-module/blob/7695784a451db86cca6a43c98d076803cd0a50a7/src/MvcCore/Ext/Routers/Module/UrlByRouteSections.php#L48-L64
ShaoZeMing/laravel-merchant
src/Middleware/LogOperation.php
LogOperation.handle
public function handle(Request $request, \Closure $next) { if ($this->shouldLogOperation($request)) { $log = [ 'user_id' => Merchant::user()->id, 'path' => $request->path(), 'method' => $request->method(), 'ip' => $request->getClientIp(), 'input' => json_encode($request->input()), ]; OperationLogModel::create($log); } return $next($request); }
php
public function handle(Request $request, \Closure $next) { if ($this->shouldLogOperation($request)) { $log = [ 'user_id' => Merchant::user()->id, 'path' => $request->path(), 'method' => $request->method(), 'ip' => $request->getClientIp(), 'input' => json_encode($request->input()), ]; OperationLogModel::create($log); } return $next($request); }
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "\\", "Closure", "$", "next", ")", "{", "if", "(", "$", "this", "->", "shouldLogOperation", "(", "$", "request", ")", ")", "{", "$", "log", "=", "[", "'user_id'", "=>", "Merchant", "::", "user", "(", ")", "->", "id", ",", "'path'", "=>", "$", "request", "->", "path", "(", ")", ",", "'method'", "=>", "$", "request", "->", "method", "(", ")", ",", "'ip'", "=>", "$", "request", "->", "getClientIp", "(", ")", ",", "'input'", "=>", "json_encode", "(", "$", "request", "->", "input", "(", ")", ")", ",", "]", ";", "OperationLogModel", "::", "create", "(", "$", "log", ")", ";", "}", "return", "$", "next", "(", "$", "request", ")", ";", "}" ]
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Middleware/LogOperation.php#L20-L35
heidelpay/PhpDoc
src/phpDocumentor/Transformer/Command/Template/ListCommand.php
ListCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('Available templates:'); foreach ($this->factory->getAllNames() as $template_name) { $output->writeln('* '.$template_name); } $output->writeln(''); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('Available templates:'); foreach ($this->factory->getAllNames() as $template_name) { $output->writeln('* '.$template_name); } $output->writeln(''); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "output", "->", "writeln", "(", "'Available templates:'", ")", ";", "foreach", "(", "$", "this", "->", "factory", "->", "getAllNames", "(", ")", "as", "$", "template_name", ")", "{", "$", "output", "->", "writeln", "(", "'* '", ".", "$", "template_name", ")", ";", "}", "$", "output", "->", "writeln", "(", "''", ")", ";", "}" ]
Retrieves all template names from the Template Factory and sends those to stdout. @param InputInterface $input @param OutputInterface $output @return void
[ "Retrieves", "all", "template", "names", "from", "the", "Template", "Factory", "and", "sends", "those", "to", "stdout", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Template/ListCommand.php#L67-L74
surebert/surebert-framework
src/sb/Request.php
Request.setInput
public function setInput(&$post, &$cookie, &$files, &$put, &$delete, &$data) { $this->post = $post; $this->cookie = $cookie; $this->files = $files; $this->put = $put; $this->delete = $delete; $this->data = $data; }
php
public function setInput(&$post, &$cookie, &$files, &$put, &$delete, &$data) { $this->post = $post; $this->cookie = $cookie; $this->files = $files; $this->put = $put; $this->delete = $delete; $this->data = $data; }
[ "public", "function", "setInput", "(", "&", "$", "post", ",", "&", "$", "cookie", ",", "&", "$", "files", ",", "&", "$", "put", ",", "&", "$", "delete", ",", "&", "$", "data", ")", "{", "$", "this", "->", "post", "=", "$", "post", ";", "$", "this", "->", "cookie", "=", "$", "cookie", ";", "$", "this", "->", "files", "=", "$", "files", ";", "$", "this", "->", "put", "=", "$", "put", ";", "$", "this", "->", "delete", "=", "$", "delete", ";", "$", "this", "->", "data", "=", "$", "data", ";", "}" ]
Sets the input for the request @param $post @param $cookie @param $files
[ "Sets", "the", "input", "for", "the", "request" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L123-L132
surebert/surebert-framework
src/sb/Request.php
Request.setInputArgsDelimiter
public function setInputArgsDelimiter($input_args_delimiter) { //parse arguments by removing path $args = preg_replace("~^.{" . strlen($this->path) . "}/?~", "", $this->request); //remove $_GET string $args = preg_replace("~\?.*?$~", "", $args); if ($args !== '') { $this->args = explode($input_args_delimiter, $args); //decodes url encoding foreach ($this->args as &$arg) { $arg = urldecode($arg); } if (method_exists('\App', 'filterAllInput')) { \App::filterAllInput($this->args); } } }
php
public function setInputArgsDelimiter($input_args_delimiter) { //parse arguments by removing path $args = preg_replace("~^.{" . strlen($this->path) . "}/?~", "", $this->request); //remove $_GET string $args = preg_replace("~\?.*?$~", "", $args); if ($args !== '') { $this->args = explode($input_args_delimiter, $args); //decodes url encoding foreach ($this->args as &$arg) { $arg = urldecode($arg); } if (method_exists('\App', 'filterAllInput')) { \App::filterAllInput($this->args); } } }
[ "public", "function", "setInputArgsDelimiter", "(", "$", "input_args_delimiter", ")", "{", "//parse arguments by removing path", "$", "args", "=", "preg_replace", "(", "\"~^.{\"", ".", "strlen", "(", "$", "this", "->", "path", ")", ".", "\"}/?~\"", ",", "\"\"", ",", "$", "this", "->", "request", ")", ";", "//remove $_GET string", "$", "args", "=", "preg_replace", "(", "\"~\\?.*?$~\"", ",", "\"\"", ",", "$", "args", ")", ";", "if", "(", "$", "args", "!==", "''", ")", "{", "$", "this", "->", "args", "=", "explode", "(", "$", "input_args_delimiter", ",", "$", "args", ")", ";", "//decodes url encoding", "foreach", "(", "$", "this", "->", "args", "as", "&", "$", "arg", ")", "{", "$", "arg", "=", "urldecode", "(", "$", "arg", ")", ";", "}", "if", "(", "method_exists", "(", "'\\App'", ",", "'filterAllInput'", ")", ")", "{", "\\", "App", "::", "filterAllInput", "(", "$", "this", "->", "args", ")", ";", "}", "}", "}" ]
Sets the input argument delimeter and parses it @param $input_args_delimiter
[ "Sets", "the", "input", "argument", "delimeter", "and", "parses", "it" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L138-L160
surebert/surebert-framework
src/sb/Request.php
Request.getGet
public function getGet($key, $default_val = null) { if (isset($this->get[$key])) { return $this->get[$key]; } return $default_val; }
php
public function getGet($key, $default_val = null) { if (isset($this->get[$key])) { return $this->get[$key]; } return $default_val; }
[ "public", "function", "getGet", "(", "$", "key", ",", "$", "default_val", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "get", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "get", "[", "$", "key", "]", ";", "}", "return", "$", "default_val", ";", "}" ]
Gets a GET variable value or returns the default value (null unless overridden) @param string $key The $_GET var key to look for @param mixed $default_val null by default @return mixed string value or null
[ "Gets", "a", "GET", "variable", "value", "or", "returns", "the", "default", "value", "(", "null", "unless", "overridden", ")" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L168-L176
surebert/surebert-framework
src/sb/Request.php
Request.getPut
public function getPut($key, $default_val = null) { if (isset($this->put[$key])) { return $this->put[$key]; } return $default_val; }
php
public function getPut($key, $default_val = null) { if (isset($this->put[$key])) { return $this->put[$key]; } return $default_val; }
[ "public", "function", "getPut", "(", "$", "key", ",", "$", "default_val", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "put", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "put", "[", "$", "key", "]", ";", "}", "return", "$", "default_val", ";", "}" ]
Gets a PUT variable value or returns the default value (null unless overridden) @param string $key The $_POST var key to look for @param mixed $default_val null by default @return mixed string value or null
[ "Gets", "a", "PUT", "variable", "value", "or", "returns", "the", "default", "value", "(", "null", "unless", "overridden", ")" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L214-L221
surebert/surebert-framework
src/sb/Request.php
Request.getDelete
public function getDelete($key, $default_val = null) { if (isset($this->delete[$key])) { return $this->delete[$key]; } return $default_val; }
php
public function getDelete($key, $default_val = null) { if (isset($this->delete[$key])) { return $this->delete[$key]; } return $default_val; }
[ "public", "function", "getDelete", "(", "$", "key", ",", "$", "default_val", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "delete", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "delete", "[", "$", "key", "]", ";", "}", "return", "$", "default_val", ";", "}" ]
Gets a post variable value or returns the default value (null unless overridden) @param string $key The $_POST var key to look for @param mixed $default_val null by default @return mixed string value or null
[ "Gets", "a", "post", "variable", "value", "or", "returns", "the", "default", "value", "(", "null", "unless", "overridden", ")" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L229-L236
surebert/surebert-framework
src/sb/Request.php
Request.getSession
public function getSession($key, $default_val = null) { if (isset($_SESSION[$key])) { return $_SESSION[$key]; } return $default_val; }
php
public function getSession($key, $default_val = null) { if (isset($_SESSION[$key])) { return $_SESSION[$key]; } return $default_val; }
[ "public", "function", "getSession", "(", "$", "key", ",", "$", "default_val", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "_SESSION", "[", "$", "key", "]", ")", ")", "{", "return", "$", "_SESSION", "[", "$", "key", "]", ";", "}", "return", "$", "default_val", ";", "}" ]
Gets a get variable value or returns the default value (null unless overridden) @param string $key The $_SESSION var key to look for @param mixed $default_val null by default @return mixed string value or null
[ "Gets", "a", "get", "variable", "value", "or", "returns", "the", "default", "value", "(", "null", "unless", "overridden", ")" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L259-L267
surebert/surebert-framework
src/sb/Request.php
Request.getArg
public function getArg($arg_num, $default_val = null) { if (isset($this->args[$arg_num])) { return $this->args[$arg_num]; } return $default_val; }
php
public function getArg($arg_num, $default_val = null) { if (isset($this->args[$arg_num])) { return $this->args[$arg_num]; } return $default_val; }
[ "public", "function", "getArg", "(", "$", "arg_num", ",", "$", "default_val", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "args", "[", "$", "arg_num", "]", ")", ")", "{", "return", "$", "this", "->", "args", "[", "$", "arg_num", "]", ";", "}", "return", "$", "default_val", ";", "}" ]
Gets a args variable value or returns the default value (null unless overridden) @param integer $arg_num The numeric arg value @param mixed $default_val null by default @return mixed string value or null
[ "Gets", "a", "args", "variable", "value", "or", "returns", "the", "default", "value", "(", "null", "unless", "overridden", ")" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L275-L282
surebert/surebert-framework
src/sb/Request.php
Request.getFile
public function getFile($key) { if (isset($this->files[$key])) { return $this->files[$key]; } return null; }
php
public function getFile($key) { if (isset($this->files[$key])) { return $this->files[$key]; } return null; }
[ "public", "function", "getFile", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "files", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "files", "[", "$", "key", "]", ";", "}", "return", "null", ";", "}" ]
Gets a uploaded file reference, otherwise returns null @param string $key The key to look for @return array the file that was uploaded
[ "Gets", "a", "uploaded", "file", "reference", "otherwise", "returns", "null" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L290-L297
surebert/surebert-framework
src/sb/Request.php
Request.getPath
public function getPath($part=null){ if(is_null($part)){ return $this->path; } if(isset($this->path_array[$part])){ return $this->path_array[$part]; } return false; }
php
public function getPath($part=null){ if(is_null($part)){ return $this->path; } if(isset($this->path_array[$part])){ return $this->path_array[$part]; } return false; }
[ "public", "function", "getPath", "(", "$", "part", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "part", ")", ")", "{", "return", "$", "this", "->", "path", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "path_array", "[", "$", "part", "]", ")", ")", "{", "return", "$", "this", "->", "path_array", "[", "$", "part", "]", ";", "}", "return", "false", ";", "}" ]
Grabs the part of the path referenced by index e.g. if path was /image/of/dog $this->getPath(0) would return image @param int $part optionally which part to return @return mixed string or false if not set
[ "Grabs", "the", "part", "of", "the", "path", "referenced", "by", "index", "e", ".", "g", ".", "if", "path", "was", "/", "image", "/", "of", "/", "dog", "$this", "-", ">", "getPath", "(", "0", ")", "would", "return", "image" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Request.php#L321-L332
mustardandrew/muan-laravel-acl
src/Traits/PrepareUserTrait.php
PrepareUserTrait.prepareUser
public function prepareUser($id) { $userClass = config('auth.providers.users.model'); if (! class_exists($userClass)) { throw new Exception("User class {$userClass} not found."); } if(! $user = $userClass::whereId($id)->first()) { throw new Exception("User by ID {$id} not found."); } return $user; }
php
public function prepareUser($id) { $userClass = config('auth.providers.users.model'); if (! class_exists($userClass)) { throw new Exception("User class {$userClass} not found."); } if(! $user = $userClass::whereId($id)->first()) { throw new Exception("User by ID {$id} not found."); } return $user; }
[ "public", "function", "prepareUser", "(", "$", "id", ")", "{", "$", "userClass", "=", "config", "(", "'auth.providers.users.model'", ")", ";", "if", "(", "!", "class_exists", "(", "$", "userClass", ")", ")", "{", "throw", "new", "Exception", "(", "\"User class {$userClass} not found.\"", ")", ";", "}", "if", "(", "!", "$", "user", "=", "$", "userClass", "::", "whereId", "(", "$", "id", ")", "->", "first", "(", ")", ")", "{", "throw", "new", "Exception", "(", "\"User by ID {$id} not found.\"", ")", ";", "}", "return", "$", "user", ";", "}" ]
Prepare user @param int $id @return mixed @throws Exception
[ "Prepare", "user" ]
train
https://github.com/mustardandrew/muan-laravel-acl/blob/b5f23340b5536babb98d9fd0d727a7a3371c97d5/src/Traits/PrepareUserTrait.php#L22-L35
rhosocial/yii2-user
UserSearch.php
UserSearch.gmdate
public function gmdate($attribute, $params, $validator) { if (isset($this->$attribute)) { $timestamp = strtotime($this->$attribute); $this->{$attribute . 'InUtc'} = gmdate('Y-m-d H:i:s', $timestamp); } }
php
public function gmdate($attribute, $params, $validator) { if (isset($this->$attribute)) { $timestamp = strtotime($this->$attribute); $this->{$attribute . 'InUtc'} = gmdate('Y-m-d H:i:s', $timestamp); } }
[ "public", "function", "gmdate", "(", "$", "attribute", ",", "$", "params", ",", "$", "validator", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "$", "attribute", ")", ")", "{", "$", "timestamp", "=", "strtotime", "(", "$", "this", "->", "$", "attribute", ")", ";", "$", "this", "->", "{", "$", "attribute", ".", "'InUtc'", "}", "=", "gmdate", "(", "'Y-m-d H:i:s'", ",", "$", "timestamp", ")", ";", "}", "}" ]
Convert time attribute to UTC time. @param string $attribute @param array $params @param mixed $validator
[ "Convert", "time", "attribute", "to", "UTC", "time", "." ]
train
https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/UserSearch.php#L84-L90
rhosocial/yii2-user
UserSearch.php
UserSearch.search
public function search($params) { $query = static::find(); /* @var $query BaseUserQuery */ $userClass = $this->userClass; $query = $query->from("{$userClass::tableName()} {$this->userAlias}"); $noInitUser = $userClass::buildNoInitModel(); /* @var $noInitUser User */ $profileClass = $noInitUser->profileClass; if (!empty($profileClass)) { $query = $query->joinWith(["profile {$this->profileAlias}"]); } $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageParam' => 'user-page', 'defaultPageSize' => 20, 'pageSizeParam' => 'user-per-page', ], 'sort' => [ 'sortParam' => 'user-sort', 'attributes' => [ 'id', 'nickname', 'name' => [ 'asc' => [$this->profileAlias . '.first_name' => SORT_ASC, $this->profileAlias . '.last_name' => SORT_ASC], 'desc' => [$this->profileAlias . '.first_name' => SORT_DESC, $this->profileAlias . '.last_name' => SORT_DESC], 'default' => SORT_DESC, 'label' => Yii::t('user', 'Name'), ], 'gender' => [ 'asc' => [$this->profileAlias . '.gender' => SORT_ASC], 'desc' => [$this->profileAlias . '.gender' => SORT_DESC], 'default' => SORT_ASC, 'label' => Yii::t('user', 'Gender'), ], 'createdAt' => [ 'asc' => [$this->userAlias . '.created_at' => SORT_ASC], 'desc' => [$this->userAlias . '.created_at' => SORT_DESC], 'default' => SORT_ASC, 'label' => Yii::t('user', 'Creation Time'), ], 'updatedAt' => [ 'asc' => [$this->userAlias . '.updated_at' => SORT_ASC], 'desc' => [$this->userAlias . '.updated_at' => SORT_DESC], 'default' => SORT_ASC, 'label' => Yii::t('user', 'Last Updated Time'), ], ], ], ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query = $query->andFilterWhere([ 'LIKE', $this->userAlias . '.id', $this->id, ])->andFilterWhere([ 'LIKE', $this->profileAlias . '.nickname', $this->nickname, ])->andFilterWhere([ '>=', $this->userAlias . '.created_at', $this->createdFromInUtc, ])->andFilterWhere([ '<=', $this->userAlias . '.created_at', $this->createdToInUtc, ])->andFilterWhere([ 'LIKE', $this->profileAlias . '.first_name', $this->first_name, ])->andFilterWhere([ 'LIKE', $this->profileAlias . '.last_name', $this->last_name, ])->andFilterWhere([ $this->profileAlias . '.gender' => $this->gf, ]); $dataProvider->query = $query; return $dataProvider; }
php
public function search($params) { $query = static::find(); /* @var $query BaseUserQuery */ $userClass = $this->userClass; $query = $query->from("{$userClass::tableName()} {$this->userAlias}"); $noInitUser = $userClass::buildNoInitModel(); /* @var $noInitUser User */ $profileClass = $noInitUser->profileClass; if (!empty($profileClass)) { $query = $query->joinWith(["profile {$this->profileAlias}"]); } $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageParam' => 'user-page', 'defaultPageSize' => 20, 'pageSizeParam' => 'user-per-page', ], 'sort' => [ 'sortParam' => 'user-sort', 'attributes' => [ 'id', 'nickname', 'name' => [ 'asc' => [$this->profileAlias . '.first_name' => SORT_ASC, $this->profileAlias . '.last_name' => SORT_ASC], 'desc' => [$this->profileAlias . '.first_name' => SORT_DESC, $this->profileAlias . '.last_name' => SORT_DESC], 'default' => SORT_DESC, 'label' => Yii::t('user', 'Name'), ], 'gender' => [ 'asc' => [$this->profileAlias . '.gender' => SORT_ASC], 'desc' => [$this->profileAlias . '.gender' => SORT_DESC], 'default' => SORT_ASC, 'label' => Yii::t('user', 'Gender'), ], 'createdAt' => [ 'asc' => [$this->userAlias . '.created_at' => SORT_ASC], 'desc' => [$this->userAlias . '.created_at' => SORT_DESC], 'default' => SORT_ASC, 'label' => Yii::t('user', 'Creation Time'), ], 'updatedAt' => [ 'asc' => [$this->userAlias . '.updated_at' => SORT_ASC], 'desc' => [$this->userAlias . '.updated_at' => SORT_DESC], 'default' => SORT_ASC, 'label' => Yii::t('user', 'Last Updated Time'), ], ], ], ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query = $query->andFilterWhere([ 'LIKE', $this->userAlias . '.id', $this->id, ])->andFilterWhere([ 'LIKE', $this->profileAlias . '.nickname', $this->nickname, ])->andFilterWhere([ '>=', $this->userAlias . '.created_at', $this->createdFromInUtc, ])->andFilterWhere([ '<=', $this->userAlias . '.created_at', $this->createdToInUtc, ])->andFilterWhere([ 'LIKE', $this->profileAlias . '.first_name', $this->first_name, ])->andFilterWhere([ 'LIKE', $this->profileAlias . '.last_name', $this->last_name, ])->andFilterWhere([ $this->profileAlias . '.gender' => $this->gf, ]); $dataProvider->query = $query; return $dataProvider; }
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "query", "=", "static", "::", "find", "(", ")", ";", "/* @var $query BaseUserQuery */", "$", "userClass", "=", "$", "this", "->", "userClass", ";", "$", "query", "=", "$", "query", "->", "from", "(", "\"{$userClass::tableName()} {$this->userAlias}\"", ")", ";", "$", "noInitUser", "=", "$", "userClass", "::", "buildNoInitModel", "(", ")", ";", "/* @var $noInitUser User */", "$", "profileClass", "=", "$", "noInitUser", "->", "profileClass", ";", "if", "(", "!", "empty", "(", "$", "profileClass", ")", ")", "{", "$", "query", "=", "$", "query", "->", "joinWith", "(", "[", "\"profile {$this->profileAlias}\"", "]", ")", ";", "}", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "'query'", "=>", "$", "query", ",", "'pagination'", "=>", "[", "'pageParam'", "=>", "'user-page'", ",", "'defaultPageSize'", "=>", "20", ",", "'pageSizeParam'", "=>", "'user-per-page'", ",", "]", ",", "'sort'", "=>", "[", "'sortParam'", "=>", "'user-sort'", ",", "'attributes'", "=>", "[", "'id'", ",", "'nickname'", ",", "'name'", "=>", "[", "'asc'", "=>", "[", "$", "this", "->", "profileAlias", ".", "'.first_name'", "=>", "SORT_ASC", ",", "$", "this", "->", "profileAlias", ".", "'.last_name'", "=>", "SORT_ASC", "]", ",", "'desc'", "=>", "[", "$", "this", "->", "profileAlias", ".", "'.first_name'", "=>", "SORT_DESC", ",", "$", "this", "->", "profileAlias", ".", "'.last_name'", "=>", "SORT_DESC", "]", ",", "'default'", "=>", "SORT_DESC", ",", "'label'", "=>", "Yii", "::", "t", "(", "'user'", ",", "'Name'", ")", ",", "]", ",", "'gender'", "=>", "[", "'asc'", "=>", "[", "$", "this", "->", "profileAlias", ".", "'.gender'", "=>", "SORT_ASC", "]", ",", "'desc'", "=>", "[", "$", "this", "->", "profileAlias", ".", "'.gender'", "=>", "SORT_DESC", "]", ",", "'default'", "=>", "SORT_ASC", ",", "'label'", "=>", "Yii", "::", "t", "(", "'user'", ",", "'Gender'", ")", ",", "]", ",", "'createdAt'", "=>", "[", "'asc'", "=>", "[", "$", "this", "->", "userAlias", ".", "'.created_at'", "=>", "SORT_ASC", "]", ",", "'desc'", "=>", "[", "$", "this", "->", "userAlias", ".", "'.created_at'", "=>", "SORT_DESC", "]", ",", "'default'", "=>", "SORT_ASC", ",", "'label'", "=>", "Yii", "::", "t", "(", "'user'", ",", "'Creation Time'", ")", ",", "]", ",", "'updatedAt'", "=>", "[", "'asc'", "=>", "[", "$", "this", "->", "userAlias", ".", "'.updated_at'", "=>", "SORT_ASC", "]", ",", "'desc'", "=>", "[", "$", "this", "->", "userAlias", ".", "'.updated_at'", "=>", "SORT_DESC", "]", ",", "'default'", "=>", "SORT_ASC", ",", "'label'", "=>", "Yii", "::", "t", "(", "'user'", ",", "'Last Updated Time'", ")", ",", "]", ",", "]", ",", "]", ",", "]", ")", ";", "if", "(", "!", "(", "$", "this", "->", "load", "(", "$", "params", ")", "&&", "$", "this", "->", "validate", "(", ")", ")", ")", "{", "return", "$", "dataProvider", ";", "}", "$", "query", "=", "$", "query", "->", "andFilterWhere", "(", "[", "'LIKE'", ",", "$", "this", "->", "userAlias", ".", "'.id'", ",", "$", "this", "->", "id", ",", "]", ")", "->", "andFilterWhere", "(", "[", "'LIKE'", ",", "$", "this", "->", "profileAlias", ".", "'.nickname'", ",", "$", "this", "->", "nickname", ",", "]", ")", "->", "andFilterWhere", "(", "[", "'>='", ",", "$", "this", "->", "userAlias", ".", "'.created_at'", ",", "$", "this", "->", "createdFromInUtc", ",", "]", ")", "->", "andFilterWhere", "(", "[", "'<='", ",", "$", "this", "->", "userAlias", ".", "'.created_at'", ",", "$", "this", "->", "createdToInUtc", ",", "]", ")", "->", "andFilterWhere", "(", "[", "'LIKE'", ",", "$", "this", "->", "profileAlias", ".", "'.first_name'", ",", "$", "this", "->", "first_name", ",", "]", ")", "->", "andFilterWhere", "(", "[", "'LIKE'", ",", "$", "this", "->", "profileAlias", ".", "'.last_name'", ",", "$", "this", "->", "last_name", ",", "]", ")", "->", "andFilterWhere", "(", "[", "$", "this", "->", "profileAlias", ".", "'.gender'", "=>", "$", "this", "->", "gf", ",", "]", ")", ";", "$", "dataProvider", "->", "query", "=", "$", "query", ";", "return", "$", "dataProvider", ";", "}" ]
Search @param array $params @return ActiveDataProvider
[ "Search" ]
train
https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/UserSearch.php#L97-L170
rhosocial/yii2-user
UserSearch.php
UserSearch.attributeLabels
public function attributeLabels() { $attributeLabels = parent::attributeLabels(); $attributeLabels['id'] = Yii::t('user', 'User ID'); $attributeLabels['nickname'] = Yii::t('user', 'Nickname'); $attributeLabels['first_name'] = Yii::t('user', 'First Name'); $attributeLabels['last_name'] = Yii::t('user', 'Last Name'); $attributeLabels['gf'] = Yii::t('user', 'Gender'); $attributeLabels['createdFrom'] = Yii::t('user', 'From'); $attributeLabels['createdTo'] = Yii::t('user', 'To'); return $attributeLabels; }
php
public function attributeLabels() { $attributeLabels = parent::attributeLabels(); $attributeLabels['id'] = Yii::t('user', 'User ID'); $attributeLabels['nickname'] = Yii::t('user', 'Nickname'); $attributeLabels['first_name'] = Yii::t('user', 'First Name'); $attributeLabels['last_name'] = Yii::t('user', 'Last Name'); $attributeLabels['gf'] = Yii::t('user', 'Gender'); $attributeLabels['createdFrom'] = Yii::t('user', 'From'); $attributeLabels['createdTo'] = Yii::t('user', 'To'); return $attributeLabels; }
[ "public", "function", "attributeLabels", "(", ")", "{", "$", "attributeLabels", "=", "parent", "::", "attributeLabels", "(", ")", ";", "$", "attributeLabels", "[", "'id'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'User ID'", ")", ";", "$", "attributeLabels", "[", "'nickname'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'Nickname'", ")", ";", "$", "attributeLabels", "[", "'first_name'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'First Name'", ")", ";", "$", "attributeLabels", "[", "'last_name'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'Last Name'", ")", ";", "$", "attributeLabels", "[", "'gf'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'Gender'", ")", ";", "$", "attributeLabels", "[", "'createdFrom'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'From'", ")", ";", "$", "attributeLabels", "[", "'createdTo'", "]", "=", "Yii", "::", "t", "(", "'user'", ",", "'To'", ")", ";", "return", "$", "attributeLabels", ";", "}" ]
Add `createdFrom` & `createdTo` attributes. @return array
[ "Add", "createdFrom", "&", "createdTo", "attributes", "." ]
train
https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/UserSearch.php#L176-L187
php-lug/lug
src/Bundle/UiBundle/DependencyInjection/Compiler/RegisterMenuPass.php
RegisterMenuPass.process
public function process(ContainerBuilder $container) { foreach ($container->findTaggedServiceIds($tag = 'lug.menu.builder') as $service => $attributes) { foreach ($attributes as $attribute) { if (!isset($attribute['alias'])) { throw new TagAttributeNotFoundException(sprintf( 'The attribute "alias" could not be found for the tag "%s" on the "%s" service.', $tag, $service )); } $container->setDefinition($service.'.menu', $this->createMenuService($service, $attribute['alias'])); } } }
php
public function process(ContainerBuilder $container) { foreach ($container->findTaggedServiceIds($tag = 'lug.menu.builder') as $service => $attributes) { foreach ($attributes as $attribute) { if (!isset($attribute['alias'])) { throw new TagAttributeNotFoundException(sprintf( 'The attribute "alias" could not be found for the tag "%s" on the "%s" service.', $tag, $service )); } $container->setDefinition($service.'.menu', $this->createMenuService($service, $attribute['alias'])); } } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "foreach", "(", "$", "container", "->", "findTaggedServiceIds", "(", "$", "tag", "=", "'lug.menu.builder'", ")", "as", "$", "service", "=>", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "attribute", ")", "{", "if", "(", "!", "isset", "(", "$", "attribute", "[", "'alias'", "]", ")", ")", "{", "throw", "new", "TagAttributeNotFoundException", "(", "sprintf", "(", "'The attribute \"alias\" could not be found for the tag \"%s\" on the \"%s\" service.'", ",", "$", "tag", ",", "$", "service", ")", ")", ";", "}", "$", "container", "->", "setDefinition", "(", "$", "service", ".", "'.menu'", ",", "$", "this", "->", "createMenuService", "(", "$", "service", ",", "$", "attribute", "[", "'alias'", "]", ")", ")", ";", "}", "}", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/UiBundle/DependencyInjection/Compiler/RegisterMenuPass.php#L29-L44
php-lug/lug
src/Bundle/UiBundle/DependencyInjection/Compiler/RegisterMenuPass.php
RegisterMenuPass.createMenuService
private function createMenuService($service, $alias) { $definition = new Definition(ItemInterface::class); $definition->setFactory([new Reference($service), 'create']); $definition->addTag('knp_menu.menu', ['alias' => $alias]); return $definition; }
php
private function createMenuService($service, $alias) { $definition = new Definition(ItemInterface::class); $definition->setFactory([new Reference($service), 'create']); $definition->addTag('knp_menu.menu', ['alias' => $alias]); return $definition; }
[ "private", "function", "createMenuService", "(", "$", "service", ",", "$", "alias", ")", "{", "$", "definition", "=", "new", "Definition", "(", "ItemInterface", "::", "class", ")", ";", "$", "definition", "->", "setFactory", "(", "[", "new", "Reference", "(", "$", "service", ")", ",", "'create'", "]", ")", ";", "$", "definition", "->", "addTag", "(", "'knp_menu.menu'", ",", "[", "'alias'", "=>", "$", "alias", "]", ")", ";", "return", "$", "definition", ";", "}" ]
@param string $service @param string $alias @return Definition
[ "@param", "string", "$service", "@param", "string", "$alias" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/UiBundle/DependencyInjection/Compiler/RegisterMenuPass.php#L52-L59
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getOauthAuthorization
public function getOauthAuthorization($client_id, $client_secret, $code) { $instance = new getOauthAuthorization($this, $this->getUserAgent(), $client_id, $client_secret, $code); return $instance; }
php
public function getOauthAuthorization($client_id, $client_secret, $code) { $instance = new getOauthAuthorization($this, $this->getUserAgent(), $client_id, $client_secret, $code); return $instance; }
[ "public", "function", "getOauthAuthorization", "(", "$", "client_id", ",", "$", "client_secret", ",", "$", "code", ")", "{", "$", "instance", "=", "new", "getOauthAuthorization", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "client_id", ",", "$", "client_secret", ",", "$", "code", ")", ";", "return", "$", "instance", ";", "}" ]
getOauthAuthorization Retrieve the Outh2 token for an application. You should have directed the user to https://github.com/login/oauth/authorize with client_id etc set before calling this. @param mixed $client_id string Required. The client ID you received from GitHub when you registered. @param mixed $client_secret string Required. The client secret you received from GitHub when you registered. @param mixed $code string Required. The code you received as a response to Step 1. @return \GithubService\Operation\getOauthAuthorization The new operation
[ "getOauthAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L218-L221
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listUsersGists
public function listUsersGists($authorization, $username) { $instance = new listUsersGists($this, $authorization, $this->getUserAgent(), $username); return $instance; }
php
public function listUsersGists($authorization, $username) { $instance = new listUsersGists($this, $authorization, $this->getUserAgent(), $username); return $instance; }
[ "public", "function", "listUsersGists", "(", "$", "authorization", ",", "$", "username", ")", "{", "$", "instance", "=", "new", "listUsersGists", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "username", ")", ";", "return", "$", "instance", ";", "}" ]
listUsersGists @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $username @return \GithubService\Operation\listUsersGists The new operation
[ "listUsersGists" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L251-L254
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.checkGistStarred
public function checkGistStarred($authorization, $id) { $instance = new checkGistStarred($this, $authorization, $this->getUserAgent(), $id); return $instance; }
php
public function checkGistStarred($authorization, $id) { $instance = new checkGistStarred($this, $authorization, $this->getUserAgent(), $id); return $instance; }
[ "public", "function", "checkGistStarred", "(", "$", "authorization", ",", "$", "id", ")", "{", "$", "instance", "=", "new", "checkGistStarred", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "id", ")", ";", "return", "$", "instance", ";", "}" ]
checkGistStarred @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $id The id of the gist to check @return \GithubService\Operation\checkGistStarred The new operation
[ "checkGistStarred" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L416-L419
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getGitIgnoreTemplate
public function getGitIgnoreTemplate($authorization, $type) { $instance = new getGitIgnoreTemplate($this, $authorization, $this->getUserAgent(), $type); return $instance; }
php
public function getGitIgnoreTemplate($authorization, $type) { $instance = new getGitIgnoreTemplate($this, $authorization, $this->getUserAgent(), $type); return $instance; }
[ "public", "function", "getGitIgnoreTemplate", "(", "$", "authorization", ",", "$", "type", ")", "{", "$", "instance", "=", "new", "getGitIgnoreTemplate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "type", ")", ";", "return", "$", "instance", ";", "}" ]
getGitIgnoreTemplate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $type Which template to get. @return \GithubService\Operation\getGitIgnoreTemplate The new operation
[ "getGitIgnoreTemplate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L497-L500
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getAuthorization
public function getAuthorization($authorization, $id) { $instance = new getAuthorization($this, $authorization, $this->getUserAgent(), $id); return $instance; }
php
public function getAuthorization($authorization, $id) { $instance = new getAuthorization($this, $authorization, $this->getUserAgent(), $id); return $instance; }
[ "public", "function", "getAuthorization", "(", "$", "authorization", ",", "$", "id", ")", "{", "$", "instance", "=", "new", "getAuthorization", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "id", ")", ";", "return", "$", "instance", ";", "}" ]
getAuthorization @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $id Which authorization to get @return \GithubService\Operation\getAuthorization The new operation
[ "getAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L651-L654
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.createAuthorization
public function createAuthorization($authorization, $scopes, $note) { $instance = new createAuthorization($this, $this->getUserAgent(), $authorization, $scopes, $note); return $instance; }
php
public function createAuthorization($authorization, $scopes, $note) { $instance = new createAuthorization($this, $this->getUserAgent(), $authorization, $scopes, $note); return $instance; }
[ "public", "function", "createAuthorization", "(", "$", "authorization", ",", "$", "scopes", ",", "$", "note", ")", "{", "$", "instance", "=", "new", "createAuthorization", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "authorization", ",", "$", "scopes", ",", "$", "note", ")", ";", "return", "$", "instance", ";", "}" ]
createAuthorization @param mixed $Authorization The basic authentication token @param mixed $scopes @param mixed $note @return \GithubService\Operation\createAuthorization The new operation
[ "createAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L664-L667
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getOrCreateAuthorization
public function getOrCreateAuthorization($authorization, $scopes, $note, $note_url, $client_id, $client_secret) { $instance = new getOrCreateAuthorization($this, $this->getUserAgent(), $authorization, $scopes, $note, $note_url, $client_id, $client_secret); return $instance; }
php
public function getOrCreateAuthorization($authorization, $scopes, $note, $note_url, $client_id, $client_secret) { $instance = new getOrCreateAuthorization($this, $this->getUserAgent(), $authorization, $scopes, $note, $note_url, $client_id, $client_secret); return $instance; }
[ "public", "function", "getOrCreateAuthorization", "(", "$", "authorization", ",", "$", "scopes", ",", "$", "note", ",", "$", "note_url", ",", "$", "client_id", ",", "$", "client_secret", ")", "{", "$", "instance", "=", "new", "getOrCreateAuthorization", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "authorization", ",", "$", "scopes", ",", "$", "note", ",", "$", "note_url", ",", "$", "client_id", ",", "$", "client_secret", ")", ";", "return", "$", "instance", ";", "}" ]
getOrCreateAuthorization @param mixed $Authorization The basic authentication token @param mixed $scopes A list of scopes that this authorization is in. @param mixed $note A note to remind you what the OAuth token is for. @param mixed $note_url A URL to remind you what app the OAuth token is for. @param mixed $client_id The 20 character OAuth app client key for which to create the token. @param mixed $client_secret The 40 character OAuth app client secret for which to create the token. @return \GithubService\Operation\getOrCreateAuthorization The new operation
[ "getOrCreateAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L682-L685
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getOrCreateAuthorizationForAppFingerprint
public function getOrCreateAuthorizationForAppFingerprint($client_secret, $scopes, $note, $note_url, $fingerprint) { $instance = new getOrCreateAuthorizationForAppFingerprint($this, $client_secret, $scopes, $note, $note_url, $fingerprint); return $instance; }
php
public function getOrCreateAuthorizationForAppFingerprint($client_secret, $scopes, $note, $note_url, $fingerprint) { $instance = new getOrCreateAuthorizationForAppFingerprint($this, $client_secret, $scopes, $note, $note_url, $fingerprint); return $instance; }
[ "public", "function", "getOrCreateAuthorizationForAppFingerprint", "(", "$", "client_secret", ",", "$", "scopes", ",", "$", "note", ",", "$", "note_url", ",", "$", "fingerprint", ")", "{", "$", "instance", "=", "new", "getOrCreateAuthorizationForAppFingerprint", "(", "$", "this", ",", "$", "client_secret", ",", "$", "scopes", ",", "$", "note", ",", "$", "note_url", ",", "$", "fingerprint", ")", ";", "return", "$", "instance", ";", "}" ]
getOrCreateAuthorizationForAppFingerprint @param mixed $client_secret The 40 character OAuth app client secret associated with the client ID specified in the URL. @param mixed $scopes A list of scopes that this authorization is in. @param mixed $note A note to remind you what the OAuth token is for. @param mixed $note_url A URL to remind you what app the OAuth token is for. @param mixed $fingerprint This attribute is only available when using the [mirage-preview](#deprecation-notice) media type.** A unique string to distinguish an authorization from others created for the same client ID and user. @return \GithubService\Operation\getOrCreateAuthorizationForAppFingerprint The new operation
[ "getOrCreateAuthorizationForAppFingerprint" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L702-L705
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.updateAuthorization
public function updateAuthorization($scopes, $add_scopes, $remove_scopes, $note, $note_url, $fingerprint) { $instance = new updateAuthorization($this, $scopes, $add_scopes, $remove_scopes, $note, $note_url, $fingerprint); return $instance; }
php
public function updateAuthorization($scopes, $add_scopes, $remove_scopes, $note, $note_url, $fingerprint) { $instance = new updateAuthorization($this, $scopes, $add_scopes, $remove_scopes, $note, $note_url, $fingerprint); return $instance; }
[ "public", "function", "updateAuthorization", "(", "$", "scopes", ",", "$", "add_scopes", ",", "$", "remove_scopes", ",", "$", "note", ",", "$", "note_url", ",", "$", "fingerprint", ")", "{", "$", "instance", "=", "new", "updateAuthorization", "(", "$", "this", ",", "$", "scopes", ",", "$", "add_scopes", ",", "$", "remove_scopes", ",", "$", "note", ",", "$", "note_url", ",", "$", "fingerprint", ")", ";", "return", "$", "instance", ";", "}" ]
updateAuthorization @param mixed $scopes Replaces the authorization scopes with these. @param mixed $add_scopes A list of scopes to add to this authorization. @param mixed $remove_scopes A list of scopes to remove from this authorization. @param mixed $note A note to remind you what the OAuth token is for. @param mixed $note_url A URL to remind you what app the OAuth token is for. @param mixed $fingerprint **This attribute is only available when using the [mirage-preview](#deprecation-notice) media type.** A unique string to distinguish an authorization from others created for the same client ID and user. @return \GithubService\Operation\updateAuthorization The new operation
[ "updateAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L721-L724
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.checkAuthorization
public function checkAuthorization($authorization, $client_id, $access_token) { $instance = new checkAuthorization($this, $this->getUserAgent(), $authorization, $client_id, $access_token); return $instance; }
php
public function checkAuthorization($authorization, $client_id, $access_token) { $instance = new checkAuthorization($this, $this->getUserAgent(), $authorization, $client_id, $access_token); return $instance; }
[ "public", "function", "checkAuthorization", "(", "$", "authorization", ",", "$", "client_id", ",", "$", "access_token", ")", "{", "$", "instance", "=", "new", "checkAuthorization", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "authorization", ",", "$", "client_id", ",", "$", "access_token", ")", ";", "return", "$", "instance", ";", "}" ]
checkAuthorization @param mixed $Authorization The basic authentication token @param mixed $client_id @param mixed $access_token @return \GithubService\Operation\checkAuthorization The new operation
[ "checkAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L750-L753
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.resetAuthorization
public function resetAuthorization($authorization, $client_id, $access_token) { $instance = new resetAuthorization($this, $this->getUserAgent(), $authorization, $client_id, $access_token); return $instance; }
php
public function resetAuthorization($authorization, $client_id, $access_token) { $instance = new resetAuthorization($this, $this->getUserAgent(), $authorization, $client_id, $access_token); return $instance; }
[ "public", "function", "resetAuthorization", "(", "$", "authorization", ",", "$", "client_id", ",", "$", "access_token", ")", "{", "$", "instance", "=", "new", "resetAuthorization", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "authorization", ",", "$", "client_id", ",", "$", "access_token", ")", ";", "return", "$", "instance", ";", "}" ]
resetAuthorization @param mixed $Authorization The basic authentication token @param mixed $client_id @param mixed $access_token @return \GithubService\Operation\resetAuthorization The new operation
[ "resetAuthorization" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L763-L766
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.revokeAllAuthority
public function revokeAllAuthority($authorization, $client_id) { $instance = new revokeAllAuthority($this, $this->getUserAgent(), $authorization, $client_id); return $instance; }
php
public function revokeAllAuthority($authorization, $client_id) { $instance = new revokeAllAuthority($this, $this->getUserAgent(), $authorization, $client_id); return $instance; }
[ "public", "function", "revokeAllAuthority", "(", "$", "authorization", ",", "$", "client_id", ")", "{", "$", "instance", "=", "new", "revokeAllAuthority", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "authorization", ",", "$", "client_id", ")", ";", "return", "$", "instance", ";", "}" ]
revokeAllAuthority @param mixed $Authorization The basic authentication token @param mixed $client_id The id of the client. @return \GithubService\Operation\revokeAllAuthority The new operation
[ "revokeAllAuthority" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L775-L778
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.revokeAuthorityForApplication
public function revokeAuthorityForApplication($authorization, $client_id, $access_token) { $instance = new revokeAuthorityForApplication($this, $this->getUserAgent(), $authorization, $client_id, $access_token); return $instance; }
php
public function revokeAuthorityForApplication($authorization, $client_id, $access_token) { $instance = new revokeAuthorityForApplication($this, $this->getUserAgent(), $authorization, $client_id, $access_token); return $instance; }
[ "public", "function", "revokeAuthorityForApplication", "(", "$", "authorization", ",", "$", "client_id", ",", "$", "access_token", ")", "{", "$", "instance", "=", "new", "revokeAuthorityForApplication", "(", "$", "this", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "authorization", ",", "$", "client_id", ",", "$", "access_token", ")", ";", "return", "$", "instance", ";", "}" ]
revokeAuthorityForApplication @param mixed $Authorization The basic authentication token @param mixed $client_id The id of the client. @param mixed $access_token The access token to delete. @return \GithubService\Operation\revokeAuthorityForApplication The new operation
[ "revokeAuthorityForApplication" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L788-L791
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoCommits
public function listRepoCommits($authorization, $owner, $repo) { $instance = new listRepoCommits($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function listRepoCommits($authorization, $owner, $repo) { $instance = new listRepoCommits($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "listRepoCommits", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "listRepoCommits", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoCommits @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner The owner of the repository @param string $repo The repository to get the commits for @return \GithubService\Operation\listRepoCommits The new operation
[ "listRepoCommits" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1046-L1049
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getArchiveLink
public function getArchiveLink($authorization, $owner, $repo, $ref) { $instance = new getArchiveLink($this, $authorization, $this->getUserAgent(), $owner, $repo, $ref); return $instance; }
php
public function getArchiveLink($authorization, $owner, $repo, $ref) { $instance = new getArchiveLink($this, $authorization, $this->getUserAgent(), $owner, $repo, $ref); return $instance; }
[ "public", "function", "getArchiveLink", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ",", "$", "ref", ")", "{", "$", "instance", "=", "new", "getArchiveLink", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ",", "$", "ref", ")", ";", "return", "$", "instance", ";", "}" ]
getArchiveLink This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $owner @param mixed $repo @param mixed $ref @return \GithubService\Operation\getArchiveLink The new operation
[ "getArchiveLink" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1168-L1171
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getDevArchiveLink
public function getDevArchiveLink($authorization, $owner, $repo) { $instance = new getDevArchiveLink($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function getDevArchiveLink($authorization, $owner, $repo) { $instance = new getDevArchiveLink($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "getDevArchiveLink", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "getDevArchiveLink", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
getDevArchiveLink This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $owner @param mixed $repo @return \GithubService\Operation\getDevArchiveLink The new operation
[ "getDevArchiveLink" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1191-L1194
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.updateFile
public function updateFile($authorization, $path, $owner, $repo, $content, $sha, $branch, $message) { $instance = new updateFile($this, $authorization, $this->getUserAgent(), $path, $owner, $repo, $content, $sha, $branch, $message); return $instance; }
php
public function updateFile($authorization, $path, $owner, $repo, $content, $sha, $branch, $message) { $instance = new updateFile($this, $authorization, $this->getUserAgent(), $path, $owner, $repo, $content, $sha, $branch, $message); return $instance; }
[ "public", "function", "updateFile", "(", "$", "authorization", ",", "$", "path", ",", "$", "owner", ",", "$", "repo", ",", "$", "content", ",", "$", "sha", ",", "$", "branch", ",", "$", "message", ")", "{", "$", "instance", "=", "new", "updateFile", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "path", ",", "$", "owner", ",", "$", "repo", ",", "$", "content", ",", "$", "sha", ",", "$", "branch", ",", "$", "message", ")", ";", "return", "$", "instance", ";", "}" ]
updateFile @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $path The content path. @param mixed $owner @param string $repo @param string $content The updated file content, Base64 encoded. @param string $sha The blob SHA of the file being replaced. @param string $branch The branch name. Default: the repository’s default branch (usually master) @param string $message The commit message. @return \GithubService\Operation\updateFile The new operation
[ "updateFile" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1215-L1218
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listSelfRepos
public function listSelfRepos($authorization, $type, $sort, $direction) { $instance = new listSelfRepos($this, $authorization, $this->getUserAgent(), $type, $sort, $direction); return $instance; }
php
public function listSelfRepos($authorization, $type, $sort, $direction) { $instance = new listSelfRepos($this, $authorization, $this->getUserAgent(), $type, $sort, $direction); return $instance; }
[ "public", "function", "listSelfRepos", "(", "$", "authorization", ",", "$", "type", ",", "$", "sort", ",", "$", "direction", ")", "{", "$", "instance", "=", "new", "listSelfRepos", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "type", ",", "$", "sort", ",", "$", "direction", ")", ";", "return", "$", "instance", ";", "}" ]
listSelfRepos @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $type Can be one of `all`, `owner`, `member`. Default: `owner` @param string $sort Can be one of `created`, `updated`, `pushed`, `full_name`. Default: `full_name` @param string $direction Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`, otherwise `desc` @return \GithubService\Operation\listSelfRepos The new operation
[ "listSelfRepos" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1506-L1509
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listUserRepos
public function listUserRepos($authorization, $username) { $instance = new listUserRepos($this, $authorization, $this->getUserAgent(), $username); return $instance; }
php
public function listUserRepos($authorization, $username) { $instance = new listUserRepos($this, $authorization, $this->getUserAgent(), $username); return $instance; }
[ "public", "function", "listUserRepos", "(", "$", "authorization", ",", "$", "username", ")", "{", "$", "instance", "=", "new", "listUserRepos", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "username", ")", ";", "return", "$", "instance", ";", "}" ]
listUserRepos @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $username The user to get the repos of. @return \GithubService\Operation\listUserRepos The new operation
[ "listUserRepos" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1523-L1526
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listOrgRepos
public function listOrgRepos($authorization, $org, $type) { $instance = new listOrgRepos($this, $authorization, $this->getUserAgent(), $org, $type); return $instance; }
php
public function listOrgRepos($authorization, $org, $type) { $instance = new listOrgRepos($this, $authorization, $this->getUserAgent(), $org, $type); return $instance; }
[ "public", "function", "listOrgRepos", "(", "$", "authorization", ",", "$", "org", ",", "$", "type", ")", "{", "$", "instance", "=", "new", "listOrgRepos", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "org", ",", "$", "type", ")", ";", "return", "$", "instance", ";", "}" ]
listOrgRepos @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $org The organisation to get the repos of. @param string $type Can be one of `all`, `public`, `private`, `forks`, `sources`, `member`. Default: `all` @return \GithubService\Operation\listOrgRepos The new operation
[ "listOrgRepos" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1542-L1545
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listPublicRepos
public function listPublicRepos($authorization, $since) { $instance = new listPublicRepos($this, $authorization, $this->getUserAgent(), $since); return $instance; }
php
public function listPublicRepos($authorization, $since) { $instance = new listPublicRepos($this, $authorization, $this->getUserAgent(), $since); return $instance; }
[ "public", "function", "listPublicRepos", "(", "$", "authorization", ",", "$", "since", ")", "{", "$", "instance", "=", "new", "listPublicRepos", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "since", ")", ";", "return", "$", "instance", ";", "}" ]
listPublicRepos @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $since The integer ID of the last Repository that you've seen. @return \GithubService\Operation\listPublicRepos The new operation
[ "listPublicRepos" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1559-L1562
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getRepo
public function getRepo($authorization, $owner, $repo) { $instance = new getRepo($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function getRepo($authorization, $owner, $repo) { $instance = new getRepo($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "getRepo", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "getRepo", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
getRepo @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @return \GithubService\Operation\getRepo The new operation
[ "getRepo" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1587-L1590
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoContributors
public function listRepoContributors($authorization, $owner, $repo, $anon) { $instance = new listRepoContributors($this, $authorization, $this->getUserAgent(), $owner, $repo, $anon); return $instance; }
php
public function listRepoContributors($authorization, $owner, $repo, $anon) { $instance = new listRepoContributors($this, $authorization, $this->getUserAgent(), $owner, $repo, $anon); return $instance; }
[ "public", "function", "listRepoContributors", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ",", "$", "anon", ")", "{", "$", "instance", "=", "new", "listRepoContributors", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ",", "$", "anon", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoContributors @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @param string $anon @return \GithubService\Operation\listRepoContributors The new operation
[ "listRepoContributors" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1616-L1619
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoLanguages
public function listRepoLanguages($authorization, $owner, $repo) { $instance = new listRepoLanguages($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function listRepoLanguages($authorization, $owner, $repo) { $instance = new listRepoLanguages($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "listRepoLanguages", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "listRepoLanguages", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoLanguages @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @return \GithubService\Operation\listRepoLanguages The new operation
[ "listRepoLanguages" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1634-L1637
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoTeams
public function listRepoTeams($authorization, $owner, $repo) { $instance = new listRepoTeams($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function listRepoTeams($authorization, $owner, $repo) { $instance = new listRepoTeams($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "listRepoTeams", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "listRepoTeams", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoTeams @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @return \GithubService\Operation\listRepoTeams The new operation
[ "listRepoTeams" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1652-L1655
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoTags
public function listRepoTags($authorization, $owner, $repo) { $instance = new listRepoTags($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function listRepoTags($authorization, $owner, $repo) { $instance = new listRepoTags($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "listRepoTags", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "listRepoTags", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoTags @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @return \GithubService\Operation\listRepoTags The new operation
[ "listRepoTags" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1670-L1673
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoBranches
public function listRepoBranches($authorization, $owner, $repo) { $instance = new listRepoBranches($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function listRepoBranches($authorization, $owner, $repo) { $instance = new listRepoBranches($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "listRepoBranches", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "listRepoBranches", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoBranches @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @return \GithubService\Operation\listRepoBranches The new operation
[ "listRepoBranches" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1688-L1691
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getRepoBranch
public function getRepoBranch($authorization, $username) { $instance = new getRepoBranch($this, $authorization, $this->getUserAgent(), $username); return $instance; }
php
public function getRepoBranch($authorization, $username) { $instance = new getRepoBranch($this, $authorization, $this->getUserAgent(), $username); return $instance; }
[ "public", "function", "getRepoBranch", "(", "$", "authorization", ",", "$", "username", ")", "{", "$", "instance", "=", "new", "getRepoBranch", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "username", ")", ";", "return", "$", "instance", ";", "}" ]
getRepoBranch @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $username @return \GithubService\Operation\getRepoBranch The new operation
[ "getRepoBranch" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1705-L1708
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.deleteRepo
public function deleteRepo($authorization, $owner, $repo) { $instance = new deleteRepo($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
php
public function deleteRepo($authorization, $owner, $repo) { $instance = new deleteRepo($this, $authorization, $this->getUserAgent(), $owner, $repo); return $instance; }
[ "public", "function", "deleteRepo", "(", "$", "authorization", ",", "$", "owner", ",", "$", "repo", ")", "{", "$", "instance", "=", "new", "deleteRepo", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "owner", ",", "$", "repo", ")", ";", "return", "$", "instance", ";", "}" ]
deleteRepo @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $owner @param string $repo @return \GithubService\Operation\deleteRepo The new operation
[ "deleteRepo" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1723-L1726
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.searchRepos
public function searchRepos($authorization, $q) { $instance = new searchRepos($this, $authorization, $this->getUserAgent(), $q); return $instance; }
php
public function searchRepos($authorization, $q) { $instance = new searchRepos($this, $authorization, $this->getUserAgent(), $q); return $instance; }
[ "public", "function", "searchRepos", "(", "$", "authorization", ",", "$", "q", ")", "{", "$", "instance", "=", "new", "searchRepos", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "q", ")", ";", "return", "$", "instance", ";", "}" ]
searchRepos @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $q The search keywords, as well as any qualifiers. @return \GithubService\Operation\searchRepos The new operation
[ "searchRepos" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1740-L1743
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.addUserEmail
public function addUserEmail($authorization, $username) { $instance = new addUserEmail($this, $authorization, $this->getUserAgent(), $username); return $instance; }
php
public function addUserEmail($authorization, $username) { $instance = new addUserEmail($this, $authorization, $this->getUserAgent(), $username); return $instance; }
[ "public", "function", "addUserEmail", "(", "$", "authorization", ",", "$", "username", ")", "{", "$", "instance", "=", "new", "addUserEmail", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "username", ")", ";", "return", "$", "instance", ";", "}" ]
addUserEmail @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string or array $username A single email address or an array of addresses @return \GithubService\Operation\addUserEmail The new operation
[ "addUserEmail" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1803-L1806
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getUser
public function getUser($authorization, $username) { $instance = new getUser($this, $authorization, $this->getUserAgent(), $username); return $instance; }
php
public function getUser($authorization, $username) { $instance = new getUser($this, $authorization, $this->getUserAgent(), $username); return $instance; }
[ "public", "function", "getUser", "(", "$", "authorization", ",", "$", "username", ")", "{", "$", "instance", "=", "new", "getUser", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "username", ")", ";", "return", "$", "instance", ";", "}" ]
getUser @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param string $username The github name of the user. @return \GithubService\Operation\getUser The new operation
[ "getUser" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1830-L1833
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listEmojisPaginate
public function listEmojisPaginate($authorization, $pageURL) { $instance = new listEmojisPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listEmojisPaginate($authorization, $pageURL) { $instance = new listEmojisPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listEmojisPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listEmojisPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listEmojisPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listEmojisPaginate The new operation
[ "listEmojisPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1883-L1886
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listUsersGistsPaginate
public function listUsersGistsPaginate($authorization, $pageURL) { $instance = new listUsersGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listUsersGistsPaginate($authorization, $pageURL) { $instance = new listUsersGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listUsersGistsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listUsersGistsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listUsersGistsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listUsersGistsPaginate The new operation
[ "listUsersGistsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1900-L1903
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listSelfGistsPaginate
public function listSelfGistsPaginate($authorization, $pageURL) { $instance = new listSelfGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listSelfGistsPaginate($authorization, $pageURL) { $instance = new listSelfGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listSelfGistsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listSelfGistsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listSelfGistsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listSelfGistsPaginate The new operation
[ "listSelfGistsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1917-L1920
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listPublicGistsPaginate
public function listPublicGistsPaginate($authorization, $pageURL) { $instance = new listPublicGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listPublicGistsPaginate($authorization, $pageURL) { $instance = new listPublicGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listPublicGistsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listPublicGistsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listPublicGistsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listPublicGistsPaginate The new operation
[ "listPublicGistsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1934-L1937
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listSelfStarredGistsPaginate
public function listSelfStarredGistsPaginate($authorization, $pageURL) { $instance = new listSelfStarredGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listSelfStarredGistsPaginate($authorization, $pageURL) { $instance = new listSelfStarredGistsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listSelfStarredGistsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listSelfStarredGistsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listSelfStarredGistsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listSelfStarredGistsPaginate The new operation
[ "listSelfStarredGistsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1951-L1954
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getGistPaginate
public function getGistPaginate($authorization, $pageURL) { $instance = new getGistPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function getGistPaginate($authorization, $pageURL) { $instance = new getGistPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "getGistPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "getGistPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
getGistPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\getGistPaginate The new operation
[ "getGistPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1968-L1971
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getGistByRevisionPaginate
public function getGistByRevisionPaginate($authorization, $pageURL) { $instance = new getGistByRevisionPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function getGistByRevisionPaginate($authorization, $pageURL) { $instance = new getGistByRevisionPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "getGistByRevisionPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "getGistByRevisionPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
getGistByRevisionPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\getGistByRevisionPaginate The new operation
[ "getGistByRevisionPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L1985-L1988
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listGistCommitsPaginate
public function listGistCommitsPaginate($authorization, $pageURL) { $instance = new listGistCommitsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listGistCommitsPaginate($authorization, $pageURL) { $instance = new listGistCommitsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listGistCommitsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listGistCommitsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listGistCommitsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listGistCommitsPaginate The new operation
[ "listGistCommitsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2002-L2005
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.checkGistStarredPaginate
public function checkGistStarredPaginate($authorization, $pageURL) { $instance = new checkGistStarredPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function checkGistStarredPaginate($authorization, $pageURL) { $instance = new checkGistStarredPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "checkGistStarredPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "checkGistStarredPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
checkGistStarredPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\checkGistStarredPaginate The new operation
[ "checkGistStarredPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2019-L2022
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listGistForksPaginate
public function listGistForksPaginate($authorization, $pageURL) { $instance = new listGistForksPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listGistForksPaginate($authorization, $pageURL) { $instance = new listGistForksPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listGistForksPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listGistForksPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listGistForksPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listGistForksPaginate The new operation
[ "listGistForksPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2036-L2039
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listGitIgnoreTemplatesPaginate
public function listGitIgnoreTemplatesPaginate($authorization, $pageURL) { $instance = new listGitIgnoreTemplatesPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listGitIgnoreTemplatesPaginate($authorization, $pageURL) { $instance = new listGitIgnoreTemplatesPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listGitIgnoreTemplatesPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listGitIgnoreTemplatesPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listGitIgnoreTemplatesPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listGitIgnoreTemplatesPaginate The new operation
[ "listGitIgnoreTemplatesPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2054-L2057
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getGitIgnoreTemplatePaginate
public function getGitIgnoreTemplatePaginate($authorization, $pageURL) { $instance = new getGitIgnoreTemplatePaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function getGitIgnoreTemplatePaginate($authorization, $pageURL) { $instance = new getGitIgnoreTemplatePaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "getGitIgnoreTemplatePaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "getGitIgnoreTemplatePaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
getGitIgnoreTemplatePaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\getGitIgnoreTemplatePaginate The new operation
[ "getGitIgnoreTemplatePaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2071-L2074
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getAuthorizationsPaginate
public function getAuthorizationsPaginate($authorization, $pageURL) { $instance = new getAuthorizationsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function getAuthorizationsPaginate($authorization, $pageURL) { $instance = new getAuthorizationsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "getAuthorizationsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "getAuthorizationsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
getAuthorizationsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\getAuthorizationsPaginate The new operation
[ "getAuthorizationsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2088-L2091
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getAuthorizationPaginate
public function getAuthorizationPaginate($authorization, $pageURL) { $instance = new getAuthorizationPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function getAuthorizationPaginate($authorization, $pageURL) { $instance = new getAuthorizationPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "getAuthorizationPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "getAuthorizationPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
getAuthorizationPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\getAuthorizationPaginate The new operation
[ "getAuthorizationPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2105-L2108
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listRepoCommitsPaginate
public function listRepoCommitsPaginate($authorization, $pageURL) { $instance = new listRepoCommitsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listRepoCommitsPaginate($authorization, $pageURL) { $instance = new listRepoCommitsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listRepoCommitsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listRepoCommitsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listRepoCommitsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listRepoCommitsPaginate The new operation
[ "listRepoCommitsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2122-L2125
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.getCommitPaginate
public function getCommitPaginate($authorization, $pageURL) { $instance = new getCommitPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function getCommitPaginate($authorization, $pageURL) { $instance = new getCommitPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "getCommitPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "getCommitPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
getCommitPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\getCommitPaginate The new operation
[ "getCommitPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2139-L2142
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.compareTwoCommitsPaginate
public function compareTwoCommitsPaginate($authorization, $pageURL) { $instance = new compareTwoCommitsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function compareTwoCommitsPaginate($authorization, $pageURL) { $instance = new compareTwoCommitsPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "compareTwoCommitsPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "compareTwoCommitsPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
compareTwoCommitsPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\compareTwoCommitsPaginate The new operation
[ "compareTwoCommitsPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2156-L2159
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.compareTwoCommitsForksPaginate
public function compareTwoCommitsForksPaginate($authorization, $pageURL) { $instance = new compareTwoCommitsForksPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function compareTwoCommitsForksPaginate($authorization, $pageURL) { $instance = new compareTwoCommitsForksPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "compareTwoCommitsForksPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "compareTwoCommitsForksPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
compareTwoCommitsForksPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\compareTwoCommitsForksPaginate The new operation
[ "compareTwoCommitsForksPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2174-L2177
Danack/GithubArtaxService
lib/GithubService/GithubArtaxService/GithubArtaxService.php
GithubArtaxService.listSelfReposPaginate
public function listSelfReposPaginate($authorization, $pageURL) { $instance = new listSelfReposPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
php
public function listSelfReposPaginate($authorization, $pageURL) { $instance = new listSelfReposPaginate($this, $authorization, $this->getUserAgent(), $pageURL); return $instance; }
[ "public", "function", "listSelfReposPaginate", "(", "$", "authorization", ",", "$", "pageURL", ")", "{", "$", "instance", "=", "new", "listSelfReposPaginate", "(", "$", "this", ",", "$", "authorization", ",", "$", "this", "->", "getUserAgent", "(", ")", ",", "$", "pageURL", ")", ";", "return", "$", "instance", ";", "}" ]
listSelfReposPaginate @param GithubService\AuthToken $Authorization The token to use for the request. This should either be an a complete token in the format appropriate format e.g. 'token 123567890' for an oauth token, or '"Basic ".base64_encode($username.":".$password)"' for a Basic token or anything that can be cast to a string in the correct format e.g. an \ArtaxServiceBuilder\BasicAuthToken object. @param mixed $pageURL @return \GithubService\Operation\listSelfReposPaginate The new operation
[ "listSelfReposPaginate" ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubArtaxService.php#L2191-L2194