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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,800 | RhubarbPHP/Rhubarb | src/Mime/MimePartBinaryFile.php | MimePartBinaryFile.fromLocalPath | public static function fromLocalPath($path, $name = "")
{
if ($name == "") {
$name = basename($path);
}
$part = new MimePartBinaryFile();
$part->setTransformedBody(file_get_contents($path));
$part->addHeader("Content-Disposition", "attachment; filename=\"" . $nam... | php | public static function fromLocalPath($path, $name = "")
{
if ($name == "") {
$name = basename($path);
}
$part = new MimePartBinaryFile();
$part->setTransformedBody(file_get_contents($path));
$part->addHeader("Content-Disposition", "attachment; filename=\"" . $nam... | [
"public",
"static",
"function",
"fromLocalPath",
"(",
"$",
"path",
",",
"$",
"name",
"=",
"\"\"",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"\"\"",
")",
"{",
"$",
"name",
"=",
"basename",
"(",
"$",
"path",
")",
";",
"}",
"$",
"part",
"=",
"new",
... | Creates an instance to represent a file stored locally.
@param $path
@param string $name
@return MimePartBinaryFile | [
"Creates",
"an",
"instance",
"to",
"represent",
"a",
"file",
"stored",
"locally",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Mime/MimePartBinaryFile.php#L38-L49 |
27,801 | RhubarbPHP/Rhubarb | src/Assets/LocalStorageAssetCatalogueProvider.php | LocalStorageAssetCatalogueProvider.getCategoryDirectory | private function getCategoryDirectory()
{
if (!$this->category){
return "_default";
}
$category = preg_replace("/\\W/","-",$this->category);
$category = preg_replace("/-+/","-",$category);
$category .= crc32($this->category);
return $category;
} | php | private function getCategoryDirectory()
{
if (!$this->category){
return "_default";
}
$category = preg_replace("/\\W/","-",$this->category);
$category = preg_replace("/-+/","-",$category);
$category .= crc32($this->category);
return $category;
} | [
"private",
"function",
"getCategoryDirectory",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"category",
")",
"{",
"return",
"\"_default\"",
";",
"}",
"$",
"category",
"=",
"preg_replace",
"(",
"\"/\\\\W/\"",
",",
"\"-\"",
",",
"$",
"this",
"->",
"ca... | Makes the category name safe to use for a file path but guaranteed unique.
e.g. This! and This@ should both work. | [
"Makes",
"the",
"category",
"name",
"safe",
"to",
"use",
"for",
"a",
"file",
"path",
"but",
"guaranteed",
"unique",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/LocalStorageAssetCatalogueProvider.php#L61-L72 |
27,802 | RhubarbPHP/Rhubarb | src/Assets/LocalStorageAssetCatalogueProvider.php | LocalStorageAssetCatalogueProvider.getAssetPath | protected function getAssetPath(Asset $asset):string
{
// Get the file name from the provider data
$data = $asset->getProviderData();
$path = $this->getRootPath() . "/" . $this->getCategoryDirectory() . "/" . $data["file"];
return $path;
} | php | protected function getAssetPath(Asset $asset):string
{
// Get the file name from the provider data
$data = $asset->getProviderData();
$path = $this->getRootPath() . "/" . $this->getCategoryDirectory() . "/" . $data["file"];
return $path;
} | [
"protected",
"function",
"getAssetPath",
"(",
"Asset",
"$",
"asset",
")",
":",
"string",
"{",
"// Get the file name from the provider data",
"$",
"data",
"=",
"$",
"asset",
"->",
"getProviderData",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getRootPa... | Returns the local path for the given asset.
@param Asset $asset
@return string | [
"Returns",
"the",
"local",
"path",
"for",
"the",
"given",
"asset",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/LocalStorageAssetCatalogueProvider.php#L144-L150 |
27,803 | RhubarbPHP/Rhubarb | src/Encryption/Sha512HashProvider.php | Sha512HashProvider.createHash | public function createHash($data, $salt = false)
{
if ($salt === false) {
$salt = sha1(uniqid("sillystring", true) . microtime());
}
$raw = crypt($data, '$6$rounds=10000$' . $salt . '$');
return $raw;
} | php | public function createHash($data, $salt = false)
{
if ($salt === false) {
$salt = sha1(uniqid("sillystring", true) . microtime());
}
$raw = crypt($data, '$6$rounds=10000$' . $salt . '$');
return $raw;
} | [
"public",
"function",
"createHash",
"(",
"$",
"data",
",",
"$",
"salt",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"salt",
"===",
"false",
")",
"{",
"$",
"salt",
"=",
"sha1",
"(",
"uniqid",
"(",
"\"sillystring\"",
",",
"true",
")",
".",
"microtime",
"... | Create's a new hash of the supplied data using the optionally supplied salt.
It's expected that the salt can be randomised if not supplied. This is fact
preferable in nearly all occasions as the salt should be included in the return
value.
@param string $data
@param string|bool $salt
@return string | [
"Create",
"s",
"a",
"new",
"hash",
"of",
"the",
"supplied",
"data",
"using",
"the",
"optionally",
"supplied",
"salt",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Encryption/Sha512HashProvider.php#L37-L46 |
27,804 | RhubarbPHP/Rhubarb | src/Encryption/Sha512HashProvider.php | Sha512HashProvider.compareHash | public function compareHash($data, $hash)
{
$salt = $this->extractSalt($hash);
$newHash = $this->createHash($data, $salt);
return ($newHash == $hash);
} | php | public function compareHash($data, $hash)
{
$salt = $this->extractSalt($hash);
$newHash = $this->createHash($data, $salt);
return ($newHash == $hash);
} | [
"public",
"function",
"compareHash",
"(",
"$",
"data",
",",
"$",
"hash",
")",
"{",
"$",
"salt",
"=",
"$",
"this",
"->",
"extractSalt",
"(",
"$",
"hash",
")",
";",
"$",
"newHash",
"=",
"$",
"this",
"->",
"createHash",
"(",
"$",
"data",
",",
"$",
"... | Computes the hash of the supplied data using the salt contained within an existing hash.
If the resultant value matches the hash the hash and data are equivilant.
@param $data
@param $hash
@return bool | [
"Computes",
"the",
"hash",
"of",
"the",
"supplied",
"data",
"using",
"the",
"salt",
"contained",
"within",
"an",
"existing",
"hash",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Encryption/Sha512HashProvider.php#L70-L77 |
27,805 | RhubarbPHP/Rhubarb | src/Assets/AssetCatalogueProvider.php | AssetCatalogueProvider.storeAsset | public static function storeAsset($filePath, $category, $storeAs = "")
{
// A sane default
$mime = "application/octet-stream";
$name = ($storeAs == "") ? basename($filePath) : $storeAs;
// CSV is detected as text/plain - change this if.
if (preg_match("/\\.csv$/i", $name)){... | php | public static function storeAsset($filePath, $category, $storeAs = "")
{
// A sane default
$mime = "application/octet-stream";
$name = ($storeAs == "") ? basename($filePath) : $storeAs;
// CSV is detected as text/plain - change this if.
if (preg_match("/\\.csv$/i", $name)){... | [
"public",
"static",
"function",
"storeAsset",
"(",
"$",
"filePath",
",",
"$",
"category",
",",
"$",
"storeAs",
"=",
"\"\"",
")",
"{",
"// A sane default",
"$",
"mime",
"=",
"\"application/octet-stream\"",
";",
"$",
"name",
"=",
"(",
"$",
"storeAs",
"==",
"... | Stores an asset currently held in a local file in a given asset category
@param string $filePath
@param string $category
@return Asset | [
"Stores",
"an",
"asset",
"currently",
"held",
"in",
"a",
"local",
"file",
"in",
"a",
"given",
"asset",
"category"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/AssetCatalogueProvider.php#L49-L84 |
27,806 | RhubarbPHP/Rhubarb | src/Assets/AssetCatalogueProvider.php | AssetCatalogueProvider.getJwtKey | private static function getJwtKey()
{
$settings = AssetCatalogueSettings::singleton();
$key = $settings->jwtKey;
if ($key == "") {
throw new AssetException("", "No token key is defined in AssetCatalogueSettings");
}
return $key;
} | php | private static function getJwtKey()
{
$settings = AssetCatalogueSettings::singleton();
$key = $settings->jwtKey;
if ($key == "") {
throw new AssetException("", "No token key is defined in AssetCatalogueSettings");
}
return $key;
} | [
"private",
"static",
"function",
"getJwtKey",
"(",
")",
"{",
"$",
"settings",
"=",
"AssetCatalogueSettings",
"::",
"singleton",
"(",
")",
";",
"$",
"key",
"=",
"$",
"settings",
"->",
"jwtKey",
";",
"if",
"(",
"$",
"key",
"==",
"\"\"",
")",
"{",
"throw"... | Gets the key used to sign JWT tokens.
@return string
@throws AssetException | [
"Gets",
"the",
"key",
"used",
"to",
"sign",
"JWT",
"tokens",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/AssetCatalogueProvider.php#L99-L109 |
27,807 | RhubarbPHP/Rhubarb | src/Assets/AssetCatalogueProvider.php | AssetCatalogueProvider.createToken | protected function createToken($data)
{
$key = self::getJwtKey();
$token = array(
"iat" => time(),
"provider" => get_class($this),
"category" => $this->category,
"data" => $data
);
$jwt = JWT::encode($token, $key);
return $jw... | php | protected function createToken($data)
{
$key = self::getJwtKey();
$token = array(
"iat" => time(),
"provider" => get_class($this),
"category" => $this->category,
"data" => $data
);
$jwt = JWT::encode($token, $key);
return $jw... | [
"protected",
"function",
"createToken",
"(",
"$",
"data",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"getJwtKey",
"(",
")",
";",
"$",
"token",
"=",
"array",
"(",
"\"iat\"",
"=>",
"time",
"(",
")",
",",
"\"provider\"",
"=>",
"get_class",
"(",
"$",
"this... | Creates a JWT token to encode an asset using the passed data array.
@param $data
@return string
@throws AssetException | [
"Creates",
"a",
"JWT",
"token",
"to",
"encode",
"an",
"asset",
"using",
"the",
"passed",
"data",
"array",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/AssetCatalogueProvider.php#L142-L156 |
27,808 | RhubarbPHP/Rhubarb | src/Assets/AssetCatalogueProvider.php | AssetCatalogueProvider.getAsset | public static function getAsset($token)
{
$key = self::getJwtKey();
$payload = JWT::decode($token, $key, array('HS256'));
$providerClass = $payload->provider;
$category = $payload->category;
$data = (array) $payload->data;
$provider = new $providerClass($category);... | php | public static function getAsset($token)
{
$key = self::getJwtKey();
$payload = JWT::decode($token, $key, array('HS256'));
$providerClass = $payload->provider;
$category = $payload->category;
$data = (array) $payload->data;
$provider = new $providerClass($category);... | [
"public",
"static",
"function",
"getAsset",
"(",
"$",
"token",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"getJwtKey",
"(",
")",
";",
"$",
"payload",
"=",
"JWT",
"::",
"decode",
"(",
"$",
"token",
",",
"$",
"key",
",",
"array",
"(",
"'HS256'",
")",
... | Recreates an asset from the data in the passed token.
@param $token
@return Asset
@throws AssetException | [
"Recreates",
"an",
"asset",
"from",
"the",
"data",
"in",
"the",
"passed",
"token",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/AssetCatalogueProvider.php#L165-L178 |
27,809 | RhubarbPHP/Rhubarb | src/Assets/AssetCatalogueProvider.php | AssetCatalogueProvider.getProvider | public static function getProvider($assetCategory = "")
{
if (isset(self::$providerMap[$assetCategory])) {
$class = self::$providerMap[$assetCategory];
} elseif (isset(self::$providerMap[""])){
$class = self::$providerMap[""];
} else {
throw new AssetExcep... | php | public static function getProvider($assetCategory = "")
{
if (isset(self::$providerMap[$assetCategory])) {
$class = self::$providerMap[$assetCategory];
} elseif (isset(self::$providerMap[""])){
$class = self::$providerMap[""];
} else {
throw new AssetExcep... | [
"public",
"static",
"function",
"getProvider",
"(",
"$",
"assetCategory",
"=",
"\"\"",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"providerMap",
"[",
"$",
"assetCategory",
"]",
")",
")",
"{",
"$",
"class",
"=",
"self",
"::",
"$",
"providerMa... | Returns an instance of the correct provider for a given category
@param string $assetCategory The category of provider - or empty for the default provider
@return AssetCatalogueProvider
@throws AssetException Thrown if a provider could not be found for the given category | [
"Returns",
"an",
"instance",
"of",
"the",
"correct",
"provider",
"for",
"a",
"given",
"category"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/AssetCatalogueProvider.php#L198-L211 |
27,810 | duncan3dc/cache | src/CacheKeyTrait.php | CacheKeyTrait.validateKey | protected function validateKey($key)
{
if (!is_string($key)) {
throw new CacheKeyException("Cache key must be a string, " . gettype($key) . " given");
}
if (preg_match("/[^A-Za-z0-9\._-]/", $key)) {
throw new CacheKeyException("Cache key contains invalid characters: ... | php | protected function validateKey($key)
{
if (!is_string($key)) {
throw new CacheKeyException("Cache key must be a string, " . gettype($key) . " given");
}
if (preg_match("/[^A-Za-z0-9\._-]/", $key)) {
throw new CacheKeyException("Cache key contains invalid characters: ... | [
"protected",
"function",
"validateKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"CacheKeyException",
"(",
"\"Cache key must be a string, \"",
".",
"gettype",
"(",
"$",
"key",
")",
".",
"\" giv... | Check the passed key to ensure it's a valid cache key.
@param string $key
@return void
@throws CacheKeyException | [
"Check",
"the",
"passed",
"key",
"to",
"ensure",
"it",
"s",
"a",
"valid",
"cache",
"key",
"."
] | 826c4ce2ed03c9df64aa8e0440b9e02b8c0f5eb0 | https://github.com/duncan3dc/cache/blob/826c4ce2ed03c9df64aa8e0440b9e02b8c0f5eb0/src/CacheKeyTrait.php#L21-L34 |
27,811 | duncan3dc/cache | src/SimpleCacheTrait.php | SimpleCacheTrait.set | public function set($key, $value, $ttl = null)
{
$item = new Item($key, $value);
if ($ttl !== null) {
$item->expiresAfter($ttl);
}
return $this->save($item);
} | php | public function set($key, $value, $ttl = null)
{
$item = new Item($key, $value);
if ($ttl !== null) {
$item->expiresAfter($ttl);
}
return $this->save($item);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"$",
"item",
"=",
"new",
"Item",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"if",
"(",
"$",
"ttl",
"!==",
"null",
")",
"{",
"$",
"it... | Persists data in the cache, uniquely referenced by a key.
@param string $key The key of the item to store
@param mixed $value The value of the item to store, must be serializable
@param \DateInterval|int|null $ttl The TTL value of this item
@return bool | [
"Persists",
"data",
"in",
"the",
"cache",
"uniquely",
"referenced",
"by",
"a",
"key",
"."
] | 826c4ce2ed03c9df64aa8e0440b9e02b8c0f5eb0 | https://github.com/duncan3dc/cache/blob/826c4ce2ed03c9df64aa8e0440b9e02b8c0f5eb0/src/SimpleCacheTrait.php#L41-L48 |
27,812 | RhubarbPHP/Rhubarb | src/Module.php | Module.getUrlHandlers | protected final function getUrlHandlers()
{
if (!$this->urlHandlersRegistered){
$this->registerUrlHandlers();
$this->urlHandlersRegistered = true;
}
return $this->urlHandlers;
} | php | protected final function getUrlHandlers()
{
if (!$this->urlHandlersRegistered){
$this->registerUrlHandlers();
$this->urlHandlersRegistered = true;
}
return $this->urlHandlers;
} | [
"protected",
"final",
"function",
"getUrlHandlers",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"urlHandlersRegistered",
")",
"{",
"$",
"this",
"->",
"registerUrlHandlers",
"(",
")",
";",
"$",
"this",
"->",
"urlHandlersRegistered",
"=",
"true",
";",
... | Get the finalised collection of url handlers for the module
@return UrlHandlers\UrlHandler[] | [
"Get",
"the",
"finalised",
"collection",
"of",
"url",
"handlers",
"for",
"the",
"module"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Module.php#L142-L150 |
27,813 | RhubarbPHP/Rhubarb | src/Sendables/Email/Email.php | Email.addAttachment | public function addAttachment($path, $newName = "")
{
if ($newName == "") {
$newName = basename($path);
}
$file = new \stdClass();
$file->path = $path;
$file->name = $newName;
$this->attachments[] = $file;
return $this;
} | php | public function addAttachment($path, $newName = "")
{
if ($newName == "") {
$newName = basename($path);
}
$file = new \stdClass();
$file->path = $path;
$file->name = $newName;
$this->attachments[] = $file;
return $this;
} | [
"public",
"function",
"addAttachment",
"(",
"$",
"path",
",",
"$",
"newName",
"=",
"\"\"",
")",
"{",
"if",
"(",
"$",
"newName",
"==",
"\"\"",
")",
"{",
"$",
"newName",
"=",
"basename",
"(",
"$",
"path",
")",
";",
"}",
"$",
"file",
"=",
"new",
"\\... | Adds an attachment
@param string $path The path to the local file
@param string $newName Optionally specify a new name for the file.
@return $this | [
"Adds",
"an",
"attachment"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Sendables/Email/Email.php#L46-L59 |
27,814 | RhubarbPHP/Rhubarb | src/Sendables/Email/Email.php | Email.getMimeDocument | public function getMimeDocument()
{
$textPart = false;
$htmlPart = false;
$html = $this->getHtml();
$text = $this->getText();
$subject = $this->getSubject();
/**
* @var string|bool Tracks which part should contain the text and html parts.
*/
... | php | public function getMimeDocument()
{
$textPart = false;
$htmlPart = false;
$html = $this->getHtml();
$text = $this->getText();
$subject = $this->getSubject();
/**
* @var string|bool Tracks which part should contain the text and html parts.
*/
... | [
"public",
"function",
"getMimeDocument",
"(",
")",
"{",
"$",
"textPart",
"=",
"false",
";",
"$",
"htmlPart",
"=",
"false",
";",
"$",
"html",
"=",
"$",
"this",
"->",
"getHtml",
"(",
")",
";",
"$",
"text",
"=",
"$",
"this",
"->",
"getText",
"(",
")",... | Gets a MimeDocument to represent this email.
@return MimeDocument | [
"Gets",
"a",
"MimeDocument",
"to",
"represent",
"this",
"email",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Sendables/Email/Email.php#L176-L239 |
27,815 | RhubarbPHP/Rhubarb | src/Sendables/Email/Email.php | Email.getMailHeaders | public function getMailHeaders()
{
$headers = [];
$html = $this->getHtml();
$text = $this->getText();
$subject = $this->getSubject();
if ($html != "" || count($this->attachments) > 0) {
$mime = new MimeDocument("multipart/alternative", crc32($html) . crc32($text... | php | public function getMailHeaders()
{
$headers = [];
$html = $this->getHtml();
$text = $this->getText();
$subject = $this->getSubject();
if ($html != "" || count($this->attachments) > 0) {
$mime = new MimeDocument("multipart/alternative", crc32($html) . crc32($text... | [
"public",
"function",
"getMailHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"$",
"html",
"=",
"$",
"this",
"->",
"getHtml",
"(",
")",
";",
"$",
"text",
"=",
"$",
"this",
"->",
"getText",
"(",
")",
";",
"$",
"subject",
"=",
"$",
"... | Returns the mail headers as an array of key value pairs.
@return array | [
"Returns",
"the",
"mail",
"headers",
"as",
"an",
"array",
"of",
"key",
"value",
"pairs",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Sendables/Email/Email.php#L274-L293 |
27,816 | rchouinard/bencode | src/Decoder.php | Decoder.doDecode | private function doDecode()
{
switch ($this->getChar()) {
case "i":
++$this->offset;
return $this->decodeInteger();
case "l":
++$this->offset;
return $this->decodeList();
case "d":
++$this-... | php | private function doDecode()
{
switch ($this->getChar()) {
case "i":
++$this->offset;
return $this->decodeInteger();
case "l":
++$this->offset;
return $this->decodeList();
case "d":
++$this-... | [
"private",
"function",
"doDecode",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getChar",
"(",
")",
")",
"{",
"case",
"\"i\"",
":",
"++",
"$",
"this",
"->",
"offset",
";",
"return",
"$",
"this",
"->",
"decodeInteger",
"(",
")",
";",
"case",
"\... | Iterate over encoded entities in the source string and decode them
@return mixed Returns the decoded value.
@throws RuntimeException | [
"Iterate",
"over",
"encoded",
"entities",
"in",
"the",
"source",
"string",
"and",
"decode",
"them"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Decoder.php#L101-L125 |
27,817 | rchouinard/bencode | src/Decoder.php | Decoder.decodeInteger | private function decodeInteger()
{
$offsetOfE = strpos($this->source, "e", $this->offset);
if (false === $offsetOfE) {
throw new RuntimeException("Unterminated integer entity at offset $this->offset");
}
$currentOffset = $this->offset;
if ("-" == $this->getChar($... | php | private function decodeInteger()
{
$offsetOfE = strpos($this->source, "e", $this->offset);
if (false === $offsetOfE) {
throw new RuntimeException("Unterminated integer entity at offset $this->offset");
}
$currentOffset = $this->offset;
if ("-" == $this->getChar($... | [
"private",
"function",
"decodeInteger",
"(",
")",
"{",
"$",
"offsetOfE",
"=",
"strpos",
"(",
"$",
"this",
"->",
"source",
",",
"\"e\"",
",",
"$",
"this",
"->",
"offset",
")",
";",
"if",
"(",
"false",
"===",
"$",
"offsetOfE",
")",
"{",
"throw",
"new",... | Decode a bencode encoded integer
@return integer Returns the decoded integer.
@throws RuntimeException | [
"Decode",
"a",
"bencode",
"encoded",
"integer"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Decoder.php#L133-L170 |
27,818 | rchouinard/bencode | src/Decoder.php | Decoder.decodeList | private function decodeList()
{
$list = array();
$terminated = false;
$listOffset = $this->offset;
while (false !== $this->getChar()) {
if ("e" == $this->getChar()) {
$terminated = true;
break;
}
$list[] = $this->d... | php | private function decodeList()
{
$list = array();
$terminated = false;
$listOffset = $this->offset;
while (false !== $this->getChar()) {
if ("e" == $this->getChar()) {
$terminated = true;
break;
}
$list[] = $this->d... | [
"private",
"function",
"decodeList",
"(",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";",
"$",
"terminated",
"=",
"false",
";",
"$",
"listOffset",
"=",
"$",
"this",
"->",
"offset",
";",
"while",
"(",
"false",
"!==",
"$",
"this",
"->",
"getChar",
... | Decode a bencode encoded list
@return array Returns the decoded array.
@throws RuntimeException | [
"Decode",
"a",
"bencode",
"encoded",
"list"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Decoder.php#L206-L228 |
27,819 | rchouinard/bencode | src/Decoder.php | Decoder.decodeDict | private function decodeDict()
{
$dict = array();
$terminated = false;
$dictOffset = $this->offset;
while (false !== $this->getChar()) {
if ("e" == $this->getChar()) {
$terminated = true;
break;
}
$keyOffset = $this... | php | private function decodeDict()
{
$dict = array();
$terminated = false;
$dictOffset = $this->offset;
while (false !== $this->getChar()) {
if ("e" == $this->getChar()) {
$terminated = true;
break;
}
$keyOffset = $this... | [
"private",
"function",
"decodeDict",
"(",
")",
"{",
"$",
"dict",
"=",
"array",
"(",
")",
";",
"$",
"terminated",
"=",
"false",
";",
"$",
"dictOffset",
"=",
"$",
"this",
"->",
"offset",
";",
"while",
"(",
"false",
"!==",
"$",
"this",
"->",
"getChar",
... | Decode a bencode encoded dictionary
@return array Returns the decoded array.
@throws RuntimeException | [
"Decode",
"a",
"bencode",
"encoded",
"dictionary"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Decoder.php#L236-L268 |
27,820 | rchouinard/bencode | src/Decoder.php | Decoder.getChar | private function getChar($offset = null)
{
if (null === $offset) {
$offset = $this->offset;
}
if (empty ($this->source) || $this->offset >= $this->sourceLength) {
return false;
}
return $this->source[$offset];
} | php | private function getChar($offset = null)
{
if (null === $offset) {
$offset = $this->offset;
}
if (empty ($this->source) || $this->offset >= $this->sourceLength) {
return false;
}
return $this->source[$offset];
} | [
"private",
"function",
"getChar",
"(",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"offset",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"offset",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"source",
")",
... | Fetch the character at the specified source offset
If offset is not provided, the current offset is used.
@param integer $offset The offset to retrieve from the source string.
@return string|false Returns the character found at the specified
offset. If the specified offset is out of range, FALSE is returned. | [
"Fetch",
"the",
"character",
"at",
"the",
"specified",
"source",
"offset"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Decoder.php#L279-L290 |
27,821 | RhubarbPHP/Rhubarb | src/Mime/MimePart.php | MimePart.getTransformedBody | final public function getTransformedBody()
{
$encoding = (isset($this->headers["Content-Transfer-Encoding"])) ? $this->headers["Content-Transfer-Encoding"] : "";
$rawBody = $this->getRawBody();
switch ($encoding) {
case "quoted-printable":
return quoted_printabl... | php | final public function getTransformedBody()
{
$encoding = (isset($this->headers["Content-Transfer-Encoding"])) ? $this->headers["Content-Transfer-Encoding"] : "";
$rawBody = $this->getRawBody();
switch ($encoding) {
case "quoted-printable":
return quoted_printabl... | [
"final",
"public",
"function",
"getTransformedBody",
"(",
")",
"{",
"$",
"encoding",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"\"Content-Transfer-Encoding\"",
"]",
")",
")",
"?",
"$",
"this",
"->",
"headers",
"[",
"\"Content-Transfer-Encoding... | Transforms the part as per the transform encoding header and returns the transformed result. | [
"Transforms",
"the",
"part",
"as",
"per",
"the",
"transform",
"encoding",
"header",
"and",
"returns",
"the",
"transformed",
"result",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Mime/MimePart.php#L70-L86 |
27,822 | RhubarbPHP/Rhubarb | src/Mime/MimePart.php | MimePart.setTransformedBody | final public function setTransformedBody($transformedBody)
{
$encoding = (isset($this->headers["Content-Transfer-Encoding"])) ? $this->headers["Content-Transfer-Encoding"] : "";
switch ($encoding) {
case "quoted-printable":
$this->setRawBody(quoted_printable_encode($tran... | php | final public function setTransformedBody($transformedBody)
{
$encoding = (isset($this->headers["Content-Transfer-Encoding"])) ? $this->headers["Content-Transfer-Encoding"] : "";
switch ($encoding) {
case "quoted-printable":
$this->setRawBody(quoted_printable_encode($tran... | [
"final",
"public",
"function",
"setTransformedBody",
"(",
"$",
"transformedBody",
")",
"{",
"$",
"encoding",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"\"Content-Transfer-Encoding\"",
"]",
")",
")",
"?",
"$",
"this",
"->",
"headers",
"[",
... | Takes a transformed body and turns it into the raw body string needed for the mime encoding.
@param $transformedBody | [
"Takes",
"a",
"transformed",
"body",
"and",
"turns",
"it",
"into",
"the",
"raw",
"body",
"string",
"needed",
"for",
"the",
"mime",
"encoding",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Mime/MimePart.php#L93-L107 |
27,823 | rchouinard/bencode | src/Encoder.php | Encoder.encode | public static function encode($data)
{
if (is_object($data)) {
if (method_exists($data, "toArray")) {
$data = $data->toArray();
} else {
$data = (array) $data;
}
}
$encoder = new self($data);
$encoded = $encoder->do... | php | public static function encode($data)
{
if (is_object($data)) {
if (method_exists($data, "toArray")) {
$data = $data->toArray();
} else {
$data = (array) $data;
}
}
$encoder = new self($data);
$encoded = $encoder->do... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"data",
",",
"\"toArray\"",
")",
")",
"{",
"$",
"data",
"=",
"$",
"data",
"->",
"... | Encode a value into a bencode encoded string
@param mixed $data The value to encode.
@return string Returns the bencode encoded string. | [
"Encode",
"a",
"value",
"into",
"a",
"bencode",
"encoded",
"string"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Encoder.php#L47-L61 |
27,824 | rchouinard/bencode | src/Encoder.php | Encoder.doEncode | private function doEncode($data = null)
{
$data = is_null($data) ? $this->data : $data;
if (is_array($data) && (isset ($data[0]) || empty ($data))) {
return $this->encodeList($data);
} elseif (is_array($data)) {
return $this->encodeDict($data);
} elseif (is_i... | php | private function doEncode($data = null)
{
$data = is_null($data) ? $this->data : $data;
if (is_array($data) && (isset ($data[0]) || empty ($data))) {
return $this->encodeList($data);
} elseif (is_array($data)) {
return $this->encodeDict($data);
} elseif (is_i... | [
"private",
"function",
"doEncode",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"is_null",
"(",
"$",
"data",
")",
"?",
"$",
"this",
"->",
"data",
":",
"$",
"data",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"&&",
"(",
"iss... | Iterate over values and encode them
@param mixed $data The value to encode.
@return string Returns the bencode encoded string. | [
"Iterate",
"over",
"values",
"and",
"encode",
"them"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Encoder.php#L69-L83 |
27,825 | rchouinard/bencode | src/Encoder.php | Encoder.encodeInteger | private function encodeInteger($data = null)
{
$data = is_null($data) ? $this->data : $data;
return sprintf("i%.0fe", $data);
} | php | private function encodeInteger($data = null)
{
$data = is_null($data) ? $this->data : $data;
return sprintf("i%.0fe", $data);
} | [
"private",
"function",
"encodeInteger",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"is_null",
"(",
"$",
"data",
")",
"?",
"$",
"this",
"->",
"data",
":",
"$",
"data",
";",
"return",
"sprintf",
"(",
"\"i%.0fe\"",
",",
"$",
"data",
")... | Encode an integer
@param integer $data The integer to be encoded.
@return string Returns the bencode encoded integer. | [
"Encode",
"an",
"integer"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Encoder.php#L91-L95 |
27,826 | rchouinard/bencode | src/Encoder.php | Encoder.encodeString | private function encodeString($data = null)
{
$data = is_null($data) ? $this->data : $data;
return sprintf("%d:%s", strlen($data), $data);
} | php | private function encodeString($data = null)
{
$data = is_null($data) ? $this->data : $data;
return sprintf("%d:%s", strlen($data), $data);
} | [
"private",
"function",
"encodeString",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"is_null",
"(",
"$",
"data",
")",
"?",
"$",
"this",
"->",
"data",
":",
"$",
"data",
";",
"return",
"sprintf",
"(",
"\"%d:%s\"",
",",
"strlen",
"(",
"$... | Encode a string
@param string $data The string to be encoded.
@return string Returns the bencode encoded string. | [
"Encode",
"a",
"string"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Encoder.php#L103-L107 |
27,827 | rchouinard/bencode | src/Encoder.php | Encoder.encodeList | private function encodeList(array $data = null)
{
$data = is_null($data) ? $this->data : $data;
$list = "";
foreach ($data as $value) {
$list .= $this->doEncode($value);
}
return "l{$list}e";
} | php | private function encodeList(array $data = null)
{
$data = is_null($data) ? $this->data : $data;
$list = "";
foreach ($data as $value) {
$list .= $this->doEncode($value);
}
return "l{$list}e";
} | [
"private",
"function",
"encodeList",
"(",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"is_null",
"(",
"$",
"data",
")",
"?",
"$",
"this",
"->",
"data",
":",
"$",
"data",
";",
"$",
"list",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
... | Encode a list
@param array $data The list to be encoded.
@return string Returns the bencode encoded list. | [
"Encode",
"a",
"list"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Encoder.php#L115-L125 |
27,828 | rchouinard/bencode | src/Encoder.php | Encoder.encodeDict | private function encodeDict(array $data = null)
{
$data = is_null($data) ? $this->data : $data;
ksort($data); // bencode spec requires dicts to be sorted alphabetically
$dict = "";
foreach ($data as $key => $value) {
$dict .= $this->encodeString($key) . $this->doEncode($... | php | private function encodeDict(array $data = null)
{
$data = is_null($data) ? $this->data : $data;
ksort($data); // bencode spec requires dicts to be sorted alphabetically
$dict = "";
foreach ($data as $key => $value) {
$dict .= $this->encodeString($key) . $this->doEncode($... | [
"private",
"function",
"encodeDict",
"(",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"is_null",
"(",
"$",
"data",
")",
"?",
"$",
"this",
"->",
"data",
":",
"$",
"data",
";",
"ksort",
"(",
"$",
"data",
")",
";",
"// bencode spec ... | Encode a dictionary
@param array $data The dictionary to be encoded.
@return string Returns the bencode encoded dictionary. | [
"Encode",
"a",
"dictionary"
] | 7caeb1d9823897701a5901369cfdc326696c679c | https://github.com/rchouinard/bencode/blob/7caeb1d9823897701a5901369cfdc326696c679c/src/Encoder.php#L133-L144 |
27,829 | RhubarbPHP/Rhubarb | src/Mime/MimeDocument.php | MimeDocument.fromString | public static function fromString($documentString)
{
$document = new MimeDocument($documentString);
$lines = explode("\n", $documentString);
$boundary = false;
$nextPartLines = [];
$firstBoundaryFound = false;
$mimeMessage = "";
foreach ($lines as $line) ... | php | public static function fromString($documentString)
{
$document = new MimeDocument($documentString);
$lines = explode("\n", $documentString);
$boundary = false;
$nextPartLines = [];
$firstBoundaryFound = false;
$mimeMessage = "";
foreach ($lines as $line) ... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"documentString",
")",
"{",
"$",
"document",
"=",
"new",
"MimeDocument",
"(",
"$",
"documentString",
")",
";",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"documentString",
")",
";",
"$",
... | Creates a document from a MIME string.
Note this currently only supports a single level of MIME - no nesting.
@param $documentString
@return MimeDocument | [
"Creates",
"a",
"document",
"from",
"a",
"MIME",
"string",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Mime/MimeDocument.php#L125-L176 |
27,830 | RhubarbPHP/Rhubarb | src/Html/ResourceLoader.php | ResourceLoader.addScriptCode | public static function addScriptCode($scriptCode, $dependantResourceUrls = [])
{
$dependantResourceUrls = array_unique($dependantResourceUrls);
self::$resources[] = [$scriptCode, $dependantResourceUrls];
} | php | public static function addScriptCode($scriptCode, $dependantResourceUrls = [])
{
$dependantResourceUrls = array_unique($dependantResourceUrls);
self::$resources[] = [$scriptCode, $dependantResourceUrls];
} | [
"public",
"static",
"function",
"addScriptCode",
"(",
"$",
"scriptCode",
",",
"$",
"dependantResourceUrls",
"=",
"[",
"]",
")",
"{",
"$",
"dependantResourceUrls",
"=",
"array_unique",
"(",
"$",
"dependantResourceUrls",
")",
";",
"self",
"::",
"$",
"resources",
... | Adds javascript script code to the collection
@param $scriptCode
@param array $dependantResourceUrls | [
"Adds",
"javascript",
"script",
"code",
"to",
"the",
"collection"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Html/ResourceLoader.php#L34-L39 |
27,831 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.addPropertyChangedNotificationHandler | final public function addPropertyChangedNotificationHandler($propertyNames, $callback)
{
if (!is_array($propertyNames)) {
$propertyNames = [$propertyNames];
}
foreach ($propertyNames as $propertyName) {
$this->propertyChangedCallbacks[$propertyName][] = $callback;
... | php | final public function addPropertyChangedNotificationHandler($propertyNames, $callback)
{
if (!is_array($propertyNames)) {
$propertyNames = [$propertyNames];
}
foreach ($propertyNames as $propertyName) {
$this->propertyChangedCallbacks[$propertyName][] = $callback;
... | [
"final",
"public",
"function",
"addPropertyChangedNotificationHandler",
"(",
"$",
"propertyNames",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"propertyNames",
")",
")",
"{",
"$",
"propertyNames",
"=",
"[",
"$",
"propertyNames",
"]",
... | When the named properties are changed, the callable method provided will be called and passed details of the change.
@param string|string[] $propertyNames The name of a property, or an array of property names
@param callable $callback A callable which will receive 3 parameters: $newValue, $propertyName, $oldValue | [
"When",
"the",
"named",
"properties",
"are",
"changed",
"the",
"callable",
"method",
"provided",
"will",
"be",
"called",
"and",
"passed",
"details",
"of",
"the",
"change",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L84-L93 |
27,832 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.setModelValue | final protected function setModelValue($propertyName, $value)
{
try {
$oldValue = (isset($this->modelData[$propertyName])) ? $this->modelData[$propertyName]: null;
} catch (\Exception $ex) {
// Catch any exceptions thrown when trying to retrieve the old value for the sake
... | php | final protected function setModelValue($propertyName, $value)
{
try {
$oldValue = (isset($this->modelData[$propertyName])) ? $this->modelData[$propertyName]: null;
} catch (\Exception $ex) {
// Catch any exceptions thrown when trying to retrieve the old value for the sake
... | [
"final",
"protected",
"function",
"setModelValue",
"(",
"$",
"propertyName",
",",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"oldValue",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"modelData",
"[",
"$",
"propertyName",
"]",
")",
")",
"?",
"$",
"this",
... | Sets a models property value while also raising property changed notifications if appropriate.
This should be used from setters instead of changing $this->modelData directly.
@param $propertyName
@param $value | [
"Sets",
"a",
"models",
"property",
"value",
"while",
"also",
"raising",
"property",
"changed",
"notifications",
"if",
"appropriate",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L123-L146 |
27,833 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.exportPublicData | final public function exportPublicData()
{
$publicProperties = $this->getPublicPropertyList();
$data = [];
foreach ($publicProperties as $property) {
if (isset($this[$property])) {
$data[$property] = $this[$property];
}
}
return $dat... | php | final public function exportPublicData()
{
$publicProperties = $this->getPublicPropertyList();
$data = [];
foreach ($publicProperties as $property) {
if (isset($this[$property])) {
$data[$property] = $this[$property];
}
}
return $dat... | [
"final",
"public",
"function",
"exportPublicData",
"(",
")",
"{",
"$",
"publicProperties",
"=",
"$",
"this",
"->",
"getPublicPropertyList",
"(",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"publicProperties",
"as",
"$",
"property",
")",... | Exports an array of model values that have been marked safe for public consumption.
@return array | [
"Exports",
"an",
"array",
"of",
"model",
"values",
"that",
"have",
"been",
"marked",
"safe",
"for",
"public",
"consumption",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L215-L228 |
27,834 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.importData | final public function importData($data)
{
foreach ($data as $property => $value) {
if ($this[$property] instanceof ModelState){
$this[$property]->importData($value);
} else {
$this[$property] = $value;
}
}
} | php | final public function importData($data)
{
foreach ($data as $property => $value) {
if ($this[$property] instanceof ModelState){
$this[$property]->importData($value);
} else {
$this[$property] = $value;
}
}
} | [
"final",
"public",
"function",
"importData",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"[",
"$",
"property",
"]",
"instanceof",
"ModelState",
")",
"{",
"$",
... | Imports an array of model values that have been marked safe for public consumption.
@param array $data | [
"Imports",
"an",
"array",
"of",
"model",
"values",
"that",
"have",
"been",
"marked",
"safe",
"for",
"public",
"consumption",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L262-L271 |
27,835 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.hasChanged | public function hasChanged()
{
foreach ($this->modelData as $property => $value) {
if ($this->hasPropertyChanged($property)) {
return true;
}
}
// In case model data has been manually unset
$manuallyUnsetProperties = array_diff_key($this->chan... | php | public function hasChanged()
{
foreach ($this->modelData as $property => $value) {
if ($this->hasPropertyChanged($property)) {
return true;
}
}
// In case model data has been manually unset
$manuallyUnsetProperties = array_diff_key($this->chan... | [
"public",
"function",
"hasChanged",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"modelData",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasPropertyChanged",
"(",
"$",
"property",
")",
")",
"{",
"return",
... | Returns true if the model has changed
@return bool | [
"Returns",
"true",
"if",
"the",
"model",
"has",
"changed"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L278-L296 |
27,836 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.takeChangeSnapshot | public function takeChangeSnapshot()
{
$this->changeSnapshotData = $this->modelData;
foreach ($this->changeSnapshotData as $key => $value) {
if (is_object($value)) {
$this->changeSnapshotData[$key] = clone $value;
}
}
return $this->changeSnap... | php | public function takeChangeSnapshot()
{
$this->changeSnapshotData = $this->modelData;
foreach ($this->changeSnapshotData as $key => $value) {
if (is_object($value)) {
$this->changeSnapshotData[$key] = clone $value;
}
}
return $this->changeSnap... | [
"public",
"function",
"takeChangeSnapshot",
"(",
")",
"{",
"$",
"this",
"->",
"changeSnapshotData",
"=",
"$",
"this",
"->",
"modelData",
";",
"foreach",
"(",
"$",
"this",
"->",
"changeSnapshotData",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"... | Takes a snapshot of the model data into change state data.
Essentially this resets the change status on the model object. HasChanged() should return
false after a call to this.
@return array | [
"Takes",
"a",
"snapshot",
"of",
"the",
"model",
"data",
"into",
"change",
"state",
"data",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L306-L317 |
27,837 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.importRawData | public function importRawData($data)
{
$this->modelData = $data;
foreach ($data as $propertyName => $item) {
if ($item instanceof ModelState) {
$this->attachChangeListenerToModelProperty($propertyName, $item);
}
}
// Make sure we can track ch... | php | public function importRawData($data)
{
$this->modelData = $data;
foreach ($data as $propertyName => $item) {
if ($item instanceof ModelState) {
$this->attachChangeListenerToModelProperty($propertyName, $item);
}
}
// Make sure we can track ch... | [
"public",
"function",
"importRawData",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"modelData",
"=",
"$",
"data",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"propertyName",
"=>",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"instanceof",
"Mode... | Imports raw model data into the model.
The data does not pass through any applicable Set methods or data transforms. If required to do so
call ImportData() instead, but understand the performance penalty of doing so.
@param array $data | [
"Imports",
"raw",
"model",
"data",
"into",
"the",
"model",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L423-L437 |
27,838 | RhubarbPHP/Rhubarb | src/Modelling/ModelState.php | ModelState.attachChangeListenerToModelProperty | private function attachChangeListenerToModelProperty($propertyName, ModelState $item)
{
$item->clearEventHandlers();
$item->attachEventHandler("AfterChange", function () use ($propertyName, $item) {
$this->raisePropertyChangedCallbacks($propertyName, $item, null);
});
} | php | private function attachChangeListenerToModelProperty($propertyName, ModelState $item)
{
$item->clearEventHandlers();
$item->attachEventHandler("AfterChange", function () use ($propertyName, $item) {
$this->raisePropertyChangedCallbacks($propertyName, $item, null);
});
} | [
"private",
"function",
"attachChangeListenerToModelProperty",
"(",
"$",
"propertyName",
",",
"ModelState",
"$",
"item",
")",
"{",
"$",
"item",
"->",
"clearEventHandlers",
"(",
")",
";",
"$",
"item",
"->",
"attachEventHandler",
"(",
"\"AfterChange\"",
",",
"functio... | Attaches a change listener to the model state item and raises a property changed notification when that happens.
@param $propertyName
@param ModelState $item | [
"Attaches",
"a",
"change",
"listener",
"to",
"the",
"model",
"state",
"item",
"and",
"raises",
"a",
"property",
"changed",
"notification",
"when",
"that",
"happens",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Modelling/ModelState.php#L445-L451 |
27,839 | RhubarbPHP/Rhubarb | src/DependencyInjection/Container.php | Container.getInstance | public final function getInstance($requestedClass, ...$arguments)
{
if (isset($this->singletons[$requestedClass])){
return $this->singletons[$requestedClass];
}
$useSingleton = false;
// Check for singletons first as they should trump previous registrations of non
... | php | public final function getInstance($requestedClass, ...$arguments)
{
if (isset($this->singletons[$requestedClass])){
return $this->singletons[$requestedClass];
}
$useSingleton = false;
// Check for singletons first as they should trump previous registrations of non
... | [
"public",
"final",
"function",
"getInstance",
"(",
"$",
"requestedClass",
",",
"...",
"$",
"arguments",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"singletons",
"[",
"$",
"requestedClass",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"si... | Creates an object instance of the requested class, optionally passing additional constructor arguments
@param $requestedClass
@param ...$arguments
@return mixed|object | [
"Creates",
"an",
"object",
"instance",
"of",
"the",
"requested",
"class",
"optionally",
"passing",
"additional",
"constructor",
"arguments"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/DependencyInjection/Container.php#L76-L115 |
27,840 | RhubarbPHP/Rhubarb | src/DependencyInjection/Container.php | Container.getSingleton | public function getSingleton($requestedClass, callable $singletonCreationCallback = null)
{
if (!isset($this->singletons[$requestedClass])){
if ($singletonCreationCallback){
$singleton = $singletonCreationCallback;
} else {
$singleton = $this->instance... | php | public function getSingleton($requestedClass, callable $singletonCreationCallback = null)
{
if (!isset($this->singletons[$requestedClass])){
if ($singletonCreationCallback){
$singleton = $singletonCreationCallback;
} else {
$singleton = $this->instance... | [
"public",
"function",
"getSingleton",
"(",
"$",
"requestedClass",
",",
"callable",
"$",
"singletonCreationCallback",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"singletons",
"[",
"$",
"requestedClass",
"]",
")",
")",
"{",
"if",... | Creates a singleton object instance of the requested class from the current DI container
@see getInstance()
@param $requestedClass
@param ...$arguments
@return mixed | [
"Creates",
"a",
"singleton",
"object",
"instance",
"of",
"the",
"requested",
"class",
"from",
"the",
"current",
"DI",
"container"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/DependencyInjection/Container.php#L151-L170 |
27,841 | glorpen/GlorpenPropelBundle | src/Services/OMClassOverrider.php | OMClassOverrider.getExtendedClass | public function getExtendedClass($class)
{
$ret = null;
if (array_key_exists($class, $this->dynamicClasses)) {
$ret = $this->dynamicClasses[$class];
}
if (!$ret) {
$ret = array_search($class, $this->classes);
}
return $ret?$ret:null;
} | php | public function getExtendedClass($class)
{
$ret = null;
if (array_key_exists($class, $this->dynamicClasses)) {
$ret = $this->dynamicClasses[$class];
}
if (!$ret) {
$ret = array_search($class, $this->classes);
}
return $ret?$ret:null;
} | [
"public",
"function",
"getExtendedClass",
"(",
"$",
"class",
")",
"{",
"$",
"ret",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"dynamicClasses",
")",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"dynam... | Returns base class
@param string $class
@return string | [
"Returns",
"base",
"class"
] | b679c83377c81ab582de179f84bc23eaeb1e86aa | https://github.com/glorpen/GlorpenPropelBundle/blob/b679c83377c81ab582de179f84bc23eaeb1e86aa/src/Services/OMClassOverrider.php#L59-L69 |
27,842 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.reset | protected function reset()
{
$this->element = null;
$this->arguments = [];
$this->methods = [];
$this->cloneElement = false;
$this->translatableIndicator = false;
return $this;
} | php | protected function reset()
{
$this->element = null;
$this->arguments = [];
$this->methods = [];
$this->cloneElement = false;
$this->translatableIndicator = false;
return $this;
} | [
"protected",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"element",
"=",
"null",
";",
"$",
"this",
"->",
"arguments",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"methods",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"cloneElement",
"=",
"false",
... | Resets the properties.
@return $this | [
"Resets",
"the",
"properties",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L171-L180 |
27,843 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.locales | public function locales(array $locales = null)
{
return is_null($locales)
? $this->locales
: ($this->locales = $locales);
} | php | public function locales(array $locales = null)
{
return is_null($locales)
? $this->locales
: ($this->locales = $locales);
} | [
"public",
"function",
"locales",
"(",
"array",
"$",
"locales",
"=",
"null",
")",
"{",
"return",
"is_null",
"(",
"$",
"locales",
")",
"?",
"$",
"this",
"->",
"locales",
":",
"(",
"$",
"this",
"->",
"locales",
"=",
"$",
"locales",
")",
";",
"}"
] | Get or set the available locales.
@param array|null $locales
@return array | [
"Get",
"or",
"set",
"the",
"available",
"locales",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L189-L194 |
27,844 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.element | protected function element($element = null)
{
return is_null($element)
? $this->element
: ($this->element = $element);
} | php | protected function element($element = null)
{
return is_null($element)
? $this->element
: ($this->element = $element);
} | [
"protected",
"function",
"element",
"(",
"$",
"element",
"=",
"null",
")",
"{",
"return",
"is_null",
"(",
"$",
"element",
")",
"?",
"$",
"this",
"->",
"element",
":",
"(",
"$",
"this",
"->",
"element",
"=",
"$",
"element",
")",
";",
"}"
] | Get or set the current element.
@param string|null $element
@return string | [
"Get",
"or",
"set",
"the",
"current",
"element",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L203-L208 |
27,845 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.arguments | protected function arguments(array $arguments = null)
{
return is_null($arguments)
? $this->arguments
: ($this->arguments = $arguments);
} | php | protected function arguments(array $arguments = null)
{
return is_null($arguments)
? $this->arguments
: ($this->arguments = $arguments);
} | [
"protected",
"function",
"arguments",
"(",
"array",
"$",
"arguments",
"=",
"null",
")",
"{",
"return",
"is_null",
"(",
"$",
"arguments",
")",
"?",
"$",
"this",
"->",
"arguments",
":",
"(",
"$",
"this",
"->",
"arguments",
"=",
"$",
"arguments",
")",
";"... | Get or set the arguments.
@param array|null $arguments
@return array | [
"Get",
"or",
"set",
"the",
"arguments",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L217-L222 |
27,846 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.methods | protected function methods(array $methods = null)
{
return is_null($methods)
? $this->methods
: ($this->methods = $methods);
} | php | protected function methods(array $methods = null)
{
return is_null($methods)
? $this->methods
: ($this->methods = $methods);
} | [
"protected",
"function",
"methods",
"(",
"array",
"$",
"methods",
"=",
"null",
")",
"{",
"return",
"is_null",
"(",
"$",
"methods",
")",
"?",
"$",
"this",
"->",
"methods",
":",
"(",
"$",
"this",
"->",
"methods",
"=",
"$",
"methods",
")",
";",
"}"
] | Get or set the methods.
@param array|null $methods
@return array | [
"Get",
"or",
"set",
"the",
"methods",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L231-L236 |
27,847 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.translatableIndicator | protected function translatableIndicator($add = null)
{
return is_null($add)
? $this->translatableIndicator
: ($this->translatableIndicator = (bool) $add);
} | php | protected function translatableIndicator($add = null)
{
return is_null($add)
? $this->translatableIndicator
: ($this->translatableIndicator = (bool) $add);
} | [
"protected",
"function",
"translatableIndicator",
"(",
"$",
"add",
"=",
"null",
")",
"{",
"return",
"is_null",
"(",
"$",
"add",
")",
"?",
"$",
"this",
"->",
"translatableIndicator",
":",
"(",
"$",
"this",
"->",
"translatableIndicator",
"=",
"(",
"bool",
")... | Get or set the translatable indicator boolean.
@param bool|null $add
@return bool | [
"Get",
"or",
"set",
"the",
"translatable",
"indicator",
"boolean",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L259-L264 |
27,848 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.overwriteArgument | protected function overwriteArgument($argument, $value)
{
$arguments = $this->arguments();
$arguments[$argument] = $value;
$this->arguments($arguments);
} | php | protected function overwriteArgument($argument, $value)
{
$arguments = $this->arguments();
$arguments[$argument] = $value;
$this->arguments($arguments);
} | [
"protected",
"function",
"overwriteArgument",
"(",
"$",
"argument",
",",
"$",
"value",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"arguments",
"(",
")",
";",
"$",
"arguments",
"[",
"$",
"argument",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"... | Overwrites an argument.
@param string $argument
@param string|array $value | [
"Overwrites",
"an",
"argument",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L272-L279 |
27,849 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.addMethod | protected function addMethod($name, $parameters)
{
$methods = $this->methods();
$parameters = is_array($parameters) ? $parameters : [$parameters];
$methods[] = compact('name', 'parameters');
$this->methods($methods);
} | php | protected function addMethod($name, $parameters)
{
$methods = $this->methods();
$parameters = is_array($parameters) ? $parameters : [$parameters];
$methods[] = compact('name', 'parameters');
$this->methods($methods);
} | [
"protected",
"function",
"addMethod",
"(",
"$",
"name",
",",
"$",
"parameters",
")",
"{",
"$",
"methods",
"=",
"$",
"this",
"->",
"methods",
"(",
")",
";",
"$",
"parameters",
"=",
"is_array",
"(",
"$",
"parameters",
")",
"?",
"$",
"parameters",
":",
... | Adds a method.
@param string $name
@param string|array $parameters | [
"Adds",
"a",
"method",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L287-L296 |
27,850 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.createInput | protected function createInput($currentLocale = null)
{
// Create element using arguments.
$element = call_user_func_array([$this->form, $this->element()], array_values($this->arguments()));
// Elements such as 'bind' do not return renderable stuff and do not accept methods.
if ($el... | php | protected function createInput($currentLocale = null)
{
// Create element using arguments.
$element = call_user_func_array([$this->form, $this->element()], array_values($this->arguments()));
// Elements such as 'bind' do not return renderable stuff and do not accept methods.
if ($el... | [
"protected",
"function",
"createInput",
"(",
"$",
"currentLocale",
"=",
"null",
")",
"{",
"// Create element using arguments.",
"$",
"element",
"=",
"call_user_func_array",
"(",
"[",
"$",
"this",
"->",
"form",
",",
"$",
"this",
"->",
"element",
"(",
")",
"]",
... | Creates an input element using the supplied arguments and methods.
@param string|null $currentLocale
@return mixed | [
"Creates",
"an",
"input",
"element",
"using",
"the",
"supplied",
"arguments",
"and",
"methods",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L361-L394 |
27,851 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.applyElementBehavior | protected function applyElementBehavior()
{
$behaviors = isset($this->elementBehaviors[$this->element()]) ? $this->elementBehaviors[$this->element()] : [];
foreach ($behaviors as $behavior) {
$this->{$behavior}(true);
}
} | php | protected function applyElementBehavior()
{
$behaviors = isset($this->elementBehaviors[$this->element()]) ? $this->elementBehaviors[$this->element()] : [];
foreach ($behaviors as $behavior) {
$this->{$behavior}(true);
}
} | [
"protected",
"function",
"applyElementBehavior",
"(",
")",
"{",
"$",
"behaviors",
"=",
"isset",
"(",
"$",
"this",
"->",
"elementBehaviors",
"[",
"$",
"this",
"->",
"element",
"(",
")",
"]",
")",
"?",
"$",
"this",
"->",
"elementBehaviors",
"[",
"$",
"this... | Add specific element behavior to the current translatable form element. | [
"Add",
"specific",
"element",
"behavior",
"to",
"the",
"current",
"translatable",
"form",
"element",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L418-L425 |
27,852 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.mapArguments | protected function mapArguments(array $arguments)
{
$keys = isset($this->mappableArguments[$this->element()]) ? $this->mappableArguments[$this->element()] : [];
return array_combine(array_slice($keys, 0, count($arguments)), $arguments);
} | php | protected function mapArguments(array $arguments)
{
$keys = isset($this->mappableArguments[$this->element()]) ? $this->mappableArguments[$this->element()] : [];
return array_combine(array_slice($keys, 0, count($arguments)), $arguments);
} | [
"protected",
"function",
"mapArguments",
"(",
"array",
"$",
"arguments",
")",
"{",
"$",
"keys",
"=",
"isset",
"(",
"$",
"this",
"->",
"mappableArguments",
"[",
"$",
"this",
"->",
"element",
"(",
")",
"]",
")",
"?",
"$",
"this",
"->",
"mappableArguments",... | Maps the form element arguments to their name.
@param array $arguments
@return array | [
"Maps",
"the",
"form",
"element",
"arguments",
"to",
"their",
"name",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L434-L439 |
27,853 | TypiCMS/Laravel-Translatable-Bootforms | src/TranslatableBootForm.php | TranslatableBootForm.setTranslatableLabelIndicator | protected function setTranslatableLabelIndicator($locale)
{
$localizedLabel = str_replace('%label', $this->arguments()['label'], $this->config['label-locale-indicator']);
$this->overwriteArgument('label', str_replace('%locale', $locale, $localizedLabel));
} | php | protected function setTranslatableLabelIndicator($locale)
{
$localizedLabel = str_replace('%label', $this->arguments()['label'], $this->config['label-locale-indicator']);
$this->overwriteArgument('label', str_replace('%locale', $locale, $localizedLabel));
} | [
"protected",
"function",
"setTranslatableLabelIndicator",
"(",
"$",
"locale",
")",
"{",
"$",
"localizedLabel",
"=",
"str_replace",
"(",
"'%label'",
",",
"$",
"this",
"->",
"arguments",
"(",
")",
"[",
"'label'",
"]",
",",
"$",
"this",
"->",
"config",
"[",
"... | Add a locale indicator to the label.
@param string $locale | [
"Add",
"a",
"locale",
"indicator",
"to",
"the",
"label",
"."
] | c1c877cff1aed4b8a827fc6b064bfb7832a423ec | https://github.com/TypiCMS/Laravel-Translatable-Bootforms/blob/c1c877cff1aed4b8a827fc6b064bfb7832a423ec/src/TranslatableBootForm.php#L446-L450 |
27,854 | RhubarbPHP/Rhubarb | src/Deployment/ResourceDeploymentPackage.php | ResourceDeploymentPackage.getDeployedUrls | public function getDeployedUrls()
{
$deploymentHandler = ResourceDeploymentProvider::getProvider();
$urls = [];
foreach ($this->resourcesToDeploy as $path) {
$urls[] = $deploymentHandler->getDeployedResourceUrl($path);
}
return $urls;
} | php | public function getDeployedUrls()
{
$deploymentHandler = ResourceDeploymentProvider::getProvider();
$urls = [];
foreach ($this->resourcesToDeploy as $path) {
$urls[] = $deploymentHandler->getDeployedResourceUrl($path);
}
return $urls;
} | [
"public",
"function",
"getDeployedUrls",
"(",
")",
"{",
"$",
"deploymentHandler",
"=",
"ResourceDeploymentProvider",
"::",
"getProvider",
"(",
")",
";",
"$",
"urls",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"resourcesToDeploy",
"as",
"$",
"path... | Returns the urls with which the resources can be accessed after deployment. | [
"Returns",
"the",
"urls",
"with",
"which",
"the",
"resources",
"can",
"be",
"accessed",
"after",
"deployment",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Deployment/ResourceDeploymentPackage.php#L33-L44 |
27,855 | RhubarbPHP/Rhubarb | src/Application.php | Application.registerModule | public final function registerModule(Module $module)
{
$dependencies = $module->getModules();
foreach($dependencies as $dependency){
$this->registerModule($dependency);
}
$this->modules[$module->getModuleName()] = $module;
} | php | public final function registerModule(Module $module)
{
$dependencies = $module->getModules();
foreach($dependencies as $dependency){
$this->registerModule($dependency);
}
$this->modules[$module->getModuleName()] = $module;
} | [
"public",
"final",
"function",
"registerModule",
"(",
"Module",
"$",
"module",
")",
"{",
"$",
"dependencies",
"=",
"$",
"module",
"->",
"getModules",
"(",
")",
";",
"foreach",
"(",
"$",
"dependencies",
"as",
"$",
"dependency",
")",
"{",
"$",
"this",
"->"... | Register a module with the application.
Also registers the dependencies of the application also
@param Module $module | [
"Register",
"a",
"module",
"with",
"the",
"application",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Application.php#L214-L223 |
27,856 | RhubarbPHP/Rhubarb | src/Application.php | Application.filterUrlHandlers | public final function filterUrlHandlers($handlerSet)
{
$filteredHandlers = [];
foreach ($handlerSet as $handlers) {
$filteredHandlers = array_merge($filteredHandlers, $handlers);
}
uasort($filteredHandlers, function (UrlHandler $a, UrlHandler $b) {
$aPriorit... | php | public final function filterUrlHandlers($handlerSet)
{
$filteredHandlers = [];
foreach ($handlerSet as $handlers) {
$filteredHandlers = array_merge($filteredHandlers, $handlers);
}
uasort($filteredHandlers, function (UrlHandler $a, UrlHandler $b) {
$aPriorit... | [
"public",
"final",
"function",
"filterUrlHandlers",
"(",
"$",
"handlerSet",
")",
"{",
"$",
"filteredHandlers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"handlerSet",
"as",
"$",
"handlers",
")",
"{",
"$",
"filteredHandlers",
"=",
"array_merge",
"(",
"$",
"f... | Get's an array of url handlers from all registered modules.
@param UrlHandler[] $handlerSet
@return UrlHandler[] | [
"Get",
"s",
"an",
"array",
"of",
"url",
"handlers",
"from",
"all",
"registered",
"modules",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Application.php#L239-L259 |
27,857 | RhubarbPHP/Rhubarb | src/Application.php | Application.initialiseModules | public final function initialiseModules()
{
foreach ($this->modules as $module) {
$module->initialiseModule();
}
// Initialise the application 'module' itself.
$this->initialiseModule();
$handlers = [];
foreach ($this->modules as $module) {
$... | php | public final function initialiseModules()
{
foreach ($this->modules as $module) {
$module->initialiseModule();
}
// Initialise the application 'module' itself.
$this->initialiseModule();
$handlers = [];
foreach ($this->modules as $module) {
$... | [
"public",
"final",
"function",
"initialiseModules",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"modules",
"as",
"$",
"module",
")",
"{",
"$",
"module",
"->",
"initialiseModule",
"(",
")",
";",
"}",
"// Initialise the application 'module' itself.",
"$",
... | Asks all modules to initialise.
Called automatically when processing requests. | [
"Asks",
"all",
"modules",
"to",
"initialise",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Application.php#L266-L281 |
27,858 | RhubarbPHP/Rhubarb | src/Application.php | Application.getAllResponseFilters | private function getAllResponseFilters($preResponse = false)
{
$filters = [];
foreach ($this->modules as $module) {
$moduleFilters = $module->getResponseFilters();
foreach($moduleFilters as $filter){
if ($preResponse && $filter->isPreResponse()){
... | php | private function getAllResponseFilters($preResponse = false)
{
$filters = [];
foreach ($this->modules as $module) {
$moduleFilters = $module->getResponseFilters();
foreach($moduleFilters as $filter){
if ($preResponse && $filter->isPreResponse()){
... | [
"private",
"function",
"getAllResponseFilters",
"(",
"$",
"preResponse",
"=",
"false",
")",
"{",
"$",
"filters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"modules",
"as",
"$",
"module",
")",
"{",
"$",
"moduleFilters",
"=",
"$",
"module",
... | Get's an array of response filters from all registered modules.
@return \Rhubarb\Crown\ResponseFilters\ResponseFilter[] | [
"Get",
"s",
"an",
"array",
"of",
"response",
"filters",
"from",
"all",
"registered",
"modules",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Application.php#L288-L306 |
27,859 | zibios/wrike-php-guzzle | src/Client/GuzzleClient.php | GuzzleClient.executeRequestForParams | public function executeRequestForParams(
string $requestMethod,
string $path,
array $params,
string $accessToken
): ResponseInterface {
RequestMethodEnum::assertIsValidValue($requestMethod);
$options = $this->calculateOptionsForParams($requestMethod, $params, $accessT... | php | public function executeRequestForParams(
string $requestMethod,
string $path,
array $params,
string $accessToken
): ResponseInterface {
RequestMethodEnum::assertIsValidValue($requestMethod);
$options = $this->calculateOptionsForParams($requestMethod, $params, $accessT... | [
"public",
"function",
"executeRequestForParams",
"(",
"string",
"$",
"requestMethod",
",",
"string",
"$",
"path",
",",
"array",
"$",
"params",
",",
"string",
"$",
"accessToken",
")",
":",
"ResponseInterface",
"{",
"RequestMethodEnum",
"::",
"assertIsValidValue",
"... | Request method.
Generic format for HTTP client request method.
@param string $requestMethod GET/POST/PUT/DELETE
@param string $path full path to REST resource without domain, ex. 'contacts'
@param array $params optional params for GET/POST request
@param string $accessToken Access Token for Wrike a... | [
"Request",
"method",
"."
] | 957319ba26020b207e756699708e865d61b7da2f | https://github.com/zibios/wrike-php-guzzle/blob/957319ba26020b207e756699708e865d61b7da2f/src/Client/GuzzleClient.php#L47-L60 |
27,860 | zibios/wrike-php-guzzle | src/Client/GuzzleClient.php | GuzzleClient.calculateOptionsForParams | protected function calculateOptionsForParams(string $requestMethod, array $params, string $accessToken): array
{
$options = $this->prepareBaseOptions($accessToken);
if (0 === \count($params)) {
return $options;
}
switch ($requestMethod) {
case RequestMethodEn... | php | protected function calculateOptionsForParams(string $requestMethod, array $params, string $accessToken): array
{
$options = $this->prepareBaseOptions($accessToken);
if (0 === \count($params)) {
return $options;
}
switch ($requestMethod) {
case RequestMethodEn... | [
"protected",
"function",
"calculateOptionsForParams",
"(",
"string",
"$",
"requestMethod",
",",
"array",
"$",
"params",
",",
"string",
"$",
"accessToken",
")",
":",
"array",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"prepareBaseOptions",
"(",
"$",
"accessTo... | Main method for calculating request params.
@param string $requestMethod
@param array $params
@param string $accessToken
@throws \InvalidArgumentException
@return array | [
"Main",
"method",
"for",
"calculating",
"request",
"params",
"."
] | 957319ba26020b207e756699708e865d61b7da2f | https://github.com/zibios/wrike-php-guzzle/blob/957319ba26020b207e756699708e865d61b7da2f/src/Client/GuzzleClient.php#L73-L105 |
27,861 | mediact/testing-suite | src/Installer/PackagesInstaller.php | PackagesInstaller.isPackageRequired | private function isPackageRequired(string $packageName): bool
{
foreach ($this->composer->getPackage()->getRequires() as $require) {
if ($require->getTarget() === $packageName) {
return true;
}
}
return false;
} | php | private function isPackageRequired(string $packageName): bool
{
foreach ($this->composer->getPackage()->getRequires() as $require) {
if ($require->getTarget() === $packageName) {
return true;
}
}
return false;
} | [
"private",
"function",
"isPackageRequired",
"(",
"string",
"$",
"packageName",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
"->",
"getRequires",
"(",
")",
"as",
"$",
"require",
")",
"{",
"if",
"(",
... | Whether a package has been required.
@param string $packageName
@return bool | [
"Whether",
"a",
"package",
"has",
"been",
"required",
"."
] | 98614fe3b5c174e9bda2ff88d36d30349094dbc2 | https://github.com/mediact/testing-suite/blob/98614fe3b5c174e9bda2ff88d36d30349094dbc2/src/Installer/PackagesInstaller.php#L101-L110 |
27,862 | byjg/cache-engine-php | src/Psr6/CachePool.php | CachePool.addElementToBuffer | protected function addElementToBuffer(CacheItem $cacheItem)
{
if ($this->bufferSize < 1) {
return;
}
$key = $cacheItem->getKey();
$this->buffer[$key] = $cacheItem;
if (in_array($key, $this->bufferKeys)) {
return;
}
array_push($this->... | php | protected function addElementToBuffer(CacheItem $cacheItem)
{
if ($this->bufferSize < 1) {
return;
}
$key = $cacheItem->getKey();
$this->buffer[$key] = $cacheItem;
if (in_array($key, $this->bufferKeys)) {
return;
}
array_push($this->... | [
"protected",
"function",
"addElementToBuffer",
"(",
"CacheItem",
"$",
"cacheItem",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bufferSize",
"<",
"1",
")",
"{",
"return",
";",
"}",
"$",
"key",
"=",
"$",
"cacheItem",
"->",
"getKey",
"(",
")",
";",
"$",
"t... | Add an element to buffer. If the buffer is full, the first element added will be removed
@param CacheItem $cacheItem | [
"Add",
"an",
"element",
"to",
"buffer",
".",
"If",
"the",
"buffer",
"is",
"full",
"the",
"first",
"element",
"added",
"will",
"be",
"removed"
] | 001281edc3be6d908e7865b836cb6b43bd61a5cc | https://github.com/byjg/cache-engine-php/blob/001281edc3be6d908e7865b836cb6b43bd61a5cc/src/Psr6/CachePool.php#L71-L90 |
27,863 | byjg/cache-engine-php | src/Psr6/CachePool.php | CachePool.removeElementFromBuffer | protected function removeElementFromBuffer($key)
{
$result = array_search($key, $this->bufferKeys);
if ($result === false) {
return;
}
unset($this->buffer[$key]);
unset($this->bufferKeys[$result]);
} | php | protected function removeElementFromBuffer($key)
{
$result = array_search($key, $this->bufferKeys);
if ($result === false) {
return;
}
unset($this->buffer[$key]);
unset($this->bufferKeys[$result]);
} | [
"protected",
"function",
"removeElementFromBuffer",
"(",
"$",
"key",
")",
"{",
"$",
"result",
"=",
"array_search",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"bufferKeys",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"return",
";",
"}",
... | Remove a specific key from buffer
@param $key | [
"Remove",
"a",
"specific",
"key",
"from",
"buffer"
] | 001281edc3be6d908e7865b836cb6b43bd61a5cc | https://github.com/byjg/cache-engine-php/blob/001281edc3be6d908e7865b836cb6b43bd61a5cc/src/Psr6/CachePool.php#L97-L106 |
27,864 | RhubarbPHP/Rhubarb | src/UrlHandlers/NamespaceMappedUrlHandler.php | NamespaceMappedUrlHandler.onNoTargetFound | protected function onNoTargetFound($request, $currentUrlFragment = "")
{
if (self::$onTargetNotFoundExecuting) {
return false;
}
self::$onTargetNotFoundExecuting = true;
// Try generating a response for the url with /index on the end.
// Note that we don't try /... | php | protected function onNoTargetFound($request, $currentUrlFragment = "")
{
if (self::$onTargetNotFoundExecuting) {
return false;
}
self::$onTargetNotFoundExecuting = true;
// Try generating a response for the url with /index on the end.
// Note that we don't try /... | [
"protected",
"function",
"onNoTargetFound",
"(",
"$",
"request",
",",
"$",
"currentUrlFragment",
"=",
"\"\"",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"onTargetNotFoundExecuting",
")",
"{",
"return",
"false",
";",
"}",
"self",
"::",
"$",
"onTargetNotFoundExecut... | Override this to provide a default response in the event that no action could be found.
@param \Rhubarb\Crown\Request\Request $request The original request we tried to find a target for.
@param $currentUrlFragment
@return bool|string | [
"Override",
"this",
"to",
"provide",
"a",
"default",
"response",
"in",
"the",
"event",
"that",
"no",
"action",
"could",
"be",
"found",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/UrlHandlers/NamespaceMappedUrlHandler.php#L143-L166 |
27,865 | RhubarbPHP/Rhubarb | src/Events/Event.php | Event.attachHandler | public function attachHandler(callable $handler, $key = null)
{
if ($key !== null) {
$this->eventHandlers[$key] = $handler;
} else {
$this->eventHandlers[] = $handler;
}
} | php | public function attachHandler(callable $handler, $key = null)
{
if ($key !== null) {
$this->eventHandlers[$key] = $handler;
} else {
$this->eventHandlers[] = $handler;
}
} | [
"public",
"function",
"attachHandler",
"(",
"callable",
"$",
"handler",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"eventHandlers",
"[",
"$",
"key",
"]",
"=",
"$",
"handler",
";",
"}",... | Attach an event handler
@param callable $handler
@param string $key An optional unique identifier for the handler in case you wish to specifically remove it later | [
"Attach",
"an",
"event",
"handler"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Events/Event.php#L31-L38 |
27,866 | RhubarbPHP/Rhubarb | src/Events/Event.php | Event.raise | public function raise(...$arguments)
{
$firstResponse = null;
/** @var callable $callBack */
$callBack = false;
$count = count($arguments);
if ($count > 0 && is_object($arguments[$count - 1]) && is_callable($arguments[$count - 1])) {
$callBack = $arguments[$coun... | php | public function raise(...$arguments)
{
$firstResponse = null;
/** @var callable $callBack */
$callBack = false;
$count = count($arguments);
if ($count > 0 && is_object($arguments[$count - 1]) && is_callable($arguments[$count - 1])) {
$callBack = $arguments[$coun... | [
"public",
"function",
"raise",
"(",
"...",
"$",
"arguments",
")",
"{",
"$",
"firstResponse",
"=",
"null",
";",
"/** @var callable $callBack */",
"$",
"callBack",
"=",
"false",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"arguments",
")",
";",
"if",
"(",
"... | Call all handlers for the event with the passed arguments.
If there are multiple event handlers, this will return the earliest non-null response from the handlers.
If you need to receive response data from multiple handlers, you can pass a callback function as the last argument.
The callback function will only be calle... | [
"Call",
"all",
"handlers",
"for",
"the",
"event",
"with",
"the",
"passed",
"arguments",
".",
"If",
"there",
"are",
"multiple",
"event",
"handlers",
"this",
"will",
"return",
"the",
"earliest",
"non",
"-",
"null",
"response",
"from",
"the",
"handlers",
".",
... | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Events/Event.php#L49-L77 |
27,867 | RhubarbPHP/Rhubarb | src/Events/Event.php | Event.removeHandler | public function removeHandler(callable $handler)
{
$key = array_search($handler, $this->eventHandlers, true);
if ($key !== false) {
unset($this->eventHandlers[$key]);
}
} | php | public function removeHandler(callable $handler)
{
$key = array_search($handler, $this->eventHandlers, true);
if ($key !== false) {
unset($this->eventHandlers[$key]);
}
} | [
"public",
"function",
"removeHandler",
"(",
"callable",
"$",
"handler",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"handler",
",",
"$",
"this",
"->",
"eventHandlers",
",",
"true",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"... | Removes a specific handler. You must pass a reference to the same handler you originally attached.
@param callable $handler | [
"Removes",
"a",
"specific",
"handler",
".",
"You",
"must",
"pass",
"a",
"reference",
"to",
"the",
"same",
"handler",
"you",
"originally",
"attached",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Events/Event.php#L102-L109 |
27,868 | mediact/testing-suite | src/MappingResolver.php | MappingResolver.resolve | public function resolve(): FileMappingReaderInterface
{
$files = [
__DIR__ . '/../templates/mapping/files',
sprintf(
__DIR__ . '/../templates/mapping/project/%s',
$this->typeResolver->resolve()
)
];
return new UnixFileMappi... | php | public function resolve(): FileMappingReaderInterface
{
$files = [
__DIR__ . '/../templates/mapping/files',
sprintf(
__DIR__ . '/../templates/mapping/project/%s',
$this->typeResolver->resolve()
)
];
return new UnixFileMappi... | [
"public",
"function",
"resolve",
"(",
")",
":",
"FileMappingReaderInterface",
"{",
"$",
"files",
"=",
"[",
"__DIR__",
".",
"'/../templates/mapping/files'",
",",
"sprintf",
"(",
"__DIR__",
".",
"'/../templates/mapping/project/%s'",
",",
"$",
"this",
"->",
"typeResolv... | Resolve mapping files.
@return FileMappingReaderInterface | [
"Resolve",
"mapping",
"files",
"."
] | 98614fe3b5c174e9bda2ff88d36d30349094dbc2 | https://github.com/mediact/testing-suite/blob/98614fe3b5c174e9bda2ff88d36d30349094dbc2/src/MappingResolver.php#L32-L47 |
27,869 | RhubarbPHP/Rhubarb | src/Xml/NodeStrategyCollation.php | NodeStrategyCollation.processNode | protected function processNode( Node $node, \XMLReader $xmlReader )
{
$node = parent::processNode( $node, $xmlReader );
$children = [ ];
if( !$xmlReader->isEmptyElement )
{
$scanner = new NodeStrategyTraversal();
$scanner->addNodeHandler( '*', new self( funct... | php | protected function processNode( Node $node, \XMLReader $xmlReader )
{
$node = parent::processNode( $node, $xmlReader );
$children = [ ];
if( !$xmlReader->isEmptyElement )
{
$scanner = new NodeStrategyTraversal();
$scanner->addNodeHandler( '*', new self( funct... | [
"protected",
"function",
"processNode",
"(",
"Node",
"$",
"node",
",",
"\\",
"XMLReader",
"$",
"xmlReader",
")",
"{",
"$",
"node",
"=",
"parent",
"::",
"processNode",
"(",
"$",
"node",
",",
"$",
"xmlReader",
")",
";",
"$",
"children",
"=",
"[",
"]",
... | The collation strategy should to collate all child nodes before callback
@param Node $node
@param \XMLReader $xmlReader
@return Node The node with children collated will be passed to the callback | [
"The",
"collation",
"strategy",
"should",
"to",
"collate",
"all",
"child",
"nodes",
"before",
"callback"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Xml/NodeStrategyCollation.php#L50-L68 |
27,870 | RhubarbPHP/Rhubarb | src/Sessions/Session.php | Session.getSessionProvider | final protected function getSessionProvider()
{
if ($this->sessionProvider == null) {
$this->sessionProvider = $this->getNewSessionProvider();
}
return $this->sessionProvider;
} | php | final protected function getSessionProvider()
{
if ($this->sessionProvider == null) {
$this->sessionProvider = $this->getNewSessionProvider();
}
return $this->sessionProvider;
} | [
"final",
"protected",
"function",
"getSessionProvider",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sessionProvider",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"sessionProvider",
"=",
"$",
"this",
"->",
"getNewSessionProvider",
"(",
")",
";",
"}",
"retu... | Get's the SessionProvider for this session.
To change the session provider for a session simply implement the GetNewSessionProvider() method.
@return SessionProviders\SessionProvider | [
"Get",
"s",
"the",
"SessionProvider",
"for",
"this",
"session",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Sessions/Session.php#L52-L59 |
27,871 | jfcherng/php-levenshtein-distance | src/LevenshteinDistance.php | LevenshteinDistance.calculateRawProgresses | private function calculateRawProgresses(array $dist): array
{
$m = \count($dist) - 1;
$n = \count($dist[0]) - 1;
$progresses = $trace = [];
for (
$x = $m, $y = $n;
$x !== 0 && $y !== 0;
[$x, $y] = $trace
) {
switch ($dist[$x][... | php | private function calculateRawProgresses(array $dist): array
{
$m = \count($dist) - 1;
$n = \count($dist[0]) - 1;
$progresses = $trace = [];
for (
$x = $m, $y = $n;
$x !== 0 && $y !== 0;
[$x, $y] = $trace
) {
switch ($dist[$x][... | [
"private",
"function",
"calculateRawProgresses",
"(",
"array",
"$",
"dist",
")",
":",
"array",
"{",
"$",
"m",
"=",
"\\",
"count",
"(",
"$",
"dist",
")",
"-",
"1",
";",
"$",
"n",
"=",
"\\",
"count",
"(",
"$",
"dist",
"[",
"0",
"]",
")",
"-",
"1"... | Calculate the raw progresses.
@param array $dist the distance array
@return array the raw progresses | [
"Calculate",
"the",
"raw",
"progresses",
"."
] | 7184e6220547a80752c08386a2907655f0b20b56 | https://github.com/jfcherng/php-levenshtein-distance/blob/7184e6220547a80752c08386a2907655f0b20b56/src/LevenshteinDistance.php#L352-L391 |
27,872 | jfcherng/php-levenshtein-distance | src/LevenshteinDistance.php | LevenshteinDistance.resolveRawProgresses | private function resolveRawProgresses(array $rawProgresses): array
{
static $callbacks;
$callbacks = $callbacks ?? [
self::OP_CPY => function (int $x, int $y): array {
return [self::OP_CPY, $x - 1, $y - 1, 1];
},
self::OP_DEL => function (int $x, ... | php | private function resolveRawProgresses(array $rawProgresses): array
{
static $callbacks;
$callbacks = $callbacks ?? [
self::OP_CPY => function (int $x, int $y): array {
return [self::OP_CPY, $x - 1, $y - 1, 1];
},
self::OP_DEL => function (int $x, ... | [
"private",
"function",
"resolveRawProgresses",
"(",
"array",
"$",
"rawProgresses",
")",
":",
"array",
"{",
"static",
"$",
"callbacks",
";",
"$",
"callbacks",
"=",
"$",
"callbacks",
"??",
"[",
"self",
"::",
"OP_CPY",
"=>",
"function",
"(",
"int",
"$",
"x",
... | Resolve the raw progresses.
@param array $rawProgresses the raw progresses
@return array [operation, old position, new position, length] | [
"Resolve",
"the",
"raw",
"progresses",
"."
] | 7184e6220547a80752c08386a2907655f0b20b56 | https://github.com/jfcherng/php-levenshtein-distance/blob/7184e6220547a80752c08386a2907655f0b20b56/src/LevenshteinDistance.php#L400-L428 |
27,873 | jfcherng/php-levenshtein-distance | src/LevenshteinDistance.php | LevenshteinDistance.mergeNeighborProgresses | private function mergeNeighborProgresses(array $progresses): array
{
$progressesCount = \count($progresses);
if ($progressesCount === 0) {
return [];
}
$merged = [];
$last = $progresses[0];
for ($step = 1; $step < $progressesCount; ++$step) {
... | php | private function mergeNeighborProgresses(array $progresses): array
{
$progressesCount = \count($progresses);
if ($progressesCount === 0) {
return [];
}
$merged = [];
$last = $progresses[0];
for ($step = 1; $step < $progressesCount; ++$step) {
... | [
"private",
"function",
"mergeNeighborProgresses",
"(",
"array",
"$",
"progresses",
")",
":",
"array",
"{",
"$",
"progressesCount",
"=",
"\\",
"count",
"(",
"$",
"progresses",
")",
";",
"if",
"(",
"$",
"progressesCount",
"===",
"0",
")",
"{",
"return",
"[",... | Merge neighbor progresses and return the merged result.
@param array $progresses the progresses
@return array | [
"Merge",
"neighbor",
"progresses",
"and",
"return",
"the",
"merged",
"result",
"."
] | 7184e6220547a80752c08386a2907655f0b20b56 | https://github.com/jfcherng/php-levenshtein-distance/blob/7184e6220547a80752c08386a2907655f0b20b56/src/LevenshteinDistance.php#L437-L463 |
27,874 | jfcherng/php-levenshtein-distance | src/LevenshteinDistance.php | LevenshteinDistance.makeProgressesPatch | private function makeProgressesPatch(array $olds, array $news, array $progresses): array
{
foreach ($progresses as $step => [$operation, $oldPos, $newPos, $length]) {
if ($operation & (self::OP_CPY | self::OP_DEL)) {
$chars = \array_slice($olds, $oldPos, $length);
} e... | php | private function makeProgressesPatch(array $olds, array $news, array $progresses): array
{
foreach ($progresses as $step => [$operation, $oldPos, $newPos, $length]) {
if ($operation & (self::OP_CPY | self::OP_DEL)) {
$chars = \array_slice($olds, $oldPos, $length);
} e... | [
"private",
"function",
"makeProgressesPatch",
"(",
"array",
"$",
"olds",
",",
"array",
"$",
"news",
",",
"array",
"$",
"progresses",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"progresses",
"as",
"$",
"step",
"=>",
"[",
"$",
"operation",
",",
"$",
"o... | Make progresses just like patch.
@param array $olds the old characters
@param array $news the new characters
@param array $progresses the progresses
@return array | [
"Make",
"progresses",
"just",
"like",
"patch",
"."
] | 7184e6220547a80752c08386a2907655f0b20b56 | https://github.com/jfcherng/php-levenshtein-distance/blob/7184e6220547a80752c08386a2907655f0b20b56/src/LevenshteinDistance.php#L474-L489 |
27,875 | jfcherng/php-levenshtein-distance | src/LevenshteinDistance.php | LevenshteinDistance.removeCopyProgresses | private function removeCopyProgresses(array $progresses): array
{
foreach ($progresses as $step => $progress) {
if ($progress[0] === self::OP_CPY) {
unset($progresses[$step]);
}
}
// resort keys
return \array_values($progresses);
} | php | private function removeCopyProgresses(array $progresses): array
{
foreach ($progresses as $step => $progress) {
if ($progress[0] === self::OP_CPY) {
unset($progresses[$step]);
}
}
// resort keys
return \array_values($progresses);
} | [
"private",
"function",
"removeCopyProgresses",
"(",
"array",
"$",
"progresses",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"progresses",
"as",
"$",
"step",
"=>",
"$",
"progress",
")",
"{",
"if",
"(",
"$",
"progress",
"[",
"0",
"]",
"===",
"self",
"::... | Remove "COPY" progresses.
@param array $progresses the progresses
@return array | [
"Remove",
"COPY",
"progresses",
"."
] | 7184e6220547a80752c08386a2907655f0b20b56 | https://github.com/jfcherng/php-levenshtein-distance/blob/7184e6220547a80752c08386a2907655f0b20b56/src/LevenshteinDistance.php#L498-L508 |
27,876 | jfcherng/php-levenshtein-distance | src/LevenshteinDistance.php | LevenshteinDistance.stringifyOperations | private function stringifyOperations(array $progresses): array
{
foreach ($progresses as &$progress) {
$progress[0] = static::OP_INT2STR_MAP[$progress[0]];
}
unset($progress);
return $progresses;
} | php | private function stringifyOperations(array $progresses): array
{
foreach ($progresses as &$progress) {
$progress[0] = static::OP_INT2STR_MAP[$progress[0]];
}
unset($progress);
return $progresses;
} | [
"private",
"function",
"stringifyOperations",
"(",
"array",
"$",
"progresses",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"progresses",
"as",
"&",
"$",
"progress",
")",
"{",
"$",
"progress",
"[",
"0",
"]",
"=",
"static",
"::",
"OP_INT2STR_MAP",
"[",
"$... | Convert the operation in progresses from int to string.
@param array $progresses the progresses
@return array | [
"Convert",
"the",
"operation",
"in",
"progresses",
"from",
"int",
"to",
"string",
"."
] | 7184e6220547a80752c08386a2907655f0b20b56 | https://github.com/jfcherng/php-levenshtein-distance/blob/7184e6220547a80752c08386a2907655f0b20b56/src/LevenshteinDistance.php#L517-L525 |
27,877 | RhubarbPHP/Rhubarb | src/UrlHandlers/UrlHandler.php | UrlHandler.addChildUrlHandlers | private function addChildUrlHandlers($childHandlers)
{
foreach ($childHandlers as $childUrl => $childHandler) {
$childHandler->setUrl($childUrl);
$childHandler->setParentHandler($this);
$this->childUrlHandlers[] = $childHandler;
}
return $this;
} | php | private function addChildUrlHandlers($childHandlers)
{
foreach ($childHandlers as $childUrl => $childHandler) {
$childHandler->setUrl($childUrl);
$childHandler->setParentHandler($this);
$this->childUrlHandlers[] = $childHandler;
}
return $this;
} | [
"private",
"function",
"addChildUrlHandlers",
"(",
"$",
"childHandlers",
")",
"{",
"foreach",
"(",
"$",
"childHandlers",
"as",
"$",
"childUrl",
"=>",
"$",
"childHandler",
")",
"{",
"$",
"childHandler",
"->",
"setUrl",
"(",
"$",
"childUrl",
")",
";",
"$",
"... | Adds child url handlers to this the parent.
@param UrlHandler[] $childHandlers
@return $this | [
"Adds",
"child",
"url",
"handlers",
"to",
"this",
"the",
"parent",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/UrlHandlers/UrlHandler.php#L204-L214 |
27,878 | RhubarbPHP/Rhubarb | src/UrlHandlers/UrlHandler.php | UrlHandler.buildCompleteChildUrl | protected function buildCompleteChildUrl($childUrlFragment)
{
if ($this->parentHandler !== null) {
return $this->parentHandler->matchingUrl . $childUrlFragment;
} else {
return $childUrlFragment;
}
} | php | protected function buildCompleteChildUrl($childUrlFragment)
{
if ($this->parentHandler !== null) {
return $this->parentHandler->matchingUrl . $childUrlFragment;
} else {
return $childUrlFragment;
}
} | [
"protected",
"function",
"buildCompleteChildUrl",
"(",
"$",
"childUrlFragment",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parentHandler",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"parentHandler",
"->",
"matchingUrl",
".",
"$",
"childUrlFragment",
"... | Takes a URL fragment understood by a child handler and adds back the parents URL fragment to form a complete URL.
@param $childUrlFragment
@return string | [
"Takes",
"a",
"URL",
"fragment",
"understood",
"by",
"a",
"child",
"handler",
"and",
"adds",
"back",
"the",
"parents",
"URL",
"fragment",
"to",
"form",
"a",
"complete",
"URL",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/UrlHandlers/UrlHandler.php#L253-L260 |
27,879 | RhubarbPHP/Rhubarb | src/UrlHandlers/UrlHandler.php | UrlHandler.generateResponse | public function generateResponse($request = null, $currentUrlFragment = false)
{
if ($currentUrlFragment === false) {
$currentUrlFragment = $request->urlPath;
}
if (!$this->matchesRequest($request, $currentUrlFragment)) {
return false;
}
UrlHandler::... | php | public function generateResponse($request = null, $currentUrlFragment = false)
{
if ($currentUrlFragment === false) {
$currentUrlFragment = $request->urlPath;
}
if (!$this->matchesRequest($request, $currentUrlFragment)) {
return false;
}
UrlHandler::... | [
"public",
"function",
"generateResponse",
"(",
"$",
"request",
"=",
"null",
",",
"$",
"currentUrlFragment",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"currentUrlFragment",
"===",
"false",
")",
"{",
"$",
"currentUrlFragment",
"=",
"$",
"request",
"->",
"urlPath... | Return the response when appropriate or false if no response could be generated.
If child handlers are present they are given priority.
@param mixed $request
@param bool|string $currentUrlFragment
@return bool|Response | [
"Return",
"the",
"response",
"when",
"appropriate",
"or",
"false",
"if",
"no",
"response",
"could",
"be",
"generated",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/UrlHandlers/UrlHandler.php#L278-L330 |
27,880 | RhubarbPHP/Rhubarb | src/UrlHandlers/UrlHandler.php | UrlHandler.getMatchingUrlFragment | protected function getMatchingUrlFragment(Request $request, $currentUrlFragment = "")
{
if ($currentUrlFragment[strlen($currentUrlFragment) - 1] != "/") {
$currentUrlFragment .= "/";
}
if (stripos($currentUrlFragment, $this->url) === 0) {
return $this->url;
}... | php | protected function getMatchingUrlFragment(Request $request, $currentUrlFragment = "")
{
if ($currentUrlFragment[strlen($currentUrlFragment) - 1] != "/") {
$currentUrlFragment .= "/";
}
if (stripos($currentUrlFragment, $this->url) === 0) {
return $this->url;
}... | [
"protected",
"function",
"getMatchingUrlFragment",
"(",
"Request",
"$",
"request",
",",
"$",
"currentUrlFragment",
"=",
"\"\"",
")",
"{",
"if",
"(",
"$",
"currentUrlFragment",
"[",
"strlen",
"(",
"$",
"currentUrlFragment",
")",
"-",
"1",
"]",
"!=",
"\"/\"",
... | Returns the portion of the URL that this handler would be able to return a response for.
@param \Rhubarb\Crown\Request\Request $request
@param string $currentUrlFragment
@return bool | [
"Returns",
"the",
"portion",
"of",
"the",
"URL",
"that",
"this",
"handler",
"would",
"be",
"able",
"to",
"return",
"a",
"response",
"for",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/UrlHandlers/UrlHandler.php#L355-L366 |
27,881 | RhubarbPHP/Rhubarb | src/UrlHandlers/UrlHandler.php | UrlHandler.matchesRequest | private function matchesRequest(Request $request, $currentUrlFragment = "")
{
// Some URL Handlers don't have a url at all in which case we assume they apply
// before even considering the url.
if ($this->url == "") {
return true;
}
return (stripos($currentUrlFra... | php | private function matchesRequest(Request $request, $currentUrlFragment = "")
{
// Some URL Handlers don't have a url at all in which case we assume they apply
// before even considering the url.
if ($this->url == "") {
return true;
}
return (stripos($currentUrlFra... | [
"private",
"function",
"matchesRequest",
"(",
"Request",
"$",
"request",
",",
"$",
"currentUrlFragment",
"=",
"\"\"",
")",
"{",
"// Some URL Handlers don't have a url at all in which case we assume they apply",
"// before even considering the url.",
"if",
"(",
"$",
"this",
"-... | Returns true of this handler's URL allows it to consider a response for the request.
In general terms this means that the current URL begins with the URL this handler is registered to handle.
However more advanced handlers might use other aspects of the request instead of the URL to determine this.
@param Request $re... | [
"Returns",
"true",
"of",
"this",
"handler",
"s",
"URL",
"allows",
"it",
"to",
"consider",
"a",
"response",
"for",
"the",
"request",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/UrlHandlers/UrlHandler.php#L378-L387 |
27,882 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.makeFromDate | public static function makeFromDate($year = null, $month = null, $day = null, $timezone = null)
{
return static::makeFromDateTime($year, $month, $day, null, null, null, $timezone);
} | php | public static function makeFromDate($year = null, $month = null, $day = null, $timezone = null)
{
return static::makeFromDateTime($year, $month, $day, null, null, null, $timezone);
} | [
"public",
"static",
"function",
"makeFromDate",
"(",
"$",
"year",
"=",
"null",
",",
"$",
"month",
"=",
"null",
",",
"$",
"day",
"=",
"null",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"makeFromDateTime",
"(",
"$",
"year",
... | Make and return a new ExpressiveDate instance with defined year, month, and day.
@param int $year
@param int $month
@param int $day
@param string|DateTimeZone $timezone
@return ExpressiveDate | [
"Make",
"and",
"return",
"a",
"new",
"ExpressiveDate",
"instance",
"with",
"defined",
"year",
"month",
"and",
"day",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L80-L83 |
27,883 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.makeFromTime | public static function makeFromTime($hour = null, $minute = null, $second = null, $timezone = null)
{
return static::makeFromDateTime(null, null, null, $hour, $minute, $second, $timezone);
} | php | public static function makeFromTime($hour = null, $minute = null, $second = null, $timezone = null)
{
return static::makeFromDateTime(null, null, null, $hour, $minute, $second, $timezone);
} | [
"public",
"static",
"function",
"makeFromTime",
"(",
"$",
"hour",
"=",
"null",
",",
"$",
"minute",
"=",
"null",
",",
"$",
"second",
"=",
"null",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"makeFromDateTime",
"(",
"null",
","... | Make and return a new ExpressiveDate instance with defined hour, minute, and second.
@param int $hour
@param int $minute
@param int $second
@param string|DateTimeZone $timezone
@return ExpressiveDate | [
"Make",
"and",
"return",
"a",
"new",
"ExpressiveDate",
"instance",
"with",
"defined",
"hour",
"minute",
"and",
"second",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L94-L97 |
27,884 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.makeFromDateTime | public static function makeFromDateTime($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null)
{
$date = new static(null, $timezone);
$date->setDate($year ?: $date->getYear(), $month ?: $date->getMonth(), $day ?: $date->getDay());
// If no hour was given then ... | php | public static function makeFromDateTime($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null)
{
$date = new static(null, $timezone);
$date->setDate($year ?: $date->getYear(), $month ?: $date->getMonth(), $day ?: $date->getDay());
// If no hour was given then ... | [
"public",
"static",
"function",
"makeFromDateTime",
"(",
"$",
"year",
"=",
"null",
",",
"$",
"month",
"=",
"null",
",",
"$",
"day",
"=",
"null",
",",
"$",
"hour",
"=",
"null",
",",
"$",
"minute",
"=",
"null",
",",
"$",
"second",
"=",
"null",
",",
... | Make and return a new ExpressiveDate instance with defined year, month, day, hour, minute, and second.
@param int $year
@param int $month
@param int $day
@param int $hour
@param int $minute
@param int $second
@param string|DateTimeZone $timezone
@return ExpressiveDate | [
"Make",
"and",
"return",
"a",
"new",
"ExpressiveDate",
"instance",
"with",
"defined",
"year",
"month",
"day",
"hour",
"minute",
"and",
"second",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L111-L135 |
27,885 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.modifySeconds | protected function modifySeconds($amount, $invert = false)
{
$interval = new DateInterval("PT{$amount}S");
$this->modifyFromInterval($interval, $invert);
return $this;
} | php | protected function modifySeconds($amount, $invert = false)
{
$interval = new DateInterval("PT{$amount}S");
$this->modifyFromInterval($interval, $invert);
return $this;
} | [
"protected",
"function",
"modifySeconds",
"(",
"$",
"amount",
",",
"$",
"invert",
"=",
"false",
")",
"{",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"\"PT{$amount}S\"",
")",
";",
"$",
"this",
"->",
"modifyFromInterval",
"(",
"$",
"interval",
",",
"$... | Modify by an amount of seconds.
@param int $amount
@param bool $invert
@return ExpressiveDate | [
"Modify",
"by",
"an",
"amount",
"of",
"seconds",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L652-L659 |
27,886 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.modifyFromInterval | protected function modifyFromInterval($interval, $invert = false)
{
if ($invert)
{
$this->sub($interval);
}
else
{
$this->add($interval);
}
return $this;
} | php | protected function modifyFromInterval($interval, $invert = false)
{
if ($invert)
{
$this->sub($interval);
}
else
{
$this->add($interval);
}
return $this;
} | [
"protected",
"function",
"modifyFromInterval",
"(",
"$",
"interval",
",",
"$",
"invert",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"invert",
")",
"{",
"$",
"this",
"->",
"sub",
"(",
"$",
"interval",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"add... | Modify from a DateInterval object.
@param DateInterval $interval
@param bool $invert
@return ExpressiveDate | [
"Modify",
"from",
"a",
"DateInterval",
"object",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L732-L744 |
27,887 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.setTimezone | public function setTimezone($timezone)
{
$timezone = $this->parseSuppliedTimezone($timezone);
parent::setTimezone($timezone);
return $this;
} | php | public function setTimezone($timezone)
{
$timezone = $this->parseSuppliedTimezone($timezone);
parent::setTimezone($timezone);
return $this;
} | [
"public",
"function",
"setTimezone",
"(",
"$",
"timezone",
")",
"{",
"$",
"timezone",
"=",
"$",
"this",
"->",
"parseSuppliedTimezone",
"(",
"$",
"timezone",
")",
";",
"parent",
"::",
"setTimezone",
"(",
"$",
"timezone",
")",
";",
"return",
"$",
"this",
"... | Set the timezone.
@param string|DateTimeZone $timezone
@return ExpressiveDate | [
"Set",
"the",
"timezone",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L752-L759 |
27,888 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.setWeekStartDay | public function setWeekStartDay($weekStartDay)
{
if (is_numeric($weekStartDay))
{
$this->weekStartDay = $weekStartDay;
}
else
{
$this->weekStartDay = array_search(strtolower($weekStartDay), array('sunday', 'monday'));
}
return $this;
} | php | public function setWeekStartDay($weekStartDay)
{
if (is_numeric($weekStartDay))
{
$this->weekStartDay = $weekStartDay;
}
else
{
$this->weekStartDay = array_search(strtolower($weekStartDay), array('sunday', 'monday'));
}
return $this;
} | [
"public",
"function",
"setWeekStartDay",
"(",
"$",
"weekStartDay",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"weekStartDay",
")",
")",
"{",
"$",
"this",
"->",
"weekStartDay",
"=",
"$",
"weekStartDay",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"weekSta... | Set the starting day of the week, where 0 is Sunday and 1 is Monday.
@param int|string $weekStartDay
@return void | [
"Set",
"the",
"starting",
"day",
"of",
"the",
"week",
"where",
"0",
"is",
"Sunday",
"and",
"1",
"is",
"Monday",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L1027-L1039 |
27,889 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.isDateAttribute | protected function isDateAttribute($attribute)
{
switch ($attribute)
{
case 'LeapYear':
return (bool) $this->format('L');
break;
case 'AmOrPm':
return $this->format('A');
break;
case 'DaylightSavings':
return (bool) $this->format('I');
break;
}
throw new InvalidArgumentExcepti... | php | protected function isDateAttribute($attribute)
{
switch ($attribute)
{
case 'LeapYear':
return (bool) $this->format('L');
break;
case 'AmOrPm':
return $this->format('A');
break;
case 'DaylightSavings':
return (bool) $this->format('I');
break;
}
throw new InvalidArgumentExcepti... | [
"protected",
"function",
"isDateAttribute",
"(",
"$",
"attribute",
")",
"{",
"switch",
"(",
"$",
"attribute",
")",
"{",
"case",
"'LeapYear'",
":",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"format",
"(",
"'L'",
")",
";",
"break",
";",
"case",
"'Am... | Syntactical sugar for determining if date object "is" a condition.
@param string $attribute
@return mixed | [
"Syntactical",
"sugar",
"for",
"determining",
"if",
"date",
"object",
"is",
"a",
"condition",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L1114-L1130 |
27,890 | jasonlewis/expressive-date | src/ExpressiveDate.php | ExpressiveDate.setDateAttribute | protected function setDateAttribute($attribute, $value)
{
switch ($attribute)
{
case 'Day':
return $this->setDate($this->getYear(), $this->getMonth(), $value);
break;
case 'Month':
return $this->setDate($this->getYear(), $value, $this->getDay());
break;
case 'Year':
return $this->setDa... | php | protected function setDateAttribute($attribute, $value)
{
switch ($attribute)
{
case 'Day':
return $this->setDate($this->getYear(), $this->getMonth(), $value);
break;
case 'Month':
return $this->setDate($this->getYear(), $value, $this->getDay());
break;
case 'Year':
return $this->setDa... | [
"protected",
"function",
"setDateAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"attribute",
")",
"{",
"case",
"'Day'",
":",
"return",
"$",
"this",
"->",
"setDate",
"(",
"$",
"this",
"->",
"getYear",
"(",
")",
",",
... | Set a date attribute.
@param string $attribute
@return mixed | [
"Set",
"a",
"date",
"attribute",
"."
] | 1215d093fd3fe222e26629e0bc3885968ba88a01 | https://github.com/jasonlewis/expressive-date/blob/1215d093fd3fe222e26629e0bc3885968ba88a01/src/ExpressiveDate.php#L1138-L1163 |
27,891 | mediact/testing-suite | src/Installer/PipelinesInstaller.php | PipelinesInstaller.isBitbucket | private function isBitbucket(): bool
{
$process = $this->processFactory->create('git remote -v');
$process->run();
return strpos($process->getOutput(), $this->pattern) !== false;
} | php | private function isBitbucket(): bool
{
$process = $this->processFactory->create('git remote -v');
$process->run();
return strpos($process->getOutput(), $this->pattern) !== false;
} | [
"private",
"function",
"isBitbucket",
"(",
")",
":",
"bool",
"{",
"$",
"process",
"=",
"$",
"this",
"->",
"processFactory",
"->",
"create",
"(",
"'git remote -v'",
")",
";",
"$",
"process",
"->",
"run",
"(",
")",
";",
"return",
"strpos",
"(",
"$",
"pro... | Check whether the project is on Bitbucket.
@return bool | [
"Check",
"whether",
"the",
"project",
"is",
"on",
"Bitbucket",
"."
] | 98614fe3b5c174e9bda2ff88d36d30349094dbc2 | https://github.com/mediact/testing-suite/blob/98614fe3b5c174e9bda2ff88d36d30349094dbc2/src/Installer/PipelinesInstaller.php#L112-L118 |
27,892 | RhubarbPHP/Rhubarb | src/Http/CurlHttpClient.php | CurlHttpClient.getResponse | public function getResponse(HttpRequest $request)
{
$uri = $request->getUrl();
$headers = $request->getHeaders();
$flatHeaders = [];
foreach ($headers as $key => $value) {
$flatHeaders[] = $key . ": " . $value;
}
$flatHeaders[] = 'Connection: Keep-Alive... | php | public function getResponse(HttpRequest $request)
{
$uri = $request->getUrl();
$headers = $request->getHeaders();
$flatHeaders = [];
foreach ($headers as $key => $value) {
$flatHeaders[] = $key . ": " . $value;
}
$flatHeaders[] = 'Connection: Keep-Alive... | [
"public",
"function",
"getResponse",
"(",
"HttpRequest",
"$",
"request",
")",
"{",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUrl",
"(",
")",
";",
"$",
"headers",
"=",
"$",
"request",
"->",
"getHeaders",
"(",
")",
";",
"$",
"flatHeaders",
"=",
"[",
"... | Executes an HTTP transaction and returns the response.
@param HttpRequest $request
@return HttpResponse | [
"Executes",
"an",
"HTTP",
"transaction",
"and",
"returns",
"the",
"response",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Http/CurlHttpClient.php#L31-L88 |
27,893 | RhubarbPHP/Rhubarb | src/DateTime/RhubarbDateTime.php | RhubarbDateTime.previousMonday | public static function previousMonday($referenceDate = null)
{
if ($referenceDate == null) {
$referenceDate = new RhubarbDateTime("today");
}
$dayOfWeek = $referenceDate->format("N") - 1;
$referenceDate->modify(-$dayOfWeek . " days");
return $referenceDate;
... | php | public static function previousMonday($referenceDate = null)
{
if ($referenceDate == null) {
$referenceDate = new RhubarbDateTime("today");
}
$dayOfWeek = $referenceDate->format("N") - 1;
$referenceDate->modify(-$dayOfWeek . " days");
return $referenceDate;
... | [
"public",
"static",
"function",
"previousMonday",
"(",
"$",
"referenceDate",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"referenceDate",
"==",
"null",
")",
"{",
"$",
"referenceDate",
"=",
"new",
"RhubarbDateTime",
"(",
"\"today\"",
")",
";",
"}",
"$",
"dayOfWe... | Returns the date of the Monday of this week.
This is often used as a handle on the week commencing date
@param RhubarbDateTime $referenceDate The date to find the previous Monday of. Today if null.
@return RhubarbDateTime | [
"Returns",
"the",
"date",
"of",
"the",
"Monday",
"of",
"this",
"week",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/DateTime/RhubarbDateTime.php#L112-L123 |
27,894 | RhubarbPHP/Rhubarb | src/DateTime/RhubarbDateTime.php | RhubarbDateTime.createFromFormat | public static function createFromFormat($format, $time, $timezone = null)
{
if ($timezone == null) {
$dateTime = DateTime::createFromFormat($format, $time);
} else {
$dateTime = DateTime::createFromFormat($format, $time, $timezone);
}
return new self($dateTime... | php | public static function createFromFormat($format, $time, $timezone = null)
{
if ($timezone == null) {
$dateTime = DateTime::createFromFormat($format, $time);
} else {
$dateTime = DateTime::createFromFormat($format, $time, $timezone);
}
return new self($dateTime... | [
"public",
"static",
"function",
"createFromFormat",
"(",
"$",
"format",
",",
"$",
"time",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"timezone",
"==",
"null",
")",
"{",
"$",
"dateTime",
"=",
"DateTime",
"::",
"createFromFormat",
"(",
... | Parse a string into a new RhubarbDateTime object according to the specified format
@param string $format Format accepted by date().
@param string $time String representing the time.
@param $timezone A DateTimeZone object representing the desired time zone.
@return RhubarbDateTime | [
"Parse",
"a",
"string",
"into",
"a",
"new",
"RhubarbDateTime",
"object",
"according",
"to",
"the",
"specified",
"format"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/DateTime/RhubarbDateTime.php#L134-L142 |
27,895 | RhubarbPHP/Rhubarb | src/Events/EventEmitter.php | EventEmitter.replaceEventHandler | public function replaceEventHandler($event, callable $delegate)
{
if (isset($this->eventHandlers[$event])) {
$this->eventHandlers[$event] = [];
}
$this->attachEventHandler($event, $delegate);
} | php | public function replaceEventHandler($event, callable $delegate)
{
if (isset($this->eventHandlers[$event])) {
$this->eventHandlers[$event] = [];
}
$this->attachEventHandler($event, $delegate);
} | [
"public",
"function",
"replaceEventHandler",
"(",
"$",
"event",
",",
"callable",
"$",
"delegate",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"eventHandlers",
"[",
"$",
"event",
"]",
")",
")",
"{",
"$",
"this",
"->",
"eventHandlers",
"[",
"$"... | Attach an event handler as the sole handler for this event.
Removes all previously attached handlers.
@param $event
@param callable $delegate | [
"Attach",
"an",
"event",
"handler",
"as",
"the",
"sole",
"handler",
"for",
"this",
"event",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Events/EventEmitter.php#L54-L61 |
27,896 | RhubarbPHP/Rhubarb | src/Events/EventEmitter.php | EventEmitter.raiseEvent | protected function raiseEvent($event)
{
if (!isset($this->eventHandlers[$event])) {
return null;
}
$args = func_get_args();
$args = array_slice($args, 1);
// Check if the last argument is a callback.
$count = count($args);
$callBack = false;
... | php | protected function raiseEvent($event)
{
if (!isset($this->eventHandlers[$event])) {
return null;
}
$args = func_get_args();
$args = array_slice($args, 1);
// Check if the last argument is a callback.
$count = count($args);
$callBack = false;
... | [
"protected",
"function",
"raiseEvent",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"eventHandlers",
"[",
"$",
"event",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";... | Call this function to raise an event.
In addition to $event you can pass any number of other events which are passed through
to the event handling delegate.
@param string $event The name of the event
@return mixed|null | [
"Call",
"this",
"function",
"to",
"raise",
"an",
"event",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Events/EventEmitter.php#L105-L140 |
27,897 | RhubarbPHP/Rhubarb | src/Response/Response.php | Response.addHeaders | public function addHeaders($headers)
{
foreach ($headers as $name => $value) {
$this->setHeader($name, $value);
}
} | php | public function addHeaders($headers)
{
foreach ($headers as $name => $value) {
$this->setHeader($name, $value);
}
} | [
"public",
"function",
"addHeaders",
"(",
"$",
"headers",
")",
"{",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"}"
] | Sets headers from array. Keys should be the header names.
@param string[] $headers | [
"Sets",
"headers",
"from",
"array",
".",
"Keys",
"should",
"be",
"the",
"header",
"names",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Response/Response.php#L230-L235 |
27,898 | RhubarbPHP/Rhubarb | src/Request/Request.php | Request.fromPhpContext | public final static function fromPhpContext(PhpContext $phpContext)
{
if ($phpContext->isCliInvocation()) {
$request = new CliRequest();
} else {
$contentType = (isset($_SERVER["CONTENT_TYPE"])) ? strtolower($_SERVER["CONTENT_TYPE"]) : "";
// Special check for mu... | php | public final static function fromPhpContext(PhpContext $phpContext)
{
if ($phpContext->isCliInvocation()) {
$request = new CliRequest();
} else {
$contentType = (isset($_SERVER["CONTENT_TYPE"])) ? strtolower($_SERVER["CONTENT_TYPE"]) : "";
// Special check for mu... | [
"public",
"final",
"static",
"function",
"fromPhpContext",
"(",
"PhpContext",
"$",
"phpContext",
")",
"{",
"if",
"(",
"$",
"phpContext",
"->",
"isCliInvocation",
"(",
")",
")",
"{",
"$",
"request",
"=",
"new",
"CliRequest",
"(",
")",
";",
"}",
"else",
"{... | Creates a request object from the PHP context
@return Request | [
"Creates",
"a",
"request",
"object",
"from",
"the",
"PHP",
"context"
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Request/Request.php#L98-L143 |
27,899 | RhubarbPHP/Rhubarb | src/Request/Request.php | Request.getSuperglobalValue | protected function getSuperglobalValue($superglobal, $index, $defaultValue = null)
{
$propertyName = $superglobal . 'Data';
if (isset($this->$propertyName)){
$data = $this->$propertyName;
if (isset($data[$index])){
return $data[$index];
}
... | php | protected function getSuperglobalValue($superglobal, $index, $defaultValue = null)
{
$propertyName = $superglobal . 'Data';
if (isset($this->$propertyName)){
$data = $this->$propertyName;
if (isset($data[$index])){
return $data[$index];
}
... | [
"protected",
"function",
"getSuperglobalValue",
"(",
"$",
"superglobal",
",",
"$",
"index",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"$",
"propertyName",
"=",
"$",
"superglobal",
".",
"'Data'",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$"... | Get the value stored against one of the request superglobals.
@param string $superglobal
@param mixed $index
@return mixed | [
"Get",
"the",
"value",
"stored",
"against",
"one",
"of",
"the",
"request",
"superglobals",
"."
] | 327ff1f05d6a7e651d41c8e771f3551acfac18ae | https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Request/Request.php#L178-L191 |
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.