id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,100 | shimabox/SMBArrayto | src/SMB/Arrayto/Traits/Xml/Creatable.php | Creatable.createOutputContents | protected function createOutputContents()
{
$dom = $this->formatterInstance()
->forge(
$this->rows,
$this->rootElementName,
$this->replaceSpacesByUnderScoresInKeyNames,
$this->versionOfXmlDecl... | php | protected function createOutputContents()
{
$dom = $this->formatterInstance()
->forge(
$this->rows,
$this->rootElementName,
$this->replaceSpacesByUnderScoresInKeyNames,
$this->versionOfXmlDecl... | [
"protected",
"function",
"createOutputContents",
"(",
")",
"{",
"$",
"dom",
"=",
"$",
"this",
"->",
"formatterInstance",
"(",
")",
"->",
"forge",
"(",
"$",
"this",
"->",
"rows",
",",
"$",
"this",
"->",
"rootElementName",
",",
"$",
"this",
"->",
"replaceS... | Create an output content for XML
@return string | [
"Create",
"an",
"output",
"content",
"for",
"XML"
] | 7ecacc0c15994c02224bbd3efe055d3bce243971 | https://github.com/shimabox/SMBArrayto/blob/7ecacc0c15994c02224bbd3efe055d3bce243971/src/SMB/Arrayto/Traits/Xml/Creatable.php#L89-L103 |
31,101 | pulsarvp/vps-tools | src/html/Form.php | Form.init | public function init ()
{
if (!in_array($this->layout, [ 'default', 'horizontal', 'inline' ]))
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
if ($this->layout !== 'default')
Html::addCssClass($this->options, 'form-' . $this->layout);
if ($this->name)
$this->options[... | php | public function init ()
{
if (!in_array($this->layout, [ 'default', 'horizontal', 'inline' ]))
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
if ($this->layout !== 'default')
Html::addCssClass($this->options, 'form-' . $this->layout);
if ($this->name)
$this->options[... | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"layout",
",",
"[",
"'default'",
",",
"'horizontal'",
",",
"'inline'",
"]",
")",
")",
"throw",
"new",
"InvalidConfigException",
"(",
"'Invalid layout type: '",
... | Adds some default configuration. I.e. form name and layout class.
@inheritdoc | [
"Adds",
"some",
"default",
"configuration",
".",
"I",
".",
"e",
".",
"form",
"name",
"and",
"layout",
"class",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/html/Form.php#L71-L83 |
31,102 | pulsarvp/vps-tools | src/modules/page/controllers/PageController.php | PageController.actionFrontend | public function actionFrontend ($id)
{
$page = Page::find()->where([ 'guid' => $id ])->one();
if ($page === null)
{
throw new \yii\web\HttpException(404);
}
$this->setTitle($page->title);
$this->data('page', $page);
$this->_tpl = '@pageViews/page';
} | php | public function actionFrontend ($id)
{
$page = Page::find()->where([ 'guid' => $id ])->one();
if ($page === null)
{
throw new \yii\web\HttpException(404);
}
$this->setTitle($page->title);
$this->data('page', $page);
$this->_tpl = '@pageViews/page';
} | [
"public",
"function",
"actionFrontend",
"(",
"$",
"id",
")",
"{",
"$",
"page",
"=",
"Page",
"::",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'guid'",
"=>",
"$",
"id",
"]",
")",
"->",
"one",
"(",
")",
";",
"if",
"(",
"$",
"page",
"===",
"null",... | View frontend page
@param $id page | [
"View",
"frontend",
"page"
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/page/controllers/PageController.php#L123-L134 |
31,103 | shimabox/SMBArrayto | src/SMB/Arrayto/Traits/Xsv/Creatable.php | Creatable.createOutputContents | protected function createOutputContents(
array $header,
$delimiter = ',',
$enclosure = '"',
$toConvert = true
)
{
$fp = fopen("php://temp", 'r+b');
// header
if ($header) {
fputcsv($fp, $header, $delimiter, $enclosure);
}
fore... | php | protected function createOutputContents(
array $header,
$delimiter = ',',
$enclosure = '"',
$toConvert = true
)
{
$fp = fopen("php://temp", 'r+b');
// header
if ($header) {
fputcsv($fp, $header, $delimiter, $enclosure);
}
fore... | [
"protected",
"function",
"createOutputContents",
"(",
"array",
"$",
"header",
",",
"$",
"delimiter",
"=",
"','",
",",
"$",
"enclosure",
"=",
"'\"'",
",",
"$",
"toConvert",
"=",
"true",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"\"php://temp\"",
",",
"'r+b'... | Create an output content
@param array $header
@param string $delimiter
@param string $enclosure
@param boolean $toConvert true : LF => CRLF, UTF-8 => SJIS-win, false : LF, UTF-8
@return string | [
"Create",
"an",
"output",
"content"
] | 7ecacc0c15994c02224bbd3efe055d3bce243971 | https://github.com/shimabox/SMBArrayto/blob/7ecacc0c15994c02224bbd3efe055d3bce243971/src/SMB/Arrayto/Traits/Xsv/Creatable.php#L36-L68 |
31,104 | wikimedia/slimapp | src/Auth/Password.php | Password.comparePasswordToHash | public static function comparePasswordToHash( $plainText, $hash ) {
if ( self::isBlowfishHash( $hash ) ) {
$check = crypt( $plainText, $hash );
} else {
// horrible unsalted md5 that legacy app used for passwords
$check = md5( $plainText );
}
return self::hashEquals( $hash, $check );
} | php | public static function comparePasswordToHash( $plainText, $hash ) {
if ( self::isBlowfishHash( $hash ) ) {
$check = crypt( $plainText, $hash );
} else {
// horrible unsalted md5 that legacy app used for passwords
$check = md5( $plainText );
}
return self::hashEquals( $hash, $check );
} | [
"public",
"static",
"function",
"comparePasswordToHash",
"(",
"$",
"plainText",
",",
"$",
"hash",
")",
"{",
"if",
"(",
"self",
"::",
"isBlowfishHash",
"(",
"$",
"hash",
")",
")",
"{",
"$",
"check",
"=",
"crypt",
"(",
"$",
"plainText",
",",
"$",
"hash",... | Compare a plain text string to a stored password hash.
@param string $plainText Password to check
@param string $hash Stored hash to compare with
@return bool True if plain text matches hash, false otherwise | [
"Compare",
"a",
"plain",
"text",
"string",
"to",
"a",
"stored",
"password",
"hash",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Auth/Password.php#L47-L57 |
31,105 | wikimedia/slimapp | src/Auth/Password.php | Password.blowfishSalt | public static function blowfishSalt( $cost = 8 ) {
// encoding algorithm from http://www.openwall.com/phpass/
$itoa = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
if ( $cost < 4 || $cost > 31 ) {
$cost = 8;
}
$random = self::getBytes( 16 );
$output = self::BLOWFISH_PREFIX;
$outp... | php | public static function blowfishSalt( $cost = 8 ) {
// encoding algorithm from http://www.openwall.com/phpass/
$itoa = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
if ( $cost < 4 || $cost > 31 ) {
$cost = 8;
}
$random = self::getBytes( 16 );
$output = self::BLOWFISH_PREFIX;
$outp... | [
"public",
"static",
"function",
"blowfishSalt",
"(",
"$",
"cost",
"=",
"8",
")",
"{",
"// encoding algorithm from http://www.openwall.com/phpass/",
"$",
"itoa",
"=",
"'./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'",
";",
"if",
"(",
"$",
"cost",
"<",
"4... | Generate a blowfish salt specification.
@param int $cost Cost factor
@return string Blowfish salt | [
"Generate",
"a",
"blowfish",
"salt",
"specification",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Auth/Password.php#L81-L116 |
31,106 | wikimedia/slimapp | src/Auth/Password.php | Password.getBytes | public static function getBytes( $count, $allowWeak = false ) {
if ( function_exists( 'random_bytes' ) ) {
$bytes = random_bytes( $count );
if ( strlen( $bytes ) === $count ) {
return $bytes;
}
}
if ( function_exists( 'mcrypt_create_iv' ) ) {
$bytes = mcrypt_create_iv( $count, MCRYPT_DEV_URANDOM ... | php | public static function getBytes( $count, $allowWeak = false ) {
if ( function_exists( 'random_bytes' ) ) {
$bytes = random_bytes( $count );
if ( strlen( $bytes ) === $count ) {
return $bytes;
}
}
if ( function_exists( 'mcrypt_create_iv' ) ) {
$bytes = mcrypt_create_iv( $count, MCRYPT_DEV_URANDOM ... | [
"public",
"static",
"function",
"getBytes",
"(",
"$",
"count",
",",
"$",
"allowWeak",
"=",
"false",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'random_bytes'",
")",
")",
"{",
"$",
"bytes",
"=",
"random_bytes",
"(",
"$",
"count",
")",
";",
"if",
"(",... | Get N high entropy random bytes.
@param int $count Number of bytes to generate
@param bool $allowWeak Allow weak entropy sources
@return string String of random bytes
@throws InvalidArgumentException if $allowWeak is false and no high
entropy sources of random data can be found | [
"Get",
"N",
"high",
"entropy",
"random",
"bytes",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Auth/Password.php#L127-L190 |
31,107 | wikimedia/slimapp | src/Auth/Password.php | Password.isBlowfishHash | public static function isBlowfishHash( $hash ) {
$peek = strlen( self::BLOWFISH_PREFIX );
return strlen( $hash ) == 60 &&
substr( $hash, 0, $peek ) == self::BLOWFISH_PREFIX;
} | php | public static function isBlowfishHash( $hash ) {
$peek = strlen( self::BLOWFISH_PREFIX );
return strlen( $hash ) == 60 &&
substr( $hash, 0, $peek ) == self::BLOWFISH_PREFIX;
} | [
"public",
"static",
"function",
"isBlowfishHash",
"(",
"$",
"hash",
")",
"{",
"$",
"peek",
"=",
"strlen",
"(",
"self",
"::",
"BLOWFISH_PREFIX",
")",
";",
"return",
"strlen",
"(",
"$",
"hash",
")",
"==",
"60",
"&&",
"substr",
"(",
"$",
"hash",
",",
"0... | Check a salt specification to see if it is a blowfish crypt value.
@param string $hash Hash to check
@return bool True if blowfish, false otherwise. | [
"Check",
"a",
"salt",
"specification",
"to",
"see",
"if",
"it",
"is",
"a",
"blowfish",
"crypt",
"value",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Auth/Password.php#L198-L202 |
31,108 | wikimedia/slimapp | src/Auth/Password.php | Password.hashEquals | public static function hashEquals( $known, $input ) {
if ( !is_string( $known ) ) {
return false;
}
if ( !is_string( $input ) ) {
return false;
}
if ( function_exists( 'hash_equals' ) ) {
return hash_equals( $known, $input );
} else {
// hash_equals() polyfill taken from MediaWiki
$len = st... | php | public static function hashEquals( $known, $input ) {
if ( !is_string( $known ) ) {
return false;
}
if ( !is_string( $input ) ) {
return false;
}
if ( function_exists( 'hash_equals' ) ) {
return hash_equals( $known, $input );
} else {
// hash_equals() polyfill taken from MediaWiki
$len = st... | [
"public",
"static",
"function",
"hashEquals",
"(",
"$",
"known",
",",
"$",
"input",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"known",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"input",
")",
")",
"{... | Check whether a user-provided string is equal to a fixed-length secret
string without revealing bytes of the secret string through timing
differences.
Implementation for PHP deployments which do not natively have
hash_equals taken from MediaWiki's hash_equals() polyfill function.
@param string $known Fixed-length sec... | [
"Check",
"whether",
"a",
"user",
"-",
"provided",
"string",
"is",
"equal",
"to",
"a",
"fixed",
"-",
"length",
"secret",
"string",
"without",
"revealing",
"bytes",
"of",
"the",
"secret",
"string",
"through",
"timing",
"differences",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Auth/Password.php#L255-L280 |
31,109 | bearcms/bearframework-addon | classes/BearCMS/CurrentUser.php | CurrentUser.getSessionKey | public function getSessionKey(): ?string
{
$cacheKey = 'sessionkey';
if (!isset(self::$cache[$cacheKey])) {
$cookies = Internal\Cookies::getList(Internal\Cookies::TYPE_SERVER);
$cookieKey = '_s';
$key = isset($cookies[$cookieKey]) ? (string) $cookies[$cookieKey] :... | php | public function getSessionKey(): ?string
{
$cacheKey = 'sessionkey';
if (!isset(self::$cache[$cacheKey])) {
$cookies = Internal\Cookies::getList(Internal\Cookies::TYPE_SERVER);
$cookieKey = '_s';
$key = isset($cookies[$cookieKey]) ? (string) $cookies[$cookieKey] :... | [
"public",
"function",
"getSessionKey",
"(",
")",
":",
"?",
"string",
"{",
"$",
"cacheKey",
"=",
"'sessionkey'",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"cache",
"[",
"$",
"cacheKey",
"]",
")",
")",
"{",
"$",
"cookies",
"=",
"Internal",
... | Returns the session key if there is a logged in user
@return string|null The session key if there is a logged in user, NULL otherwise | [
"Returns",
"the",
"session",
"key",
"if",
"there",
"is",
"a",
"logged",
"in",
"user"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/CurrentUser.php#L42-L52 |
31,110 | bearcms/bearframework-addon | classes/BearCMS/CurrentUser.php | CurrentUser.getID | public function getID(): ?string
{
$sessionKey = $this->getSessionKey();
if (strlen($sessionKey) === 0) {
return null;
}
$cacheKey = 'id-' . $sessionKey;
if (!isset(self::$cache[$cacheKey])) {
self::$cache[$cacheKey] = null;
$data = Interna... | php | public function getID(): ?string
{
$sessionKey = $this->getSessionKey();
if (strlen($sessionKey) === 0) {
return null;
}
$cacheKey = 'id-' . $sessionKey;
if (!isset(self::$cache[$cacheKey])) {
self::$cache[$cacheKey] = null;
$data = Interna... | [
"public",
"function",
"getID",
"(",
")",
":",
"?",
"string",
"{",
"$",
"sessionKey",
"=",
"$",
"this",
"->",
"getSessionKey",
"(",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"sessionKey",
")",
"===",
"0",
")",
"{",
"return",
"null",
";",
"}",
"$",
... | Returns the current logged in user ID
@return string|null ID of the current logged in user or null | [
"Returns",
"the",
"current",
"logged",
"in",
"user",
"ID"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/CurrentUser.php#L59-L74 |
31,111 | bearcms/bearframework-addon | classes/BearCMS/CurrentUser.php | CurrentUser.getPermissions | public function getPermissions(): array
{
$userID = $this->getID();
if ($userID === null) {
return [];
}
$data = Internal\Data::getValue('bearcms/users/user/' . md5($userID) . '.json');
if ($data !== null) {
$user = json_decode($data, true);
... | php | public function getPermissions(): array
{
$userID = $this->getID();
if ($userID === null) {
return [];
}
$data = Internal\Data::getValue('bearcms/users/user/' . md5($userID) . '.json');
if ($data !== null) {
$user = json_decode($data, true);
... | [
"public",
"function",
"getPermissions",
"(",
")",
":",
"array",
"{",
"$",
"userID",
"=",
"$",
"this",
"->",
"getID",
"(",
")",
";",
"if",
"(",
"$",
"userID",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"data",
"=",
"Internal",
"\\... | Returns the current logged in user permissions
@return array Array containing the permission of the current logged in user | [
"Returns",
"the",
"current",
"logged",
"in",
"user",
"permissions"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/CurrentUser.php#L81-L93 |
31,112 | bearcms/bearframework-addon | classes/BearCMS/CurrentUser.php | CurrentUser.hasPermission | public function hasPermission(string $name): bool
{
$permissions = $this->getPermissions();
if (array_search('all', $permissions) !== false) {
return true;
}
return array_search($name, $permissions) !== false;
} | php | public function hasPermission(string $name): bool
{
$permissions = $this->getPermissions();
if (array_search('all', $permissions) !== false) {
return true;
}
return array_search($name, $permissions) !== false;
} | [
"public",
"function",
"hasPermission",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"$",
"permissions",
"=",
"$",
"this",
"->",
"getPermissions",
"(",
")",
";",
"if",
"(",
"array_search",
"(",
"'all'",
",",
"$",
"permissions",
")",
"!==",
"false",
... | Checks whether the current logged in user has the specified permission
@param string $name The name of the permission
@return boolean TRUE if the current logged in user has the permission specified, FALSE otherwise
@throws \InvalidArgumentException | [
"Checks",
"whether",
"the",
"current",
"logged",
"in",
"user",
"has",
"the",
"specified",
"permission"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/CurrentUser.php#L102-L109 |
31,113 | bearcms/bearframework-addon | classes/BearCMS/CurrentUser.php | CurrentUser.login | public function login(string $userID): bool
{
$data = Internal\Server::call('login', ['userID' => $userID], true);
if (isset($data['result'])) {
return $data['result'] === 'ok';
}
return false;
} | php | public function login(string $userID): bool
{
$data = Internal\Server::call('login', ['userID' => $userID], true);
if (isset($data['result'])) {
return $data['result'] === 'ok';
}
return false;
} | [
"public",
"function",
"login",
"(",
"string",
"$",
"userID",
")",
":",
"bool",
"{",
"$",
"data",
"=",
"Internal",
"\\",
"Server",
"::",
"call",
"(",
"'login'",
",",
"[",
"'userID'",
"=>",
"$",
"userID",
"]",
",",
"true",
")",
";",
"if",
"(",
"isset... | Login a user without email and password validation. This methods must be enabled on the CMS server.
@param string $userID
@return bool Returns TRUE if the user is logged in successfully, FALSE otherwise. | [
"Login",
"a",
"user",
"without",
"email",
"and",
"password",
"validation",
".",
"This",
"methods",
"must",
"be",
"enabled",
"on",
"the",
"CMS",
"server",
"."
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/CurrentUser.php#L117-L124 |
31,114 | bearcms/bearframework-addon | classes/BearCMS/CurrentUser.php | CurrentUser.logout | public function logout(): void
{
Internal\Cookies::setList(Internal\Cookies::TYPE_SERVER, [
['name' => '_s', 'value' => 'deleted', 'expire' => 0],
['name' => '_a', 'value' => 'deleted', 'expire' => 0]
]);
self::$cache = [];
} | php | public function logout(): void
{
Internal\Cookies::setList(Internal\Cookies::TYPE_SERVER, [
['name' => '_s', 'value' => 'deleted', 'expire' => 0],
['name' => '_a', 'value' => 'deleted', 'expire' => 0]
]);
self::$cache = [];
} | [
"public",
"function",
"logout",
"(",
")",
":",
"void",
"{",
"Internal",
"\\",
"Cookies",
"::",
"setList",
"(",
"Internal",
"\\",
"Cookies",
"::",
"TYPE_SERVER",
",",
"[",
"[",
"'name'",
"=>",
"'_s'",
",",
"'value'",
"=>",
"'deleted'",
",",
"'expire'",
"=... | Logout the current user.
@param string $userID
@throws \InvalidArgumentException | [
"Logout",
"the",
"current",
"user",
"."
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/CurrentUser.php#L132-L139 |
31,115 | pulsarvp/vps-tools | src/modules/user/widgets/RbacWidget.php | RbacWidget.isFixed | private function isFixed ($name)
{
$row = ( new Query )->from(Yii::$app->authManager->itemTable)
->select('fixed')
->where([ 'name' => $name ])
->one(Yii::$app->db);
return $row[ 'fixed' ];
} | php | private function isFixed ($name)
{
$row = ( new Query )->from(Yii::$app->authManager->itemTable)
->select('fixed')
->where([ 'name' => $name ])
->one(Yii::$app->db);
return $row[ 'fixed' ];
} | [
"private",
"function",
"isFixed",
"(",
"$",
"name",
")",
"{",
"$",
"row",
"=",
"(",
"new",
"Query",
")",
"->",
"from",
"(",
"Yii",
"::",
"$",
"app",
"->",
"authManager",
"->",
"itemTable",
")",
"->",
"select",
"(",
"'fixed'",
")",
"->",
"where",
"(... | Is fixed role
@param $name
@return bool | [
"Is",
"fixed",
"role"
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/user/widgets/RbacWidget.php#L129-L137 |
31,116 | pulsarvp/vps-tools | src/modules/user/widgets/RbacWidget.php | RbacWidget.addRole | private function addRole ()
{
$roleForm = new RoleForm();
if (Yii::$app->request->getIsPost())
{
$roleForm->setAttributes(Yii::$app->request->post('RoleForm'));
if ($roleForm->method == 'rbac-add')
$roleForm->setScenario(RoleForm::SCENARIO_ADD);
if ($roleForm->validate())
{
$this->... | php | private function addRole ()
{
$roleForm = new RoleForm();
if (Yii::$app->request->getIsPost())
{
$roleForm->setAttributes(Yii::$app->request->post('RoleForm'));
if ($roleForm->method == 'rbac-add')
$roleForm->setScenario(RoleForm::SCENARIO_ADD);
if ($roleForm->validate())
{
$this->... | [
"private",
"function",
"addRole",
"(",
")",
"{",
"$",
"roleForm",
"=",
"new",
"RoleForm",
"(",
")",
";",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"getIsPost",
"(",
")",
")",
"{",
"$",
"roleForm",
"->",
"setAttributes",
"(",
"Yii",
... | Add new role | [
"Add",
"new",
"role"
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/user/widgets/RbacWidget.php#L142-L160 |
31,117 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/BlogCategories.php | BlogCategories.get | public function get(string $id): ?\BearCMS\Internal\Data2\BlogCategory
{
$data = Internal\Data::getValue('bearcms/blog/categories/category/' . md5($id) . '.json');
if ($data !== null) {
return $this->makeBlogCategoryFromRawData($data);
}
return null;
} | php | public function get(string $id): ?\BearCMS\Internal\Data2\BlogCategory
{
$data = Internal\Data::getValue('bearcms/blog/categories/category/' . md5($id) . '.json');
if ($data !== null) {
return $this->makeBlogCategoryFromRawData($data);
}
return null;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"id",
")",
":",
"?",
"\\",
"BearCMS",
"\\",
"Internal",
"\\",
"Data2",
"\\",
"BlogCategory",
"{",
"$",
"data",
"=",
"Internal",
"\\",
"Data",
"::",
"getValue",
"(",
"'bearcms/blog/categories/category/'",
".",
... | Retrieves information about the page specified
@param string $id The page ID
@return \IvoPetkov\DataObject|null The page data or null if page not found
@throws \InvalidArgumentException | [
"Retrieves",
"information",
"about",
"the",
"page",
"specified"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/BlogCategories.php#L43-L50 |
31,118 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/BlogCategories.php | BlogCategories.getList | public function getList(): \IvoPetkov\DataList
{
$cacheKey = 'blog_categories_list';
if (!isset(Internal\Data::$cache[$cacheKey])) {
$list = Internal\Data::getList('bearcms/blog/categories/category/');
array_walk($list, function(&$value) {
$value = $this->make... | php | public function getList(): \IvoPetkov\DataList
{
$cacheKey = 'blog_categories_list';
if (!isset(Internal\Data::$cache[$cacheKey])) {
$list = Internal\Data::getList('bearcms/blog/categories/category/');
array_walk($list, function(&$value) {
$value = $this->make... | [
"public",
"function",
"getList",
"(",
")",
":",
"\\",
"IvoPetkov",
"\\",
"DataList",
"{",
"$",
"cacheKey",
"=",
"'blog_categories_list'",
";",
"if",
"(",
"!",
"isset",
"(",
"Internal",
"\\",
"Data",
"::",
"$",
"cache",
"[",
"$",
"cacheKey",
"]",
")",
"... | Retrieves a list of all pages
@return \IvoPetkov\DataList|\BearCMS\Internal\Data2\BlogCategory[] List containing all pages data | [
"Retrieves",
"a",
"list",
"of",
"all",
"pages"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/BlogCategories.php#L57-L81 |
31,119 | pulsarvp/vps-tools | src/modules/setting/components/SettingManager.php | SettingManager.get | public function get ($name, $default = null)
{
foreach ($this->_data as $d)
{
if ($d->name === $name)
return $d->value;
}
return $default;
} | php | public function get ($name, $default = null)
{
foreach ($this->_data as $d)
{
if ($d->name === $name)
return $d->value;
}
return $default;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"d",
")",
"{",
"if",
"(",
"$",
"d",
"->",
"name",
"===",
"$",
"name",
")",
"return",
"$",
"d",
"... | Gets specific setting by its name. Return default value if not found.
@param string $name
@param mixed $default
@return null | [
"Gets",
"specific",
"setting",
"by",
"its",
"name",
".",
"Return",
"default",
"value",
"if",
"not",
"found",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/setting/components/SettingManager.php#L45-L54 |
31,120 | wikimedia/slimapp | src/Form.php | Form.expect | public function expect( $name, $filter, $options = null ) {
$options = ( is_array( $options ) ) ? $options : [];
$flags = null;
$required = false;
$validate = null;
if ( isset( $options['flags'] ) ) {
$flags = $options['flags'];
unset( $options['flags'] );
}
if ( isset( $options['required'] ) ) {
... | php | public function expect( $name, $filter, $options = null ) {
$options = ( is_array( $options ) ) ? $options : [];
$flags = null;
$required = false;
$validate = null;
if ( isset( $options['flags'] ) ) {
$flags = $options['flags'];
unset( $options['flags'] );
}
if ( isset( $options['required'] ) ) {
... | [
"public",
"function",
"expect",
"(",
"$",
"name",
",",
"$",
"filter",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"(",
"is_array",
"(",
"$",
"options",
")",
")",
"?",
"$",
"options",
":",
"[",
"]",
";",
"$",
"flags",
"=",
"... | Add an input expectation.
Allowed options:
- default: Default value for missing input
- flags: Flags to pass to filter_var_array
- required: Is this input required?
- validate: Callable to perform additional validation
- callback: Callable for \FILTER_CALLBACK validation
@param string $name Parameter to expect
@param... | [
"Add",
"an",
"input",
"expectation",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Form.php#L84-L125 |
31,121 | wikimedia/slimapp | src/Form.php | Form.expectDateTime | public function expectDateTime( $name, $format, $options = null ) {
$options = ( is_array( $options ) ) ? $options : [];
$options['callback'] = function ( $value ) use ( $format ) {
try {
$date = \DateTime::createFromFormat( $format, $value );
$formatErrors = \DateTime::getLastErrors();
if ( $formatE... | php | public function expectDateTime( $name, $format, $options = null ) {
$options = ( is_array( $options ) ) ? $options : [];
$options['callback'] = function ( $value ) use ( $format ) {
try {
$date = \DateTime::createFromFormat( $format, $value );
$formatErrors = \DateTime::getLastErrors();
if ( $formatE... | [
"public",
"function",
"expectDateTime",
"(",
"$",
"name",
",",
"$",
"format",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"(",
"is_array",
"(",
"$",
"options",
")",
")",
"?",
"$",
"options",
":",
"[",
"]",
";",
"$",
"options",
... | Add an input expectation for a DateTime object.
@param string $name Parameter to expect
@param string $format Expected date/time format
@param array $options Additional options
@return Form Self, for message chaining
@see DateTime::createFromFormat | [
"Add",
"an",
"input",
"expectation",
"for",
"a",
"DateTime",
"object",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Form.php#L561-L578 |
31,122 | wikimedia/slimapp | src/Form.php | Form.validate | public function validate( $vars = null ) {
$vars = $vars ?: $_POST;
$this->values = [];
$this->errors = [];
$arrayInvalids = [];
$cleaned = filter_var_array( $vars, $this->params );
foreach ( $this->params as $name => $opt ) {
$clean = isset( $vars[$name] ) ? $cleaned[$name] : null;
if ( $clean ===... | php | public function validate( $vars = null ) {
$vars = $vars ?: $_POST;
$this->values = [];
$this->errors = [];
$arrayInvalids = [];
$cleaned = filter_var_array( $vars, $this->params );
foreach ( $this->params as $name => $opt ) {
$clean = isset( $vars[$name] ) ? $cleaned[$name] : null;
if ( $clean ===... | [
"public",
"function",
"validate",
"(",
"$",
"vars",
"=",
"null",
")",
"{",
"$",
"vars",
"=",
"$",
"vars",
"?",
":",
"$",
"_POST",
";",
"$",
"this",
"->",
"values",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"errors",
"=",
"[",
"]",
";",
"$",
"arr... | Validate the provided input data using this form's expectations.
@param array $vars Input to validate (default $_POST)
@return bool True if input is valid, false otherwise | [
"Validate",
"the",
"provided",
"input",
"data",
"using",
"this",
"form",
"s",
"expectations",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Form.php#L598-L664 |
31,123 | cedx/yii2-mustache | lib/Logger.php | Logger.log | function log($level, $message, array $context = []): void {
if (!isset(static::$levels[$level])) {
$values = implode(', ', (new \ReflectionClass(LogLevel::class))->getConstants());
throw new InvalidArgumentException("Invalid enumerable value '$level'. Please make sure it is among ($values).");
}
... | php | function log($level, $message, array $context = []): void {
if (!isset(static::$levels[$level])) {
$values = implode(', ', (new \ReflectionClass(LogLevel::class))->getConstants());
throw new InvalidArgumentException("Invalid enumerable value '$level'. Please make sure it is among ($values).");
}
... | [
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"levels",
"[",
"$",
"level",
"]",
")",
")",
"{",
"$",
"values",
... | Logs a message.
@param int $level The logging level.
@param string $message The message to be logged.
@param array $context The log context.
@throws InvalidArgumentException The specified logging level is unknown. | [
"Logs",
"a",
"message",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/Logger.php#L31-L38 |
31,124 | EmchBerger/cube-custom-fields-bundle | src/CustomFieldsEntityTrait.php | CustomFieldsEntityTrait.setCustomFields | public function setCustomFields(ArrayCollection $customFields)
{
@trigger_error(__METHOD__.' is deprecated', E_USER_DEPRECATED);
$this->customFields = $customFields;
return $this;
} | php | public function setCustomFields(ArrayCollection $customFields)
{
@trigger_error(__METHOD__.' is deprecated', E_USER_DEPRECATED);
$this->customFields = $customFields;
return $this;
} | [
"public",
"function",
"setCustomFields",
"(",
"ArrayCollection",
"$",
"customFields",
")",
"{",
"@",
"trigger_error",
"(",
"__METHOD__",
".",
"' is deprecated'",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"this",
"->",
"customFields",
"=",
"$",
"customFields",
";",
... | Set custom fields entities.
@deprecated since version 1.3.5, is probably unused and dangerous
@param ArrayCollection $customFields
@return $this | [
"Set",
"custom",
"fields",
"entities",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/CustomFieldsEntityTrait.php#L93-L100 |
31,125 | thejacer87/php-canadapost-api | src/PostOffice.php | PostOffice.getNearestPostOffice | public function getNearestPostOffice(
$postal_code,
$d2po = false,
$max_addresses = 10,
array $options = []
) {
$query_params = "d2po={$d2po}&postalCode={$postal_code}&maximum={$max_addresses}";
$response = $this->get(
"rs/postoffice?{$query_params}",
... | php | public function getNearestPostOffice(
$postal_code,
$d2po = false,
$max_addresses = 10,
array $options = []
) {
$query_params = "d2po={$d2po}&postalCode={$postal_code}&maximum={$max_addresses}";
$response = $this->get(
"rs/postoffice?{$query_params}",
... | [
"public",
"function",
"getNearestPostOffice",
"(",
"$",
"postal_code",
",",
"$",
"d2po",
"=",
"false",
",",
"$",
"max_addresses",
"=",
"10",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query_params",
"=",
"\"d2po={$d2po}&postalCode={$postal_co... | Get information on Post Offices nearest to a given postal code.
@param string $postal_code
The postal code.
@param bool $d2po
True indicates that you want a list of Post Offices that accept the
"Deliver to Post Office" delivery of parcels. Use this when you want
the parcel to be delivered directly to a Post Office rat... | [
"Get",
"information",
"on",
"Post",
"Offices",
"nearest",
"to",
"a",
"given",
"postal",
"code",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/PostOffice.php#L33-L47 |
31,126 | thejacer87/php-canadapost-api | src/PostOffice.php | PostOffice.getNearestPostOfficeByAddress | public function getNearestPostOfficeByAddress(
$province = '',
$city = '',
$street_name = '',
$d2po = false,
$max_addresses = 10,
array $options = []
) {
$query_params = "d2po={$d2po}&province={$province}&city={$city}&streetName={$street_name}&maximum={$max_ad... | php | public function getNearestPostOfficeByAddress(
$province = '',
$city = '',
$street_name = '',
$d2po = false,
$max_addresses = 10,
array $options = []
) {
$query_params = "d2po={$d2po}&province={$province}&city={$city}&streetName={$street_name}&maximum={$max_ad... | [
"public",
"function",
"getNearestPostOfficeByAddress",
"(",
"$",
"province",
"=",
"''",
",",
"$",
"city",
"=",
"''",
",",
"$",
"street_name",
"=",
"''",
",",
"$",
"d2po",
"=",
"false",
",",
"$",
"max_addresses",
"=",
"10",
",",
"array",
"$",
"options",
... | Get information on Post Offices nearest to a given location.
@param string $province
The province.
@param string $city
The city.
@param string $street_name
Street name onl (ie. without the house or apartment number). Street
name can be a multi-part name with embedded spaces. If City and
Province are specified, provisi... | [
"Get",
"information",
"on",
"Post",
"Offices",
"nearest",
"to",
"a",
"given",
"location",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/PostOffice.php#L78-L94 |
31,127 | thejacer87/php-canadapost-api | src/PostOffice.php | PostOffice.getNearestPostOfficeByGeographicalLocation | public function getNearestPostOfficeByGeographicalLocation(
$longitude,
$latitude,
$d2po = false,
$max_addresses = 10,
array $options = []
) {
$query_params = "d2po={$d2po}&longitude={$longitude}&latitude={$latitude}&maximum={$max_addresses}";
$response = $th... | php | public function getNearestPostOfficeByGeographicalLocation(
$longitude,
$latitude,
$d2po = false,
$max_addresses = 10,
array $options = []
) {
$query_params = "d2po={$d2po}&longitude={$longitude}&latitude={$latitude}&maximum={$max_addresses}";
$response = $th... | [
"public",
"function",
"getNearestPostOfficeByGeographicalLocation",
"(",
"$",
"longitude",
",",
"$",
"latitude",
",",
"$",
"d2po",
"=",
"false",
",",
"$",
"max_addresses",
"=",
"10",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query_params",... | Get information on Post Offices nearest to a given geographical
location.
@param string $longitude
The longitude. Format is 10 characters of the form: [-]3.5
ie. up to 3 digits before the decimal and 5 digits after the decimal
eg. -101.32354
@param string $latitude
The latitude.
Format is 10 characters of the form: [-... | [
"Get",
"information",
"on",
"Post",
"Offices",
"nearest",
"to",
"a",
"given",
"geographical",
"location",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/PostOffice.php#L124-L139 |
31,128 | pulsarvp/vps-tools | src/modules/apiapp/models/Apiapp.php | Apiapp.getTokenForName | public static function getTokenForName ($name)
{
$object = self::findOne([ 'name' => $name ]);
if ($object == null)
{
$object = new App([
'name' => $name,
'token' => StringHelper::random(16)
]);
$object->save();
}
return $object->token;
} | php | public static function getTokenForName ($name)
{
$object = self::findOne([ 'name' => $name ]);
if ($object == null)
{
$object = new App([
'name' => $name,
'token' => StringHelper::random(16)
]);
$object->save();
}
return $object->token;
} | [
"public",
"static",
"function",
"getTokenForName",
"(",
"$",
"name",
")",
"{",
"$",
"object",
"=",
"self",
"::",
"findOne",
"(",
"[",
"'name'",
"=>",
"$",
"name",
"]",
")",
";",
"if",
"(",
"$",
"object",
"==",
"null",
")",
"{",
"$",
"object",
"=",
... | Finds App token by its name.
@param string $name App name.
@return string | [
"Finds",
"App",
"token",
"by",
"its",
"name",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/apiapp/models/Apiapp.php#L41-L54 |
31,129 | bearcms/bearframework-addon | classes/BearCMS/Addons.php | Addons.register | public function register(string $id, callable $callback): self
{
Internal\Data\Addons::$registrations[$id] = $callback;
return $this;
} | php | public function register(string $id, callable $callback): self
{
Internal\Data\Addons::$registrations[$id] = $callback;
return $this;
} | [
"public",
"function",
"register",
"(",
"string",
"$",
"id",
",",
"callable",
"$",
"callback",
")",
":",
"self",
"{",
"Internal",
"\\",
"Data",
"\\",
"Addons",
"::",
"$",
"registrations",
"[",
"$",
"id",
"]",
"=",
"$",
"callback",
";",
"return",
"$",
... | Register a new addon.
@param string $id The addon ID.
@param callable $callback A function to define addon parameters.
@return self Returns a reference to itself. | [
"Register",
"a",
"new",
"addon",
"."
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Addons.php#L28-L32 |
31,130 | bearcms/bearframework-addon | classes/BearCMS/Addons.php | Addons.add | public function add(string $id): self
{
$app = App::get();
if (\BearFramework\Addons::exists($id)) {
$app->addons->add($id);
if (isset(Internal\Data\Addons::$registrations[$id])) {
$addon = new \BearCMS\Addons\Addon($id);
call_user_func(Interna... | php | public function add(string $id): self
{
$app = App::get();
if (\BearFramework\Addons::exists($id)) {
$app->addons->add($id);
if (isset(Internal\Data\Addons::$registrations[$id])) {
$addon = new \BearCMS\Addons\Addon($id);
call_user_func(Interna... | [
"public",
"function",
"add",
"(",
"string",
"$",
"id",
")",
":",
"self",
"{",
"$",
"app",
"=",
"App",
"::",
"get",
"(",
")",
";",
"if",
"(",
"\\",
"BearFramework",
"\\",
"Addons",
"::",
"exists",
"(",
"$",
"id",
")",
")",
"{",
"$",
"app",
"->",... | Adds an addon.
@param string $id
@return self | [
"Adds",
"an",
"addon",
"."
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Addons.php#L40-L54 |
31,131 | wikimedia/slimapp | src/Dao/AbstractDao.php | AbstractDao.bind | protected function bind( $stmt, $values ) {
$values = $values ?: [];
if ( (bool)count( array_filter( array_keys( $values ), 'is_string' ) ) ) {
// associative array provided
foreach ( $values as $key => $value ) {
// infer bind type from key prefix
list( $prefix, $ignored ) = explode( '_', "{$key}_",... | php | protected function bind( $stmt, $values ) {
$values = $values ?: [];
if ( (bool)count( array_filter( array_keys( $values ), 'is_string' ) ) ) {
// associative array provided
foreach ( $values as $key => $value ) {
// infer bind type from key prefix
list( $prefix, $ignored ) = explode( '_', "{$key}_",... | [
"protected",
"function",
"bind",
"(",
"$",
"stmt",
",",
"$",
"values",
")",
"{",
"$",
"values",
"=",
"$",
"values",
"?",
":",
"[",
"]",
";",
"if",
"(",
"(",
"bool",
")",
"count",
"(",
"array_filter",
"(",
"array_keys",
"(",
"$",
"values",
")",
",... | Bind values to a prepared statement.
If an associative array of values is provided, the data type to use when
binding will be inferred by looking for a "<type>_" prefix at the
beginning of the array key. This can come in very handy if you are using
parameters in places like LIMIT clauses where binding as a string (the... | [
"Bind",
"values",
"to",
"a",
"prepared",
"statement",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Dao/AbstractDao.php#L130-L165 |
31,132 | wikimedia/slimapp | src/Dao/AbstractDao.php | AbstractDao.fetch | protected function fetch( $sql, $params = null ) {
$stmt = $this->dbh->prepare( $sql );
$this->bind( $stmt, $params );
$stmt->execute();
return $stmt->fetch();
} | php | protected function fetch( $sql, $params = null ) {
$stmt = $this->dbh->prepare( $sql );
$this->bind( $stmt, $params );
$stmt->execute();
return $stmt->fetch();
} | [
"protected",
"function",
"fetch",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"$",
"this",
"->",
"bind",
"(",
"$",
"stmt",
",",
"$",
"params... | Prepare and execute an SQL statement and return the first row of results.
@param string $sql SQL
@param array $params Prepared statement parameters
@return array First response row | [
"Prepare",
"and",
"execute",
"an",
"SQL",
"statement",
"and",
"return",
"the",
"first",
"row",
"of",
"results",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Dao/AbstractDao.php#L174-L179 |
31,133 | wikimedia/slimapp | src/Dao/AbstractDao.php | AbstractDao.fetchAll | protected function fetchAll( $sql, $params = null ) {
$this->logger->debug( $sql, $params ?: [] );
$stmt = $this->dbh->prepare( $sql );
$this->bind( $stmt, $params );
$stmt->execute();
return $stmt->fetchAll();
} | php | protected function fetchAll( $sql, $params = null ) {
$this->logger->debug( $sql, $params ?: [] );
$stmt = $this->dbh->prepare( $sql );
$this->bind( $stmt, $params );
$stmt->execute();
return $stmt->fetchAll();
} | [
"protected",
"function",
"fetchAll",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"$",
"sql",
",",
"$",
"params",
"?",
":",
"[",
"]",
")",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",... | Prepare and execute an SQL statement and return all results.
@param string $sql SQL
@param array $params Prepared statement parameters
@return array Result rows | [
"Prepare",
"and",
"execute",
"an",
"SQL",
"statement",
"and",
"return",
"all",
"results",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Dao/AbstractDao.php#L188-L194 |
31,134 | wikimedia/slimapp | src/Dao/AbstractDao.php | AbstractDao.fetchAllWithFound | protected function fetchAllWithFound( $sql, $params = null ) {
$ret = new \StdClass;
$ret->rows = $this->fetchAll( $sql, $params );
$ret->found = $this->fetch( 'SELECT FOUND_ROWS() AS found' );
$ret->found = $ret->found['found'];
return $ret;
} | php | protected function fetchAllWithFound( $sql, $params = null ) {
$ret = new \StdClass;
$ret->rows = $this->fetchAll( $sql, $params );
$ret->found = $this->fetch( 'SELECT FOUND_ROWS() AS found' );
$ret->found = $ret->found['found'];
return $ret;
} | [
"protected",
"function",
"fetchAllWithFound",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"ret",
"=",
"new",
"\\",
"StdClass",
";",
"$",
"ret",
"->",
"rows",
"=",
"$",
"this",
"->",
"fetchAll",
"(",
"$",
"sql",
",",
"$",
"param... | Prepare and execute an SQL statement and return all results plus the
number of rows found on the server side.
The SQL is expected to contain the "SQL_CALC_FOUND_ROWS" option in the
select statement. If it does not, the number of found rows returned is
dependent on MySQL's interpretation of the query.
@param string $s... | [
"Prepare",
"and",
"execute",
"an",
"SQL",
"statement",
"and",
"return",
"all",
"results",
"plus",
"the",
"number",
"of",
"rows",
"found",
"on",
"the",
"server",
"side",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Dao/AbstractDao.php#L208-L216 |
31,135 | wikimedia/slimapp | src/Dao/AbstractDao.php | AbstractDao.concat | protected static function concat( /*varags*/ ) {
$args = [];
foreach ( func_get_args() as $arg ) {
if ( is_array( $arg ) ) {
$args = array_merge( $args, $arg );
} else {
$args[] = $arg;
}
}
return implode( ' ', $args );
} | php | protected static function concat( /*varags*/ ) {
$args = [];
foreach ( func_get_args() as $arg ) {
if ( is_array( $arg ) ) {
$args = array_merge( $args, $arg );
} else {
$args[] = $arg;
}
}
return implode( ' ', $args );
} | [
"protected",
"static",
"function",
"concat",
"(",
"/*varags*/",
")",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"arg",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"arg",
")",
")",
"{",
"$",
"args",
... | Create a string by joining all arguments with spaces.
If one or more of the arguments are arrays each element of the array will
be included independently.
@return string New string | [
"Create",
"a",
"string",
"by",
"joining",
"all",
"arguments",
"with",
"spaces",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Dao/AbstractDao.php#L321-L332 |
31,136 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.delete | public function delete($endpoint, array $headers = [], array $options = [])
{
$url = $this->baseUrl . '/' . $endpoint;
try {
$client = $this->buildClient($options);
$options += [
'auth' => [$this->username, $this->password],
'headers' => $head... | php | public function delete($endpoint, array $headers = [], array $options = [])
{
$url = $this->baseUrl . '/' . $endpoint;
try {
$client = $this->buildClient($options);
$options += [
'auth' => [$this->username, $this->password],
'headers' => $head... | [
"public",
"function",
"delete",
"(",
"$",
"endpoint",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"baseUrl",
".",
"'/'",
".",
"$",
"endpoint",
";",
"try",... | Send the DELETE request to the Canada Post API.
@param string $endpoint
The endpoint to send the request.
@param array $headers
The HTTP headers array.
@param array $options
An array of options.
@return \DOMDocument|\Psr\Http\Message\StreamInterface
@throws \GuzzleHttp\Exception\GuzzleException | [
"Send",
"the",
"DELETE",
"request",
"to",
"the",
"Canada",
"Post",
"API",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L202-L227 |
31,137 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.setCredentials | protected function setCredentials(array $config = [])
{
if (!isset($config['username']) || !isset($config['password']) || !isset($config['customer_number'])) {
$message = 'A username, password and customer number are required for authenticated to the Canada Post API.';
throw new \Inv... | php | protected function setCredentials(array $config = [])
{
if (!isset($config['username']) || !isset($config['password']) || !isset($config['customer_number'])) {
$message = 'A username, password and customer number are required for authenticated to the Canada Post API.';
throw new \Inv... | [
"protected",
"function",
"setCredentials",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'username'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"config",
"[",
"'password'",
"]",
")",
"||",
"!... | Set the API configuration array for the Client.
@param array $config
The configuration array. | [
"Set",
"the",
"API",
"configuration",
"array",
"for",
"the",
"Client",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L300-L311 |
31,138 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.baseUrl | protected function baseUrl(array $config = [])
{
if (isset($this->baseUrl)) {
return $this->baseUrl;
}
if (isset($config['base_url'])) {
$this->baseUrl = $config['base_url'];
return $this->baseUrl;
}
switch ($config['env']) {
... | php | protected function baseUrl(array $config = [])
{
if (isset($this->baseUrl)) {
return $this->baseUrl;
}
if (isset($config['base_url'])) {
$this->baseUrl = $config['base_url'];
return $this->baseUrl;
}
switch ($config['env']) {
... | [
"protected",
"function",
"baseUrl",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"baseUrl",
")",
")",
"{",
"return",
"$",
"this",
"->",
"baseUrl",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"confi... | Return the base url for the Canada Post API.
@param array $config
@return mixed|string
The base url.
@throws \InvalidArgumentException | [
"Return",
"the",
"base",
"url",
"for",
"the",
"Canada",
"Post",
"API",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L322-L352 |
31,139 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.parseResponse | protected function parseResponse(Response $response)
{
$xml = new \DomDocument();
$xml->loadXML($response->getBody());
return XML2Array::createArray($xml->saveXML());
} | php | protected function parseResponse(Response $response)
{
$xml = new \DomDocument();
$xml->loadXML($response->getBody());
return XML2Array::createArray($xml->saveXML());
} | [
"protected",
"function",
"parseResponse",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"xml",
"=",
"new",
"\\",
"DomDocument",
"(",
")",
";",
"$",
"xml",
"->",
"loadXML",
"(",
"$",
"response",
"->",
"getBody",
"(",
")",
")",
";",
"return",
"XML2Arr... | Parse the xml response into an array,
@param Response $response
The xml response.
@return \DOMDocument
The response array.
@throws \Exception | [
"Parse",
"the",
"xml",
"response",
"into",
"an",
"array"
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L364-L370 |
31,140 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.buildClient | protected function buildClient(array &$options)
{
if (!isset($options['debug']) && $this->config['env'] === self::ENV_DEVELOPMENT) {
$options['debug'] = true;
}
if (!isset($options['handler'])) {
return new GuzzleClient();
}
$client = new GuzzleClien... | php | protected function buildClient(array &$options)
{
if (!isset($options['debug']) && $this->config['env'] === self::ENV_DEVELOPMENT) {
$options['debug'] = true;
}
if (!isset($options['handler'])) {
return new GuzzleClient();
}
$client = new GuzzleClien... | [
"protected",
"function",
"buildClient",
"(",
"array",
"&",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'debug'",
"]",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'env'",
"]",
"===",
"self",
"::",
"ENV_DEVELOPMENT",
... | Build the Guzzle client.
@param array $options
The options array.
@return \GuzzleHttp\Client | [
"Build",
"the",
"Guzzle",
"client",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L380-L393 |
31,141 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.verifyDates | protected function verifyDates($from, $to, $format = 'YmdHs')
{
if (!DateTime::createFromFormat($format, $from)) {
$message = 'The $from date is improperly formatted. Please use "YmdHs".';
throw new \InvalidArgumentException($message);
}
if (!DateTime::createFromForma... | php | protected function verifyDates($from, $to, $format = 'YmdHs')
{
if (!DateTime::createFromFormat($format, $from)) {
$message = 'The $from date is improperly formatted. Please use "YmdHs".';
throw new \InvalidArgumentException($message);
}
if (!DateTime::createFromForma... | [
"protected",
"function",
"verifyDates",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"format",
"=",
"'YmdHs'",
")",
"{",
"if",
"(",
"!",
"DateTime",
"::",
"createFromFormat",
"(",
"$",
"format",
",",
"$",
"from",
")",
")",
"{",
"$",
"message",
"=",
... | Helper function to verify the dates are valid.
@param string $from
The beginning date.
@param $to
The end date.
@param string $format
The date format to verify.
@throws \InvalidArgumentException | [
"Helper",
"function",
"to",
"verify",
"the",
"dates",
"are",
"valid",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L420-L434 |
31,142 | thejacer87/php-canadapost-api | src/ClientBase.php | ClientBase.parseOptionCodes | protected function parseOptionCodes(array $options)
{
$valid_options = [];
foreach ($options['option_codes'] as $optionCode) {
if (!array_key_exists(strtoupper($optionCode), self::getOptionCodes())) {
$message = sprintf(
'Unsupported option code: "%s".... | php | protected function parseOptionCodes(array $options)
{
$valid_options = [];
foreach ($options['option_codes'] as $optionCode) {
if (!array_key_exists(strtoupper($optionCode), self::getOptionCodes())) {
$message = sprintf(
'Unsupported option code: "%s".... | [
"protected",
"function",
"parseOptionCodes",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"valid_options",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"[",
"'option_codes'",
"]",
"as",
"$",
"optionCode",
")",
"{",
"if",
"(",
"!",
"array_key_exists"... | Helper function to extract the option codes.
@param array $options
The options array.
@return array
The list of options with the option-code. | [
"Helper",
"function",
"to",
"extract",
"the",
"option",
"codes",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/ClientBase.php#L445-L470 |
31,143 | pulsarvp/vps-tools | src/controllers/WebController.php | WebController.error | public function error ($message, $isRaw = false)
{
Yii::$app->notification->error($message, $isRaw);
} | php | public function error ($message, $isRaw = false)
{
Yii::$app->notification->error($message, $isRaw);
} | [
"public",
"function",
"error",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"notification",
"->",
"error",
"(",
"$",
"message",
",",
"$",
"isRaw",
")",
";",
"}"
] | Add user error message.
@param string $message Message text.
@param boolean $isRaw Whether given text is raw. If not it will be processed with [[Yii::tr()]]. | [
"Add",
"user",
"error",
"message",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/WebController.php#L144-L147 |
31,144 | pulsarvp/vps-tools | src/controllers/WebController.php | WebController.message | public function message ($message, $isRaw = false)
{
Yii::$app->notification->message($message, $isRaw);
} | php | public function message ($message, $isRaw = false)
{
Yii::$app->notification->message($message, $isRaw);
} | [
"public",
"function",
"message",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"notification",
"->",
"message",
"(",
"$",
"message",
",",
"$",
"isRaw",
")",
";",
"}"
] | Add user message.
@param string $message Message text.
@param boolean $isRaw Whether given text is raw. If not it will be processed with [[Yii::tr()]]. | [
"Add",
"user",
"message",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/WebController.php#L155-L158 |
31,145 | pulsarvp/vps-tools | src/controllers/WebController.php | WebController.redirect | public function redirect ($url, $statusCode = 302)
{
parent::redirect($url, $statusCode);
Yii::$app->end();
} | php | public function redirect ($url, $statusCode = 302)
{
parent::redirect($url, $statusCode);
Yii::$app->end();
} | [
"public",
"function",
"redirect",
"(",
"$",
"url",
",",
"$",
"statusCode",
"=",
"302",
")",
"{",
"parent",
"::",
"redirect",
"(",
"$",
"url",
",",
"$",
"statusCode",
")",
";",
"Yii",
"::",
"$",
"app",
"->",
"end",
"(",
")",
";",
"}"
] | Redirects and ends app. That prevents from sending additional headers.
@inheritdoc | [
"Redirects",
"and",
"ends",
"app",
".",
"That",
"prevents",
"from",
"sending",
"additional",
"headers",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/WebController.php#L165-L169 |
31,146 | pulsarvp/vps-tools | src/controllers/WebController.php | WebController.warning | public function warning ($message, $isRaw = false)
{
Yii::$app->notification->warning($message, $isRaw);
} | php | public function warning ($message, $isRaw = false)
{
Yii::$app->notification->warning($message, $isRaw);
} | [
"public",
"function",
"warning",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"notification",
"->",
"warning",
"(",
"$",
"message",
",",
"$",
"isRaw",
")",
";",
"}"
] | Add user warning.
@param string $message Message text.
@param boolean $isRaw Whether given text is raw. If not it will be processed with [[Yii::tr()]]. | [
"Add",
"user",
"warning",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/WebController.php#L177-L180 |
31,147 | pulsarvp/vps-tools | src/controllers/WebController.php | WebController.forceSetTitle | private function forceSetTitle ()
{
if (isset($this->_data[ 'title' ]))
return;
$path = Yii::$app->controller->id . '/' . Yii::$app->controller->action->id;
if (Yii::$app->has('menu'))
{
foreach (Yii::$app->menu as $menu)
{
if ($menu->path === $path)
{
$this->setTitle($menu->n... | php | private function forceSetTitle ()
{
if (isset($this->_data[ 'title' ]))
return;
$path = Yii::$app->controller->id . '/' . Yii::$app->controller->action->id;
if (Yii::$app->has('menu'))
{
foreach (Yii::$app->menu as $menu)
{
if ($menu->path === $path)
{
$this->setTitle($menu->n... | [
"private",
"function",
"forceSetTitle",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"'title'",
"]",
")",
")",
"return",
";",
"$",
"path",
"=",
"Yii",
"::",
"$",
"app",
"->",
"controller",
"->",
"id",
".",
"'/'",
".",
... | Force generate title if not set previously. | [
"Force",
"generate",
"title",
"if",
"not",
"set",
"previously",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/WebController.php#L185-L205 |
31,148 | wikimedia/slimapp | src/Config.php | Config.getBool | public static function getBool( $name, $default = false ) {
$var = getenv( $name );
$val = filter_var( $var, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE );
return ( $val === null ) ? $default : $val;
} | php | public static function getBool( $name, $default = false ) {
$var = getenv( $name );
$val = filter_var( $var, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE );
return ( $val === null ) ? $default : $val;
} | [
"public",
"static",
"function",
"getBool",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"false",
")",
"{",
"$",
"var",
"=",
"getenv",
"(",
"$",
"name",
")",
";",
"$",
"val",
"=",
"filter_var",
"(",
"$",
"var",
",",
"\\",
"FILTER_VALIDATE_BOOLEAN",
","... | Get a boolean value
@param string $name Setting name
@param bool $default Default value if none found
@return bool Value | [
"Get",
"a",
"boolean",
"value"
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Config.php#L39-L43 |
31,149 | wikimedia/slimapp | src/Config.php | Config.getStr | public static function getStr( $name, $default = '' ) {
$var = getenv( $name );
if ( $var !== false ) {
$var = filter_var( $var,
\FILTER_SANITIZE_STRING,
\FILTER_FLAG_STRIP_LOW | \FILTER_FLAG_STRIP_HIGH
);
}
return ( $var === false ) ? $default : $var;
} | php | public static function getStr( $name, $default = '' ) {
$var = getenv( $name );
if ( $var !== false ) {
$var = filter_var( $var,
\FILTER_SANITIZE_STRING,
\FILTER_FLAG_STRIP_LOW | \FILTER_FLAG_STRIP_HIGH
);
}
return ( $var === false ) ? $default : $var;
} | [
"public",
"static",
"function",
"getStr",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"''",
")",
"{",
"$",
"var",
"=",
"getenv",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"var",
"!==",
"false",
")",
"{",
"$",
"var",
"=",
"filter_var",
"(",
"$... | Get a string value
@param string $name Setting name
@param string $default Default value if none found
@return string Value | [
"Get",
"a",
"string",
"value"
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Config.php#L51-L60 |
31,150 | wikimedia/slimapp | src/Config.php | Config.load | public static function load( $file ) {
if ( !is_readable( $file ) ) {
throw new \InvalidArgumentException( "File '{$file}' is not readable." );
}
$settings = parse_ini_file( $file );
foreach ( $settings as $key => $value ) {
// Store in super globals
$_ENV[$key] = $value;
$_SERVER[$key] = $valu... | php | public static function load( $file ) {
if ( !is_readable( $file ) ) {
throw new \InvalidArgumentException( "File '{$file}' is not readable." );
}
$settings = parse_ini_file( $file );
foreach ( $settings as $key => $value ) {
// Store in super globals
$_ENV[$key] = $value;
$_SERVER[$key] = $valu... | [
"public",
"static",
"function",
"load",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"File '{$file}' is not readable.\"",
")",
";",
"}",
"$",
"settings",
... | Load configuration data from file
Reads ini file style configuration settings from the given file and
loads the values into the application's environment. This is useful in
deployments where the use of the container environment for configuration
is discouraged.
@param string $file Path to config file | [
"Load",
"configuration",
"data",
"from",
"file"
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Config.php#L81-L96 |
31,151 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/CommentsThreads.php | CommentsThreads.get | public function get(string $id): ?\BearCMS\Internal\Data2\CommentsThread
{
$data = Internal\Data::getValue('bearcms/comments/thread/' . md5($id) . '.json');
if ($data !== null) {
return $this->makeCommentsThreadPostFromRawData($data);
}
return null;
} | php | public function get(string $id): ?\BearCMS\Internal\Data2\CommentsThread
{
$data = Internal\Data::getValue('bearcms/comments/thread/' . md5($id) . '.json');
if ($data !== null) {
return $this->makeCommentsThreadPostFromRawData($data);
}
return null;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"id",
")",
":",
"?",
"\\",
"BearCMS",
"\\",
"Internal",
"\\",
"Data2",
"\\",
"CommentsThread",
"{",
"$",
"data",
"=",
"Internal",
"\\",
"Data",
"::",
"getValue",
"(",
"'bearcms/comments/thread/'",
".",
"md5"... | Retrieves information about the comments thread specified
@param string $id The comments thread ID
@return \IvoPetkov\DataObject|null The comments thread data or null if the thread not found
@throws \InvalidArgumentException | [
"Retrieves",
"information",
"about",
"the",
"comments",
"thread",
"specified"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/CommentsThreads.php#L36-L43 |
31,152 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/CommentsThreads.php | CommentsThreads.getList | public function getList()
{
$list = Internal\Data::getList('bearcms/comments/thread/');
array_walk($list, function(&$value) {
$value = $this->makeCommentsThreadPostFromRawData($value);
});
return new \IvoPetkov\DataList($list);
} | php | public function getList()
{
$list = Internal\Data::getList('bearcms/comments/thread/');
array_walk($list, function(&$value) {
$value = $this->makeCommentsThreadPostFromRawData($value);
});
return new \IvoPetkov\DataList($list);
} | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"list",
"=",
"Internal",
"\\",
"Data",
"::",
"getList",
"(",
"'bearcms/comments/thread/'",
")",
";",
"array_walk",
"(",
"$",
"list",
",",
"function",
"(",
"&",
"$",
"value",
")",
"{",
"$",
"value",
"... | Retrieves a list of all comments threads
@return \IvoPetkov\DataList List containing all comments threads data | [
"Retrieves",
"a",
"list",
"of",
"all",
"comments",
"threads"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/CommentsThreads.php#L50-L57 |
31,153 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/UsersInvitations.php | UsersInvitations.get | public function get(string $key): ?\BearCMS\Internal\Data2\UserInvitation
{
$data = \BearCMS\Internal\Data::getValue('bearcms/users/invitation/' . md5($key) . '.json');
if ($data !== null) {
return $this->makeUserFromRawData($data);
}
return null;
} | php | public function get(string $key): ?\BearCMS\Internal\Data2\UserInvitation
{
$data = \BearCMS\Internal\Data::getValue('bearcms/users/invitation/' . md5($key) . '.json');
if ($data !== null) {
return $this->makeUserFromRawData($data);
}
return null;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
")",
":",
"?",
"\\",
"BearCMS",
"\\",
"Internal",
"\\",
"Data2",
"\\",
"UserInvitation",
"{",
"$",
"data",
"=",
"\\",
"BearCMS",
"\\",
"Internal",
"\\",
"Data",
"::",
"getValue",
"(",
"'bearcms/user... | Retrieves information about the user invitation specified
@param string $id The user invitation key
@return \BearCMS\Internal\Data2\UserInvitation|null The user invitation data or null if not found | [
"Retrieves",
"information",
"about",
"the",
"user",
"invitation",
"specified"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/UsersInvitations.php#L38-L45 |
31,154 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/UsersInvitations.php | UsersInvitations.getList | public function getList()
{
$list = \BearCMS\Internal\Data::getList('bearcms/users/invitation/');
array_walk($list, function(&$value) {
$value = $this->makeUserFromRawData($value);
});
return new \IvoPetkov\DataList($list);
} | php | public function getList()
{
$list = \BearCMS\Internal\Data::getList('bearcms/users/invitation/');
array_walk($list, function(&$value) {
$value = $this->makeUserFromRawData($value);
});
return new \IvoPetkov\DataList($list);
} | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"list",
"=",
"\\",
"BearCMS",
"\\",
"Internal",
"\\",
"Data",
"::",
"getList",
"(",
"'bearcms/users/invitation/'",
")",
";",
"array_walk",
"(",
"$",
"list",
",",
"function",
"(",
"&",
"$",
"value",
")"... | Retrieves a list of all users invitations
@return \IvoPetkov\DataList|\BearCMS\Internal\Data2\UserInvitation[] List containing all users invitations data | [
"Retrieves",
"a",
"list",
"of",
"all",
"users",
"invitations"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/UsersInvitations.php#L52-L59 |
31,155 | thejacer87/php-canadapost-api | src/Returns.php | Returns.createAuthorizedReturn | public function createAuthorizedReturn(
array $returner,
array $receiver,
array $parcel,
array $options = []
) {
$content = $this->buildReturnsArray(
$returner,
$receiver,
$parcel,
$options
);
$xml = Array2XML::... | php | public function createAuthorizedReturn(
array $returner,
array $receiver,
array $parcel,
array $options = []
) {
$content = $this->buildReturnsArray(
$returner,
$receiver,
$parcel,
$options
);
$xml = Array2XML::... | [
"public",
"function",
"createAuthorizedReturn",
"(",
"array",
"$",
"returner",
",",
"array",
"$",
"receiver",
",",
"array",
"$",
"parcel",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"buildReturnsArray",
... | Create an authorized return.
@param array $returner
The returner info.
<code>
$returner = [
'name' => 'Jane Doe',
'company' => 'Acro Media',
'domestic-address' => [
'address-line-1' => '103-2303 Leckie Rd',
'city' => 'Kelowna',
'province' => 'BC',
'postal-code' => 'V1X 6Y5',
],
]
</code>
@param arr... | [
"Create",
"an",
"authorized",
"return",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Returns.php#L66-L95 |
31,156 | thejacer87/php-canadapost-api | src/Returns.php | Returns.createOpenReturn | public function createOpenReturn(
array $receiver,
array $parcel,
array $options = []
) {
$this->formatPostalCode($receiver['domestic-address']['postal-code']);
$content = [
'max-number-of-artifacts' => 10,
'service-code' => $parcel['service_code'],
... | php | public function createOpenReturn(
array $receiver,
array $parcel,
array $options = []
) {
$this->formatPostalCode($receiver['domestic-address']['postal-code']);
$content = [
'max-number-of-artifacts' => 10,
'service-code' => $parcel['service_code'],
... | [
"public",
"function",
"createOpenReturn",
"(",
"array",
"$",
"receiver",
",",
"array",
"$",
"parcel",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"formatPostalCode",
"(",
"$",
"receiver",
"[",
"'domestic-address'",
"]",
"[",
... | Create an open return.
@param array $receiver
The receiver info.
<code>
$receiver = [
'name' => 'John Smith',
'company' => 'Acro Media',
'domestic-address' => [
'address-line-1' => '123 Main St',
'city' => 'Kelowna',
'province' => 'BC',
'postal-code' => 'V1X 1M2',
],
]
</code>
@param array ... | [
"Create",
"an",
"open",
"return",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Returns.php#L133-L169 |
31,157 | thejacer87/php-canadapost-api | src/Returns.php | Returns.getAllOpenReturns | public function getAllOpenReturns($from, $to = '', array $options = []) {
if (empty($to)) {
$to = date('YmdHs');
}
$query_params = "from={$from}&to{$to}";
$this->verifyDates($from, $to);
$response = $this->get(
"rs/{$this->config['customer_number']}/{$th... | php | public function getAllOpenReturns($from, $to = '', array $options = []) {
if (empty($to)) {
$to = date('YmdHs');
}
$query_params = "from={$from}&to{$to}";
$this->verifyDates($from, $to);
$response = $this->get(
"rs/{$this->config['customer_number']}/{$th... | [
"public",
"function",
"getAllOpenReturns",
"(",
"$",
"from",
",",
"$",
"to",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"to",
")",
")",
"{",
"$",
"to",
"=",
"date",
"(",
"'YmdHs'",
")",
";",
... | Get next open return artifact.
@param string $from
The beginning range. YmdHs format, eg. 201808282359.
@param string $to
The end range, defaults to current time. YmdHs format, eg. 201808282359.
@param array $options
The options array.
@return \DOMDocument|\Psr\Http\Message\StreamInterface
@throws \GuzzleHttp\Excepti... | [
"Get",
"next",
"open",
"return",
"artifact",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Returns.php#L242-L260 |
31,158 | pulsarvp/vps-tools | src/auth/PulsarSsoClient.php | PulsarSsoClient.getLogoutUrl | public function getLogoutUrl ($redirectTo = null)
{
if (empty($redirectTo))
return $this->_logoutUrl;
else
return $this->_logoutUrl . '?next=' . urlencode($redirectTo);
} | php | public function getLogoutUrl ($redirectTo = null)
{
if (empty($redirectTo))
return $this->_logoutUrl;
else
return $this->_logoutUrl . '?next=' . urlencode($redirectTo);
} | [
"public",
"function",
"getLogoutUrl",
"(",
"$",
"redirectTo",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"redirectTo",
")",
")",
"return",
"$",
"this",
"->",
"_logoutUrl",
";",
"else",
"return",
"$",
"this",
"->",
"_logoutUrl",
".",
"'?next='",... | Creates logout URL.
@param string $redirectTo
@return string | [
"Creates",
"logout",
"URL",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/auth/PulsarSsoClient.php#L36-L42 |
31,159 | Bokbasen/php-api-client | src/ApiClient/Client.php | Client.patch | public function patch(string $path, $body, array $headers = [], bool $authenticate = true): ResponseInterface
{
return $this->call(
HttpRequestOptions::HTTP_METHOD_PATCH,
$path,
$headers,
$body,
$authenticate
);
} | php | public function patch(string $path, $body, array $headers = [], bool $authenticate = true): ResponseInterface
{
return $this->call(
HttpRequestOptions::HTTP_METHOD_PATCH,
$path,
$headers,
$body,
$authenticate
);
} | [
"public",
"function",
"patch",
"(",
"string",
"$",
"path",
",",
"$",
"body",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"bool",
"$",
"authenticate",
"=",
"true",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"call",
"(",
"Ht... | Execute PATCH request
@param string $path
@param resource|string|StreamInterface|null $body
@param array $headers
@param bool $authenticate
@return ResponseInterface
@throws BokbasenApiClientException | [
"Execute",
"PATCH",
"request"
] | eeb33aa48b90d5043545d1af993167e9a74995df | https://github.com/Bokbasen/php-api-client/blob/eeb33aa48b90d5043545d1af993167e9a74995df/src/ApiClient/Client.php#L172-L181 |
31,160 | Bokbasen/php-api-client | src/ApiClient/Client.php | Client.postJson | public function postJson(string $path, array $body): ResponseInterface
{
$body = json_encode($body);
if ($body === false) {
throw new BokbasenApiClientException('Unable to convert data to json');
}
return $this->post(
$path,
$body,
[
... | php | public function postJson(string $path, array $body): ResponseInterface
{
$body = json_encode($body);
if ($body === false) {
throw new BokbasenApiClientException('Unable to convert data to json');
}
return $this->post(
$path,
$body,
[
... | [
"public",
"function",
"postJson",
"(",
"string",
"$",
"path",
",",
"array",
"$",
"body",
")",
":",
"ResponseInterface",
"{",
"$",
"body",
"=",
"json_encode",
"(",
"$",
"body",
")",
";",
"if",
"(",
"$",
"body",
"===",
"false",
")",
"{",
"throw",
"new"... | Special endpoint for posting json, sets correct content type header and encodes data as json
@param string $path
@param array $body
@return ResponseInterface
@throws BokbasenApiClientException | [
"Special",
"endpoint",
"for",
"posting",
"json",
"sets",
"correct",
"content",
"type",
"header",
"and",
"encodes",
"data",
"as",
"json"
] | eeb33aa48b90d5043545d1af993167e9a74995df | https://github.com/Bokbasen/php-api-client/blob/eeb33aa48b90d5043545d1af993167e9a74995df/src/ApiClient/Client.php#L193-L208 |
31,161 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.init | public function init ()
{
$class = $this->_modelClass;
$this->_root = $class::find()->roots()->one();
if ($this->_root == null)
{
$root = new $class([ 'guid' => 'root', 'title' => 'ROOT' ]);
$root->makeRoot();
$this->_root = $class::find()->roots()->one();
$this->_data = [];
}
else... | php | public function init ()
{
$class = $this->_modelClass;
$this->_root = $class::find()->roots()->one();
if ($this->_root == null)
{
$root = new $class([ 'guid' => 'root', 'title' => 'ROOT' ]);
$root->makeRoot();
$this->_root = $class::find()->roots()->one();
$this->_data = [];
}
else... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"_modelClass",
";",
"$",
"this",
"->",
"_root",
"=",
"$",
"class",
"::",
"find",
"(",
")",
"->",
"roots",
"(",
")",
"->",
"one",
"(",
")",
";",
"if",
"(",
"$",
... | Populates category tree with data loaded from database.
@inheritdoc | [
"Populates",
"category",
"tree",
"with",
"data",
"loaded",
"from",
"database",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L48-L65 |
31,162 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.getChildren | public function getChildren ($category)
{
$children = [];
foreach ($this->_data as $item)
if ($item->lft > $category->lft and $item->rgt < $category->rgt)
$children[] = $item;
return $children;
} | php | public function getChildren ($category)
{
$children = [];
foreach ($this->_data as $item)
if ($item->lft > $category->lft and $item->rgt < $category->rgt)
$children[] = $item;
return $children;
} | [
"public",
"function",
"getChildren",
"(",
"$",
"category",
")",
"{",
"$",
"children",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"item",
")",
"if",
"(",
"$",
"item",
"->",
"lft",
">",
"$",
"category",
"->",
"lft",
... | Gets children of current category.
@param Category $category
@return array | [
"Gets",
"children",
"of",
"current",
"category",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L81-L89 |
31,163 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.getParent | public function getParent ($category, $depth = 1)
{
if ($category instanceof $this->_modelClass and $depth > 0)
{
if ($category->depth == $depth)
return $category;
foreach ($this->_data as $item)
if ($category->lft > $item->lft and $category->rgt < $item->rgt and $item->depth == $depth)
... | php | public function getParent ($category, $depth = 1)
{
if ($category instanceof $this->_modelClass and $depth > 0)
{
if ($category->depth == $depth)
return $category;
foreach ($this->_data as $item)
if ($category->lft > $item->lft and $category->rgt < $item->rgt and $item->depth == $depth)
... | [
"public",
"function",
"getParent",
"(",
"$",
"category",
",",
"$",
"depth",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"category",
"instanceof",
"$",
"this",
"->",
"_modelClass",
"and",
"$",
"depth",
">",
"0",
")",
"{",
"if",
"(",
"$",
"category",
"->",
"... | Finds category parent with given depth.
@param Category $category
@param int $depth
@return Category|null | [
"Finds",
"category",
"parent",
"with",
"given",
"depth",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L97-L109 |
31,164 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.getParents | public function getParents ($category)
{
if ($category instanceof $this->_modelClass)
{
$parents = [];
foreach ($this->_data as $item)
if ($category->lft > $item->lft and $category->rgt < $item->rgt)
$parents[] = $item;
return $parents;
}
return null;
} | php | public function getParents ($category)
{
if ($category instanceof $this->_modelClass)
{
$parents = [];
foreach ($this->_data as $item)
if ($category->lft > $item->lft and $category->rgt < $item->rgt)
$parents[] = $item;
return $parents;
}
return null;
} | [
"public",
"function",
"getParents",
"(",
"$",
"category",
")",
"{",
"if",
"(",
"$",
"category",
"instanceof",
"$",
"this",
"->",
"_modelClass",
")",
"{",
"$",
"parents",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"item... | Finds all parents from top one to nearest.
@param Category $category
@return Category[]|null | [
"Finds",
"all",
"parents",
"from",
"top",
"one",
"to",
"nearest",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L116-L129 |
31,165 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.get | public function get ($id)
{
foreach ($this->_data as $category)
if ($category->id == $id)
return $category;
return null;
} | php | public function get ($id)
{
foreach ($this->_data as $category)
if ($category->id == $id)
return $category;
return null;
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"category",
")",
"if",
"(",
"$",
"category",
"->",
"id",
"==",
"$",
"id",
")",
"return",
"$",
"category",
";",
"return",
"null",
";",
"}... | Gets single category by its ID.
@param integer $id
@return Category|null | [
"Gets",
"single",
"category",
"by",
"its",
"ID",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L145-L152 |
31,166 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.getByGuidPath | public function getByGuidPath ($guidPath)
{
foreach ($this->_data as $category)
if ($category->guidPath === $guidPath)
return $category;
return null;
} | php | public function getByGuidPath ($guidPath)
{
foreach ($this->_data as $category)
if ($category->guidPath === $guidPath)
return $category;
return null;
} | [
"public",
"function",
"getByGuidPath",
"(",
"$",
"guidPath",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"category",
")",
"if",
"(",
"$",
"category",
"->",
"guidPath",
"===",
"$",
"guidPath",
")",
"return",
"$",
"category",
";",
"r... | Gets single category by its GUID path.
@param string $guidPath
@return Category|null | [
"Gets",
"single",
"category",
"by",
"its",
"GUID",
"path",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L159-L166 |
31,167 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.exists | public function exists ($id)
{
foreach ($this->_data as $category)
if ($category->id == $id)
return true;
return false;
} | php | public function exists ($id)
{
foreach ($this->_data as $category)
if ($category->id == $id)
return true;
return false;
} | [
"public",
"function",
"exists",
"(",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"category",
")",
"if",
"(",
"$",
"category",
"->",
"id",
"==",
"$",
"id",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Checks if category exists.
@param integer $id Category ID.
@return bool | [
"Checks",
"if",
"category",
"exists",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L185-L192 |
31,168 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.reload | public function reload ()
{
$class = $this->_modelClass;
$this->_root = $class::find()->roots()->one();
$this->_data = $this->_root->children()->all();
$this->buildPaths();
} | php | public function reload ()
{
$class = $this->_modelClass;
$this->_root = $class::find()->roots()->one();
$this->_data = $this->_root->children()->all();
$this->buildPaths();
} | [
"public",
"function",
"reload",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"_modelClass",
";",
"$",
"this",
"->",
"_root",
"=",
"$",
"class",
"::",
"find",
"(",
")",
"->",
"roots",
"(",
")",
"->",
"one",
"(",
")",
";",
"$",
"this",
"-... | Reloads data from database. | [
"Reloads",
"data",
"from",
"database",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L197-L204 |
31,169 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.guidPath | public function guidPath ($id)
{
$category = $this->get($id);
if ($category == null)
return null;
elseif (empty($category->guidPath))
$this->buildPaths();
return $category->guidPath;
} | php | public function guidPath ($id)
{
$category = $this->get($id);
if ($category == null)
return null;
elseif (empty($category->guidPath))
$this->buildPaths();
return $category->guidPath;
} | [
"public",
"function",
"guidPath",
"(",
"$",
"id",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"category",
"==",
"null",
")",
"return",
"null",
";",
"elseif",
"(",
"empty",
"(",
"$",
"categor... | Finds category GUID path by given ID.
@param integer $id
@return null|string | [
"Finds",
"category",
"GUID",
"path",
"by",
"given",
"ID",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L211-L221 |
31,170 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.titlePath | public function titlePath ($id)
{
$category = $this->get($id);
if ($category == null)
return null;
elseif (empty($category->titlePath))
$this->buildPaths();
return $category->titlePath;
} | php | public function titlePath ($id)
{
$category = $this->get($id);
if ($category == null)
return null;
elseif (empty($category->titlePath))
$this->buildPaths();
return $category->titlePath;
} | [
"public",
"function",
"titlePath",
"(",
"$",
"id",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"category",
"==",
"null",
")",
"return",
"null",
";",
"elseif",
"(",
"empty",
"(",
"$",
"catego... | Finds category title path by given ID.
@param integer $id
@return null|string | [
"Finds",
"category",
"title",
"path",
"by",
"given",
"ID",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L228-L238 |
31,171 | pulsarvp/vps-tools | src/components/CategoryManager.php | CategoryManager.buildPaths | protected function buildPaths ()
{
$titles = [];
$guids = [];
$n = count($this->_data);
for ($i = 0; $i < $n; $i++)
{
$parent = $this->_data[ $i ];
for ($j = $i + 1; $j < $n; $j++)
{
$child = $this->_data[ $j ];
if ($child->lft > $parent->lft and $child->rgt < $parent->rgt)
... | php | protected function buildPaths ()
{
$titles = [];
$guids = [];
$n = count($this->_data);
for ($i = 0; $i < $n; $i++)
{
$parent = $this->_data[ $i ];
for ($j = $i + 1; $j < $n; $j++)
{
$child = $this->_data[ $j ];
if ($child->lft > $parent->lft and $child->rgt < $parent->rgt)
... | [
"protected",
"function",
"buildPaths",
"(",
")",
"{",
"$",
"titles",
"=",
"[",
"]",
";",
"$",
"guids",
"=",
"[",
"]",
";",
"$",
"n",
"=",
"count",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<"... | Builds full title and GUID paths for all categories. | [
"Builds",
"full",
"title",
"and",
"GUID",
"paths",
"for",
"all",
"categories",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/CategoryManager.php#L243-L267 |
31,172 | shimabox/SMBArrayto | src/SMB/Arrayto/Plugins/Csv/Downloader.php | Downloader.downloadExistsFile | public function downloadExistsFile($fileName, $aliasOfFileName = '')
{
$baseFileName = $aliasOfFileName === '' ? basename($fileName) : $aliasOfFileName;
header("Content-Type: text/csv; charset={$this->getHeaderCharset()}");
header("Content-Disposition: attachment; filename={$baseFileName}")... | php | public function downloadExistsFile($fileName, $aliasOfFileName = '')
{
$baseFileName = $aliasOfFileName === '' ? basename($fileName) : $aliasOfFileName;
header("Content-Type: text/csv; charset={$this->getHeaderCharset()}");
header("Content-Disposition: attachment; filename={$baseFileName}")... | [
"public",
"function",
"downloadExistsFile",
"(",
"$",
"fileName",
",",
"$",
"aliasOfFileName",
"=",
"''",
")",
"{",
"$",
"baseFileName",
"=",
"$",
"aliasOfFileName",
"===",
"''",
"?",
"basename",
"(",
"$",
"fileName",
")",
":",
"$",
"aliasOfFileName",
";",
... | download an existing file
@param string $fileName e.g.) sample.xxx | ../sample.xxx | /path/to/sample.xxx
@param string $aliasOfFileName | [
"download",
"an",
"existing",
"file"
] | 7ecacc0c15994c02224bbd3efe055d3bce243971 | https://github.com/shimabox/SMBArrayto/blob/7ecacc0c15994c02224bbd3efe055d3bce243971/src/SMB/Arrayto/Plugins/Csv/Downloader.php#L40-L48 |
31,173 | shimabox/SMBArrayto | src/SMB/Arrayto/Plugins/Csv/Downloader.php | Downloader.downloadExistsFileUsingWriter | public function downloadExistsFileUsingWriter($fileName, Writable $writer)
{
header("Content-Type: text/csv; charset={$this->getHeaderCharset()}");
header("Content-Disposition: attachment; filename={$fileName}");
$writer->write();
readfile($writer->getFileName());
} | php | public function downloadExistsFileUsingWriter($fileName, Writable $writer)
{
header("Content-Type: text/csv; charset={$this->getHeaderCharset()}");
header("Content-Disposition: attachment; filename={$fileName}");
$writer->write();
readfile($writer->getFileName());
} | [
"public",
"function",
"downloadExistsFileUsingWriter",
"(",
"$",
"fileName",
",",
"Writable",
"$",
"writer",
")",
"{",
"header",
"(",
"\"Content-Type: text/csv; charset={$this->getHeaderCharset()}\"",
")",
";",
"header",
"(",
"\"Content-Disposition: attachment; filename={$fileN... | download an existing file using Writer
@param string $fileName
@param \SMB\Arrayto\Interfaces\Writable $writer | [
"download",
"an",
"existing",
"file",
"using",
"Writer"
] | 7ecacc0c15994c02224bbd3efe055d3bce243971 | https://github.com/shimabox/SMBArrayto/blob/7ecacc0c15994c02224bbd3efe055d3bce243971/src/SMB/Arrayto/Plugins/Csv/Downloader.php#L55-L62 |
31,174 | pulsarvp/vps-tools | src/modules/setting/models/Setting.php | Setting.validateCommand | public function validateCommand ($attribute)
{
if (!$this->hasErrors())
{
$return_var1 = $return_var2 = $return_var3 = 0;
exec('command -v ' . $this->$attribute . '', $output, $return_var);
if ($return_var == 127)
$this->addError($attribute, Yii::tr('Command not found.', [], 'setting'));
}
... | php | public function validateCommand ($attribute)
{
if (!$this->hasErrors())
{
$return_var1 = $return_var2 = $return_var3 = 0;
exec('command -v ' . $this->$attribute . '', $output, $return_var);
if ($return_var == 127)
$this->addError($attribute, Yii::tr('Command not found.', [], 'setting'));
}
... | [
"public",
"function",
"validateCommand",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasErrors",
"(",
")",
")",
"{",
"$",
"return_var1",
"=",
"$",
"return_var2",
"=",
"$",
"return_var3",
"=",
"0",
";",
"exec",
"(",
"'command -v... | Command validates.
@param string $attribute the attribute currently being validated | [
"Command",
"validates",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/setting/models/Setting.php#L139-L148 |
31,175 | pulsarvp/vps-tools | src/modules/setting/models/Setting.php | Setting.validateJson | public function validateJson ($attribute)
{
if (!$this->hasErrors())
{
if (!( is_string($this->$attribute) && is_array(json_decode($this->$attribute, true)) && ( json_last_error() == JSON_ERROR_NONE ) ))
$this->addError($attribute, Yii::tr('This field must be well-formed JSON.', [], 'setting'));
}
... | php | public function validateJson ($attribute)
{
if (!$this->hasErrors())
{
if (!( is_string($this->$attribute) && is_array(json_decode($this->$attribute, true)) && ( json_last_error() == JSON_ERROR_NONE ) ))
$this->addError($attribute, Yii::tr('This field must be well-formed JSON.', [], 'setting'));
}
... | [
"public",
"function",
"validateJson",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasErrors",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"is_string",
"(",
"$",
"this",
"->",
"$",
"attribute",
")",
"&&",
"is_array",
"(",
"json... | Json validates.
@param string $attribute the attribute currently being validated | [
"Json",
"validates",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/setting/models/Setting.php#L155-L162 |
31,176 | pulsarvp/vps-tools | src/modules/setting/models/Setting.php | Setting.validateUrl | public function validateUrl ($attribute)
{
if (!$this->hasErrors())
{
if (filter_var($this->$attribute, FILTER_VALIDATE_URL) === false)
$this->addError($attribute, Yii::tr('{attribute} is not a valid URL.', [ 'attribute' => $this->name ], 'setting'));
}
} | php | public function validateUrl ($attribute)
{
if (!$this->hasErrors())
{
if (filter_var($this->$attribute, FILTER_VALIDATE_URL) === false)
$this->addError($attribute, Yii::tr('{attribute} is not a valid URL.', [ 'attribute' => $this->name ], 'setting'));
}
} | [
"public",
"function",
"validateUrl",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasErrors",
"(",
")",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"this",
"->",
"$",
"attribute",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false"... | Url validates.
@param string $attribute the attribute currently being validated | [
"Url",
"validates",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/setting/models/Setting.php#L169-L176 |
31,177 | pulsarvp/vps-tools | src/modules/setting/models/Setting.php | Setting.validatePath | public function validatePath ($attribute)
{
if (!$this->hasErrors())
{
if (!file_exists($this->$attribute))
$this->addError($attribute, Yii::tr('{attribute} does not exist.', [ 'attribute' => $attribute ], 'setting'));
if ($this->rule != '')
{
$rule = json_decode($this->rule, true);
i... | php | public function validatePath ($attribute)
{
if (!$this->hasErrors())
{
if (!file_exists($this->$attribute))
$this->addError($attribute, Yii::tr('{attribute} does not exist.', [ 'attribute' => $attribute ], 'setting'));
if ($this->rule != '')
{
$rule = json_decode($this->rule, true);
i... | [
"public",
"function",
"validatePath",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasErrors",
"(",
")",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"$",
"attribute",
")",
")",
"$",
"this",
"->",
"addErr... | Path validates.
@param string $attribute the attribute currently being validated | [
"Path",
"validates",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/setting/models/Setting.php#L183-L199 |
31,178 | pulsarvp/vps-tools | src/base/BaseOrderModel.php | BaseOrderModel.beforeSave | public function beforeSave ($insert)
{
if ($parent = parent::beforeSave($insert))
{
if ($this->isNewRecord)
{
if ($this->hasAttribute('order') and empty($this->order))
{
$query = self::find()->select('order')->orderBy([ 'order' => SORT_DESC ]);
$condition = $this->orderCondition()... | php | public function beforeSave ($insert)
{
if ($parent = parent::beforeSave($insert))
{
if ($this->isNewRecord)
{
if ($this->hasAttribute('order') and empty($this->order))
{
$query = self::find()->select('order')->orderBy([ 'order' => SORT_DESC ]);
$condition = $this->orderCondition()... | [
"public",
"function",
"beforeSave",
"(",
"$",
"insert",
")",
"{",
"if",
"(",
"$",
"parent",
"=",
"parent",
"::",
"beforeSave",
"(",
"$",
"insert",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNewRecord",
")",
"{",
"if",
"(",
"$",
"this",
"->",
... | Looking for the biggest order in the table, and the current model doing +1.
@param bool $insert
@return bool | [
"Looking",
"for",
"the",
"biggest",
"order",
"in",
"the",
"table",
"and",
"the",
"current",
"model",
"doing",
"+",
"1",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/base/BaseOrderModel.php#L24-L48 |
31,179 | pulsarvp/vps-tools | src/base/BaseOrderModel.php | BaseOrderModel.afterDelete | public function afterDelete ()
{
$parent = parent::afterDelete();
if ($this->hasAttribute('order'))
{
$query = self::find()->where([ '>', 'order', $this->order ]);
$condition = $this->orderCondition();
if ($condition !== null)
{
$query->andWhere($condition);
}
$objects = $quer... | php | public function afterDelete ()
{
$parent = parent::afterDelete();
if ($this->hasAttribute('order'))
{
$query = self::find()->where([ '>', 'order', $this->order ]);
$condition = $this->orderCondition();
if ($condition !== null)
{
$query->andWhere($condition);
}
$objects = $quer... | [
"public",
"function",
"afterDelete",
"(",
")",
"{",
"$",
"parent",
"=",
"parent",
"::",
"afterDelete",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasAttribute",
"(",
"'order'",
")",
")",
"{",
"$",
"query",
"=",
"self",
"::",
"find",
"(",
")",
"-... | Which order more than the remote model, do for order -1. | [
"Which",
"order",
"more",
"than",
"the",
"remote",
"model",
"do",
"for",
"order",
"-",
"1",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/base/BaseOrderModel.php#L53-L76 |
31,180 | pulsarvp/vps-tools | src/net/Curl.php | Curl.delete | public function delete ($data = null)
{
$this->_options[ CURLOPT_CUSTOMREQUEST ] = 'DELETE';
if ($data != null)
$this->_options[ CURLOPT_POSTFIELDS ] = is_array($data) ? http_build_query($data) : $data;
return $this->send();
} | php | public function delete ($data = null)
{
$this->_options[ CURLOPT_CUSTOMREQUEST ] = 'DELETE';
if ($data != null)
$this->_options[ CURLOPT_POSTFIELDS ] = is_array($data) ? http_build_query($data) : $data;
return $this->send();
} | [
"public",
"function",
"delete",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_CUSTOMREQUEST",
"]",
"=",
"'DELETE'",
";",
"if",
"(",
"$",
"data",
"!=",
"null",
")",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_POS... | Sends DELETE request.
@param null|array $data Additional data to append to request.
@return string|CurlResponse | [
"Sends",
"DELETE",
"request",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Curl.php#L103-L110 |
31,181 | pulsarvp/vps-tools | src/net/Curl.php | Curl.post | public function post ($data)
{
$this->_options[ CURLOPT_POST ] = 1;
$this->_options[ CURLOPT_POSTFIELDS ] = is_array($data) ? http_build_query($data) : $data;
return $this->send();
} | php | public function post ($data)
{
$this->_options[ CURLOPT_POST ] = 1;
$this->_options[ CURLOPT_POSTFIELDS ] = is_array($data) ? http_build_query($data) : $data;
return $this->send();
} | [
"public",
"function",
"post",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_POST",
"]",
"=",
"1",
";",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_POSTFIELDS",
"]",
"=",
"is_array",
"(",
"$",
"data",
")",
"?",
"http_build_qu... | Sends POST request.
@param array|string $data Additional data to append to request.
@return string|CurlResponse | [
"Sends",
"POST",
"request",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Curl.php#L141-L147 |
31,182 | pulsarvp/vps-tools | src/net/Curl.php | Curl.put | public function put ($data)
{
$this->_options[ CURLOPT_CUSTOMREQUEST ] = 'PUT';
$this->_options[ CURLOPT_POSTFIELDS ] = http_build_query($data);
return $this->send();
} | php | public function put ($data)
{
$this->_options[ CURLOPT_CUSTOMREQUEST ] = 'PUT';
$this->_options[ CURLOPT_POSTFIELDS ] = http_build_query($data);
return $this->send();
} | [
"public",
"function",
"put",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_CUSTOMREQUEST",
"]",
"=",
"'PUT'",
";",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_POSTFIELDS",
"]",
"=",
"http_build_query",
"(",
"$",
"data",
")",
"... | Sends PUT request.
@param null|array $data Additional data to append to request.
@return string|CurlResponse | [
"Sends",
"PUT",
"request",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Curl.php#L155-L161 |
31,183 | pulsarvp/vps-tools | src/net/Curl.php | Curl.send | private function send ()
{
if (count($this->_params) > 0)
$this->_options[ CURLOPT_URL ] .= '?' . http_build_query($this->_params);
if (count($this->_headers) > 0)
$this->_options[ CURLOPT_HTTPHEADER ] = $this->_headers;
$curl = curl_init();
curl_setopt_array($curl, $this->_options);
$resp = ... | php | private function send ()
{
if (count($this->_params) > 0)
$this->_options[ CURLOPT_URL ] .= '?' . http_build_query($this->_params);
if (count($this->_headers) > 0)
$this->_options[ CURLOPT_HTTPHEADER ] = $this->_headers;
$curl = curl_init();
curl_setopt_array($curl, $this->_options);
$resp = ... | [
"private",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"_params",
")",
">",
"0",
")",
"$",
"this",
"->",
"_options",
"[",
"CURLOPT_URL",
"]",
".=",
"'?'",
".",
"http_build_query",
"(",
"$",
"this",
"->",
"_params",
... | This is general send method to use in particular request send method.
@return string|CurlResponse | [
"This",
"is",
"general",
"send",
"method",
"to",
"use",
"in",
"particular",
"request",
"send",
"method",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Curl.php#L168-L196 |
31,184 | cedx/yii2-mustache | lib/Helper.php | Helper.parseArguments | protected function parseArguments(string $text, string $defaultArgument, array $defaultValues = []): array {
try {
if (is_array($json = Json::decode($text))) return ArrayHelper::merge($defaultValues, $json);
throw new InvalidArgumentException('The JSON string has an invalid format.');
}
catch (... | php | protected function parseArguments(string $text, string $defaultArgument, array $defaultValues = []): array {
try {
if (is_array($json = Json::decode($text))) return ArrayHelper::merge($defaultValues, $json);
throw new InvalidArgumentException('The JSON string has an invalid format.');
}
catch (... | [
"protected",
"function",
"parseArguments",
"(",
"string",
"$",
"text",
",",
"string",
"$",
"defaultArgument",
",",
"array",
"$",
"defaultValues",
"=",
"[",
"]",
")",
":",
"array",
"{",
"try",
"{",
"if",
"(",
"is_array",
"(",
"$",
"json",
"=",
"Json",
"... | Parses the arguments of a parameterized helper.
Arguments can be specified as a single value, or as a string in JSON format.
@param string $text The section content specifying the helper arguments.
@param string $defaultArgument The name of the default argument. This is used when the section content provides a plain st... | [
"Parses",
"the",
"arguments",
"of",
"a",
"parameterized",
"helper",
".",
"Arguments",
"can",
"be",
"specified",
"as",
"a",
"single",
"value",
"or",
"as",
"a",
"string",
"in",
"JSON",
"format",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/Helper.php#L41-L51 |
31,185 | EmchBerger/cube-custom-fields-bundle | src/Entity/EntityCustomField.php | EntityCustomField.createStrRepresentation | public function createStrRepresentation()
{
$entity = $this->getEntityData();
if (is_array($entity) || $entity instanceof \ArrayAccess) {
// for some reason, implode does not work directly on the entity traversable
$strArr = array();
foreach ($entity as $e) {
... | php | public function createStrRepresentation()
{
$entity = $this->getEntityData();
if (is_array($entity) || $entity instanceof \ArrayAccess) {
// for some reason, implode does not work directly on the entity traversable
$strArr = array();
foreach ($entity as $e) {
... | [
"public",
"function",
"createStrRepresentation",
"(",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntityData",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"entity",
")",
"||",
"$",
"entity",
"instanceof",
"\\",
"ArrayAccess",
")",
"{",
"// f... | Override the default string representation creator method
@return string | [
"Override",
"the",
"default",
"string",
"representation",
"creator",
"method"
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Entity/EntityCustomField.php#L95-L110 |
31,186 | EmchBerger/cube-custom-fields-bundle | src/Entity/EntityCustomField.php | EntityCustomField.createStrRepresentationOnFlush | public function createStrRepresentationOnFlush($flushEntity)
{
$entity = $this->getEntityData();
if (is_array($entity) || $entity instanceof \ArrayAccess) {
$entityArr = array();
foreach ($entity as $elem) {
$entityArr[] = $this->getEntityOnFlush($elem, $flush... | php | public function createStrRepresentationOnFlush($flushEntity)
{
$entity = $this->getEntityData();
if (is_array($entity) || $entity instanceof \ArrayAccess) {
$entityArr = array();
foreach ($entity as $elem) {
$entityArr[] = $this->getEntityOnFlush($elem, $flush... | [
"public",
"function",
"createStrRepresentationOnFlush",
"(",
"$",
"flushEntity",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntityData",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"entity",
")",
"||",
"$",
"entity",
"instanceof",
"\\",
"Arra... | Override the default string representation creator method for the onFlush event
@return string | [
"Override",
"the",
"default",
"string",
"representation",
"creator",
"method",
"for",
"the",
"onFlush",
"event"
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Entity/EntityCustomField.php#L117-L131 |
31,187 | EmchBerger/cube-custom-fields-bundle | src/Entity/EntityCustomField.php | EntityCustomField.getEntityOnFlush | private function getEntityOnFlush($entity, $flushEntity)
{
if (ClassUtils::getClass($entity) == ClassUtils::getClass($flushEntity) && $entity->getId() === $flushEntity->getId()) {
return $flushEntity;
} else {
return $entity;
}
} | php | private function getEntityOnFlush($entity, $flushEntity)
{
if (ClassUtils::getClass($entity) == ClassUtils::getClass($flushEntity) && $entity->getId() === $flushEntity->getId()) {
return $flushEntity;
} else {
return $entity;
}
} | [
"private",
"function",
"getEntityOnFlush",
"(",
"$",
"entity",
",",
"$",
"flushEntity",
")",
"{",
"if",
"(",
"ClassUtils",
"::",
"getClass",
"(",
"$",
"entity",
")",
"==",
"ClassUtils",
"::",
"getClass",
"(",
"$",
"flushEntity",
")",
"&&",
"$",
"entity",
... | Checks if the two passed objects are "the same" but possibly in different states. Returns the second argument if they are the same, else the first
@param type $entity
@param type $flushEntity
@return type | [
"Checks",
"if",
"the",
"two",
"passed",
"objects",
"are",
"the",
"same",
"but",
"possibly",
"in",
"different",
"states",
".",
"Returns",
"the",
"second",
"argument",
"if",
"they",
"are",
"the",
"same",
"else",
"the",
"first"
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Entity/EntityCustomField.php#L139-L146 |
31,188 | EmchBerger/cube-custom-fields-bundle | src/Entity/EntityCustomField.php | EntityCustomField.loadEntitiesAtLoad | public function loadEntitiesAtLoad(LifecycleEventArgs $event)
{
if ($this->entityValue && $this->entityValue['entityClass']) {
$em = $event->getEntityManager();
if (is_array($this->entityValue) && is_array($this->entityValue['entityId'])) {
// multiple
... | php | public function loadEntitiesAtLoad(LifecycleEventArgs $event)
{
if ($this->entityValue && $this->entityValue['entityClass']) {
$em = $event->getEntityManager();
if (is_array($this->entityValue) && is_array($this->entityValue['entityId'])) {
// multiple
... | [
"public",
"function",
"loadEntitiesAtLoad",
"(",
"LifecycleEventArgs",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"entityValue",
"&&",
"$",
"this",
"->",
"entityValue",
"[",
"'entityClass'",
"]",
")",
"{",
"$",
"em",
"=",
"$",
"event",
"->",
"... | LifeCycleCallback PostLoad, loading entities from DataBase.
@ORM\PostLoad
@param LifecycleEventArgs $event | [
"LifeCycleCallback",
"PostLoad",
"loading",
"entities",
"from",
"DataBase",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Entity/EntityCustomField.php#L163-L179 |
31,189 | pulsarvp/vps-tools | src/net/Flow.php | Flow.getChunkPath | public function getChunkPath ($n = null)
{
if ($n === null)
$n = $this->_params[ 'chunkNumber' ];
return $this->_tmpDir . '/' . $this->_params[ 'filename' ] . '.part' . $n;
} | php | public function getChunkPath ($n = null)
{
if ($n === null)
$n = $this->_params[ 'chunkNumber' ];
return $this->_tmpDir . '/' . $this->_params[ 'filename' ] . '.part' . $n;
} | [
"public",
"function",
"getChunkPath",
"(",
"$",
"n",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"n",
"===",
"null",
")",
"$",
"n",
"=",
"$",
"this",
"->",
"_params",
"[",
"'chunkNumber'",
"]",
";",
"return",
"$",
"this",
"->",
"_tmpDir",
".",
"'/'",
... | Gets full path to chunk file.
@param null|integer $n Chunk number.
@return string | [
"Gets",
"full",
"path",
"to",
"chunk",
"file",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L99-L105 |
31,190 | pulsarvp/vps-tools | src/net/Flow.php | Flow.getIsComplete | public function getIsComplete ()
{
if ($this->_isComplete)
return true;
for ($i = 1; $i <= $this->_params[ 'totalChunks' ]; $i++)
{
if (!$this->chunkIsUploaded($i))
{
$this->_isComplete = false;
return false;
}
}
$this->_isComplete = true;
return true;
} | php | public function getIsComplete ()
{
if ($this->_isComplete)
return true;
for ($i = 1; $i <= $this->_params[ 'totalChunks' ]; $i++)
{
if (!$this->chunkIsUploaded($i))
{
$this->_isComplete = false;
return false;
}
}
$this->_isComplete = true;
return true;
} | [
"public",
"function",
"getIsComplete",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isComplete",
")",
"return",
"true",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"this",
"->",
"_params",
"[",
"'totalChunks'",
"]",
";",
"$",
... | Check whether file uploading is complete.
@return bool | [
"Check",
"whether",
"file",
"uploading",
"is",
"complete",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L111-L129 |
31,191 | pulsarvp/vps-tools | src/net/Flow.php | Flow.getIsNew | public function getIsNew ()
{
if ($this->_isNew == false)
return false;
for ($i = 1; $i <= $this->_params[ 'totalChunks' ]; $i++)
{
if ($this->chunkIsUploaded($i))
{
$this->_isNew = false;
return false;
}
}
$this->_isNew = true;
return true;
} | php | public function getIsNew ()
{
if ($this->_isNew == false)
return false;
for ($i = 1; $i <= $this->_params[ 'totalChunks' ]; $i++)
{
if ($this->chunkIsUploaded($i))
{
$this->_isNew = false;
return false;
}
}
$this->_isNew = true;
return true;
} | [
"public",
"function",
"getIsNew",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isNew",
"==",
"false",
")",
"return",
"false",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"this",
"->",
"_params",
"[",
"'totalChunks'",
"]",
";"... | Check whether file uploading is new.
@return bool | [
"Check",
"whether",
"file",
"uploading",
"is",
"new",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L135-L153 |
31,192 | pulsarvp/vps-tools | src/net/Flow.php | Flow.getParam | public function getParam ($name)
{
if (isset( $this->_params[ $name ] ))
return $this->_params[ $name ];
else
return null;
} | php | public function getParam ($name)
{
if (isset( $this->_params[ $name ] ))
return $this->_params[ $name ];
else
return null;
} | [
"public",
"function",
"getParam",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_params",
"[",
"$",
"name",
"]",
")",
")",
"return",
"$",
"this",
"->",
"_params",
"[",
"$",
"name",
"]",
";",
"else",
"return",
"null",
";... | Gets param by its name.
@param string $name Parameter name.
@return null|mixed Parameter if exists, null otherwise. | [
"Gets",
"param",
"by",
"its",
"name",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L169-L175 |
31,193 | pulsarvp/vps-tools | src/net/Flow.php | Flow.setTmpDir | public function setTmpDir ($dir)
{
$this->_tmpDir = $dir . '/' . $this->_params[ 'identifier' ];
if (!is_dir($this->_tmpDir))
FileHelper::createDirectory($this->_tmpDir);
} | php | public function setTmpDir ($dir)
{
$this->_tmpDir = $dir . '/' . $this->_params[ 'identifier' ];
if (!is_dir($this->_tmpDir))
FileHelper::createDirectory($this->_tmpDir);
} | [
"public",
"function",
"setTmpDir",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"_tmpDir",
"=",
"$",
"dir",
".",
"'/'",
".",
"$",
"this",
"->",
"_params",
"[",
"'identifier'",
"]",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"_tmpDir",
... | Sets temporary directory.
@param string $dir
@throws \yii\base\Exception | [
"Sets",
"temporary",
"directory",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L191-L196 |
31,194 | pulsarvp/vps-tools | src/net/Flow.php | Flow.setTargetDir | public function setTargetDir ($dir)
{
$this->_targetDir = $dir;
if (!is_dir($this->_targetDir))
FileHelper::createDirectory($this->_targetDir);
} | php | public function setTargetDir ($dir)
{
$this->_targetDir = $dir;
if (!is_dir($this->_targetDir))
FileHelper::createDirectory($this->_targetDir);
} | [
"public",
"function",
"setTargetDir",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"_targetDir",
"=",
"$",
"dir",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"_targetDir",
")",
")",
"FileHelper",
"::",
"createDirectory",
"(",
"$",
"this",
... | Sets path to target directory where to save video file.
@param string $dir
@throws \yii\base\Exception | [
"Sets",
"path",
"to",
"target",
"directory",
"where",
"to",
"save",
"video",
"file",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L203-L208 |
31,195 | pulsarvp/vps-tools | src/net/Flow.php | Flow.process | public function process ()
{
if (!empty( $this->_params ))
{
if ($this->getIsUploading())
$this->uploadChunk();
else
$this->testChunk();
}
} | php | public function process ()
{
if (!empty( $this->_params ))
{
if ($this->getIsUploading())
$this->uploadChunk();
else
$this->testChunk();
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_params",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsUploading",
"(",
")",
")",
"$",
"this",
"->",
"uploadChunk",
"(",
")",
";",
"else",
"$"... | Uploads or tests current chunk. | [
"Uploads",
"or",
"tests",
"current",
"chunk",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L213-L222 |
31,196 | pulsarvp/vps-tools | src/net/Flow.php | Flow.save | public function save ($name = null)
{
if ($name == null)
$name = StringHelper::random();
$ext = pathinfo($this->_params[ 'filename' ], PATHINFO_EXTENSION);
$this->_savedFilename = $name . '.' . $ext;
if (( $file = fopen($this->_targetDir . '/' . $this->_savedFilename, 'w') ) !== false)
{
if (Y... | php | public function save ($name = null)
{
if ($name == null)
$name = StringHelper::random();
$ext = pathinfo($this->_params[ 'filename' ], PATHINFO_EXTENSION);
$this->_savedFilename = $name . '.' . $ext;
if (( $file = fopen($this->_targetDir . '/' . $this->_savedFilename, 'w') ) !== false)
{
if (Y... | [
"public",
"function",
"save",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"null",
")",
"$",
"name",
"=",
"StringHelper",
"::",
"random",
"(",
")",
";",
"$",
"ext",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"_params",
"["... | Saves uploaded file.
@param null|string $name File name (without extension).
@return string Saved file name with extension.
@throws \yii\base\ErrorException | [
"Saves",
"uploaded",
"file",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L230-L257 |
31,197 | pulsarvp/vps-tools | src/net/Flow.php | Flow.uploadChunk | public function uploadChunk ()
{
move_uploaded_file($this->_file[ 'tmp_name' ], $this->chunkPath);
Yii::$app->response->setStatusCode(200);
} | php | public function uploadChunk ()
{
move_uploaded_file($this->_file[ 'tmp_name' ], $this->chunkPath);
Yii::$app->response->setStatusCode(200);
} | [
"public",
"function",
"uploadChunk",
"(",
")",
"{",
"move_uploaded_file",
"(",
"$",
"this",
"->",
"_file",
"[",
"'tmp_name'",
"]",
",",
"$",
"this",
"->",
"chunkPath",
")",
";",
"Yii",
"::",
"$",
"app",
"->",
"response",
"->",
"setStatusCode",
"(",
"200"... | Uploads current chunk.
@throws \yii\base\ErrorException | [
"Uploads",
"current",
"chunk",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/net/Flow.php#L274-L279 |
31,198 | EmchBerger/cube-custom-fields-bundle | src/Utils/ConfigReader.php | ConfigReader.getConfigForEntity | public function getConfigForEntity($entity)
{
if (is_object($entity)) {
$entityClass = self::getEntityClass($entity);
} else {
$entityClass = $entity;
}
if (array_key_exists($entityClass, $this->config)) {
return $this->config[$entityClass];
... | php | public function getConfigForEntity($entity)
{
if (is_object($entity)) {
$entityClass = self::getEntityClass($entity);
} else {
$entityClass = $entity;
}
if (array_key_exists($entityClass, $this->config)) {
return $this->config[$entityClass];
... | [
"public",
"function",
"getConfigForEntity",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"entity",
")",
")",
"{",
"$",
"entityClass",
"=",
"self",
"::",
"getEntityClass",
"(",
"$",
"entity",
")",
";",
"}",
"else",
"{",
"$",
"entityCl... | Returns the custom field config for the given entity
@param object|string entity or class of entity
@return array config of entity | [
"Returns",
"the",
"custom",
"field",
"config",
"for",
"the",
"given",
"entity"
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Utils/ConfigReader.php#L41-L53 |
31,199 | pulsarvp/vps-tools | src/modules/setting/migrations/m010101_100001_init_setting.php | m010101_100001_init_setting.up | public function up ()
{
$this->createTable('setting', [
'name' => $this->string(45)->notNull()->unique(),
'value' => $this->text()->null(),
'description' => $this->text()->null(),
]);
$this->addPrimaryKey('name', 'setting', 'name');
} | php | public function up ()
{
$this->createTable('setting', [
'name' => $this->string(45)->notNull()->unique(),
'value' => $this->text()->null(),
'description' => $this->text()->null(),
]);
$this->addPrimaryKey('name', 'setting', 'name');
} | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"this",
"->",
"createTable",
"(",
"'setting'",
",",
"[",
"'name'",
"=>",
"$",
"this",
"->",
"string",
"(",
"45",
")",
"->",
"notNull",
"(",
")",
"->",
"unique",
"(",
")",
",",
"'value'",
"=>",
"$",
... | Create table `Setting` | [
"Create",
"table",
"Setting"
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/setting/migrations/m010101_100001_init_setting.php#L10-L18 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.