repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
yuncms/framework | src/models/BaseUser.php | BaseUser.resetPassword | public function resetPassword($password)
{
try {
return (bool)$this->updateAttributes(['password_hash' => PasswordHelper::hash($password)]);
} catch (Exception $e) {
return false;
}
} | php | public function resetPassword($password)
{
try {
return (bool)$this->updateAttributes(['password_hash' => PasswordHelper::hash($password)]);
} catch (Exception $e) {
return false;
}
} | [
"public",
"function",
"resetPassword",
"(",
"$",
"password",
")",
"{",
"try",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"updateAttributes",
"(",
"[",
"'password_hash'",
"=>",
"PasswordHelper",
"::",
"hash",
"(",
"$",
"password",
")",
"]",
")",
... | 重置密码
@param string $password
@return boolean | [
"重置密码"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/BaseUser.php#L341-L348 |
yuncms/framework | src/models/BaseUser.php | BaseUser.block | public function block()
{
try {
return (bool)$this->updateAttributes(['blocked_at' => time(), 'auth_key' => Yii::$app->security->generateRandomString()]);
} catch (Exception $e) {
return false;
}
} | php | public function block()
{
try {
return (bool)$this->updateAttributes(['blocked_at' => time(), 'auth_key' => Yii::$app->security->generateRandomString()]);
} catch (Exception $e) {
return false;
}
} | [
"public",
"function",
"block",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"updateAttributes",
"(",
"[",
"'blocked_at'",
"=>",
"time",
"(",
")",
",",
"'auth_key'",
"=>",
"Yii",
"::",
"$",
"app",
"->",
"security",
"->",
"... | 锁定用户
@return boolean | [
"锁定用户"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/BaseUser.php#L354-L361 |
yuncms/framework | src/models/BaseUser.php | BaseUser.loadAllowance | public function loadAllowance($request, $action)
{
$allowance = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance');
$allowanceUpdatedAt = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance_update_at');
... | php | public function loadAllowance($request, $action)
{
$allowance = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance');
$allowanceUpdatedAt = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance_update_at');
... | [
"public",
"function",
"loadAllowance",
"(",
"$",
"request",
",",
"$",
"action",
")",
"{",
"$",
"allowance",
"=",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"get",
"(",
"$",
"action",
"->",
"controller",
"->",
"id",
".",
"':'",
".",
"$",
"action",
... | Loads the number of allowed requests and the corresponding timestamp from a persistent storage.
@param \yii\web\Request $request the current request
@param \yii\base\Action $action the action to be executed
@return array an array of two elements. The first element is the number of allowed requests,
and the second eleme... | [
"Loads",
"the",
"number",
"of",
"allowed",
"requests",
"and",
"the",
"corresponding",
"timestamp",
"from",
"a",
"persistent",
"storage",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/BaseUser.php#L444-L453 |
yuncms/framework | src/models/BaseUser.php | BaseUser.saveAllowance | public function saveAllowance($request, $action, $allowance, $timestamp)
{
Yii::$app->cache->set($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance', $allowance, 60);
Yii::$app->cache->set($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance_update_at'... | php | public function saveAllowance($request, $action, $allowance, $timestamp)
{
Yii::$app->cache->set($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance', $allowance, 60);
Yii::$app->cache->set($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance_update_at'... | [
"public",
"function",
"saveAllowance",
"(",
"$",
"request",
",",
"$",
"action",
",",
"$",
"allowance",
",",
"$",
"timestamp",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"set",
"(",
"$",
"action",
"->",
"controller",
"->",
"id",
".",
"':'... | Saves the number of allowed requests and the corresponding timestamp to a persistent storage.
@param \yii\web\Request $request the current request
@param \yii\base\Action $action the action to be executed
@param int $allowance the number of allowed requests remaining.
@param int $timestamp the current timestamp. | [
"Saves",
"the",
"number",
"of",
"allowed",
"requests",
"and",
"the",
"corresponding",
"timestamp",
"to",
"a",
"persistent",
"storage",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/BaseUser.php#L462-L466 |
yuncms/framework | src/models/BaseUser.php | BaseUser.routeNotificationFor | public function routeNotificationFor($channel)
{
if (method_exists($this, $method = 'routeNotificationFor' . Inflector::camelize($channel))) {
return $this->{$method}();
}
switch ($channel) {
case 'database':
return [
'notifiable_id... | php | public function routeNotificationFor($channel)
{
if (method_exists($this, $method = 'routeNotificationFor' . Inflector::camelize($channel))) {
return $this->{$method}();
}
switch ($channel) {
case 'database':
return [
'notifiable_id... | [
"public",
"function",
"routeNotificationFor",
"(",
"$",
"channel",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
"=",
"'routeNotificationFor'",
".",
"Inflector",
"::",
"camelize",
"(",
"$",
"channel",
")",
")",
")",
"{",
"retu... | 返回给定通道的通知路由信息。
```php
public function routeNotificationForMail() {
return $this->email;
}
```
@param $channel string
@return mixed | [
"返回给定通道的通知路由信息。",
"php",
"public",
"function",
"routeNotificationForMail",
"()",
"{",
"return",
"$this",
"-",
">",
"email",
";",
"}"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/BaseUser.php#L489-L511 |
necrox87/yii2-nudity-detector | Image.php | Image.type | static public function type($file) {
$type = getimagesize($file);
$type = $type[2];
switch($type) {
case IMAGETYPE_GIF: return 'gif';
case IMAGETYPE_JPEG: return 'jpg';
case IMAGETYPE_PNG: return 'png';
}
return FALSE;
} | php | static public function type($file) {
$type = getimagesize($file);
$type = $type[2];
switch($type) {
case IMAGETYPE_GIF: return 'gif';
case IMAGETYPE_JPEG: return 'jpg';
case IMAGETYPE_PNG: return 'png';
}
return FALSE;
} | [
"static",
"public",
"function",
"type",
"(",
"$",
"file",
")",
"{",
"$",
"type",
"=",
"getimagesize",
"(",
"$",
"file",
")",
";",
"$",
"type",
"=",
"$",
"type",
"[",
"2",
"]",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"IMAGETYPE_GIF",
":... | Get image type if it is one of: .gif, .jpg or .png
@param string $file Full path to file
@return string|boolean | [
"Get",
"image",
"type",
"if",
"it",
"is",
"one",
"of",
":",
".",
"gif",
".",
"jpg",
"or",
".",
"png"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L69-L78 |
necrox87/yii2-nudity-detector | Image.php | Image.rgbXY | public function rgbXY($x, $y) {
$color = $this->colorXY($x, $y);
return array(($color >> 16) & 0xFF, ($color >> 8) & 0xFF, $color & 0xFF);
} | php | public function rgbXY($x, $y) {
$color = $this->colorXY($x, $y);
return array(($color >> 16) & 0xFF, ($color >> 8) & 0xFF, $color & 0xFF);
} | [
"public",
"function",
"rgbXY",
"(",
"$",
"x",
",",
"$",
"y",
")",
"{",
"$",
"color",
"=",
"$",
"this",
"->",
"colorXY",
"(",
"$",
"x",
",",
"$",
"y",
")",
";",
"return",
"array",
"(",
"(",
"$",
"color",
">>",
"16",
")",
"&",
"0xFF",
",",
"(... | Returns RGB array of pixel's color
@param int $x
@param int $y | [
"Returns",
"RGB",
"array",
"of",
"pixel",
"s",
"color"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L110-L113 |
necrox87/yii2-nudity-detector | Image.php | Image.create | public function create() {
switch($this->info[2]) {
case IMAGETYPE_JPEG:
$this->resource = imagecreatefromjpeg($this->file);
break;
case IMAGETYPE_GIF:
$this->resource = imagecreatefromgif($this->file);
break;
ca... | php | public function create() {
switch($this->info[2]) {
case IMAGETYPE_JPEG:
$this->resource = imagecreatefromjpeg($this->file);
break;
case IMAGETYPE_GIF:
$this->resource = imagecreatefromgif($this->file);
break;
ca... | [
"public",
"function",
"create",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"info",
"[",
"2",
"]",
")",
"{",
"case",
"IMAGETYPE_JPEG",
":",
"$",
"this",
"->",
"resource",
"=",
"imagecreatefromjpeg",
"(",
"$",
"this",
"->",
"file",
")",
";",
"bre... | Create an image resource | [
"Create",
"an",
"image",
"resource"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L119-L134 |
necrox87/yii2-nudity-detector | Image.php | Image.save | public function save($file, $type = IMAGETYPE_JPEG, $quality = 75,
$permissions = false) {
// create directory if necessary
$dir = dirname($file);
if(!file_exists($dir)) {
$mask = umask();
mkdir($dir, 0777, true);
umask($mask);
... | php | public function save($file, $type = IMAGETYPE_JPEG, $quality = 75,
$permissions = false) {
// create directory if necessary
$dir = dirname($file);
if(!file_exists($dir)) {
$mask = umask();
mkdir($dir, 0777, true);
umask($mask);
... | [
"public",
"function",
"save",
"(",
"$",
"file",
",",
"$",
"type",
"=",
"IMAGETYPE_JPEG",
",",
"$",
"quality",
"=",
"75",
",",
"$",
"permissions",
"=",
"false",
")",
"{",
"// create directory if necessary",
"$",
"dir",
"=",
"dirname",
"(",
"$",
"file",
")... | Save image to file
@param string $file File path
@param int $type Image type constant
@param int $quality JPEG compression quality from 0 to 100
@param int $permissions Unix file permissions | [
"Save",
"image",
"to",
"file"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L162-L193 |
necrox87/yii2-nudity-detector | Image.php | Image.crop | public function crop($x, $y, $w, $h) {
$new = @imagecreatetruecolor($w, $h);
// This needed to deal with .png transparency
imagealphablending($new, false);
imagesavealpha($new, true);
$transparent = imagecolorallocatealpha($new, 255, 255, 255, 127);
imagefilledrectangle... | php | public function crop($x, $y, $w, $h) {
$new = @imagecreatetruecolor($w, $h);
// This needed to deal with .png transparency
imagealphablending($new, false);
imagesavealpha($new, true);
$transparent = imagecolorallocatealpha($new, 255, 255, 255, 127);
imagefilledrectangle... | [
"public",
"function",
"crop",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"w",
",",
"$",
"h",
")",
"{",
"$",
"new",
"=",
"@",
"imagecreatetruecolor",
"(",
"$",
"w",
",",
"$",
"h",
")",
";",
"// This needed to deal with .png transparency",
"imagealphablending... | Crop image
@param int $x
@param int $y
@param int $w
@param int $h
@return Image | [
"Crop",
"image"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L204-L223 |
necrox87/yii2-nudity-detector | Image.php | Image.resize | public function resize($width, $height) {
$new = @imagecreatetruecolor($width, $height);
// This needed to deal with .png transparency
imagealphablending($new, false);
imagesavealpha($new, true);
$transparent = imagecolorallocatealpha($new, 255, 255, 255, 127);
imagefil... | php | public function resize($width, $height) {
$new = @imagecreatetruecolor($width, $height);
// This needed to deal with .png transparency
imagealphablending($new, false);
imagesavealpha($new, true);
$transparent = imagecolorallocatealpha($new, 255, 255, 255, 127);
imagefil... | [
"public",
"function",
"resize",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"new",
"=",
"@",
"imagecreatetruecolor",
"(",
"$",
"width",
",",
"$",
"height",
")",
";",
"// This needed to deal with .png transparency",
"imagealphablending",
"(",
"$",
"ne... | Resize image
@param int $width New width
@param int $height New height | [
"Resize",
"image"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L231-L247 |
necrox87/yii2-nudity-detector | Image.php | Image.fitResize | public function fitResize($max_width = 150, $max_height = 150, $min_width = 20, $min_height = 20) {
$kw = $max_width / $this->width();
$kh = $max_height / $this->height();
if($kw > $kh) {
$new_h = $max_height;
$new_w = round($kh * $this->width());
} else {
... | php | public function fitResize($max_width = 150, $max_height = 150, $min_width = 20, $min_height = 20) {
$kw = $max_width / $this->width();
$kh = $max_height / $this->height();
if($kw > $kh) {
$new_h = $max_height;
$new_w = round($kh * $this->width());
} else {
... | [
"public",
"function",
"fitResize",
"(",
"$",
"max_width",
"=",
"150",
",",
"$",
"max_height",
"=",
"150",
",",
"$",
"min_width",
"=",
"20",
",",
"$",
"min_height",
"=",
"20",
")",
"{",
"$",
"kw",
"=",
"$",
"max_width",
"/",
"$",
"this",
"->",
"widt... | Fit the image with the same proportion into an area
@param int $max_width
@param int $max_height
@param int $min_width
@param int $min_height
@return Image | [
"Fit",
"the",
"image",
"with",
"the",
"same",
"proportion",
"into",
"an",
"area"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L258-L272 |
necrox87/yii2-nudity-detector | Image.php | Image.scaleResize | public function scaleResize($width, $height) {
// calculate source coordinates
$kw = $this->width() / $width;
$kh = $this->height() / $height;
if($kh < $kw) {
$src_h = $this->height();
$src_y = 0;
$src_w = round($kh * $width);
$src_x = rou... | php | public function scaleResize($width, $height) {
// calculate source coordinates
$kw = $this->width() / $width;
$kh = $this->height() / $height;
if($kh < $kw) {
$src_h = $this->height();
$src_y = 0;
$src_w = round($kh * $width);
$src_x = rou... | [
"public",
"function",
"scaleResize",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"// calculate source coordinates",
"$",
"kw",
"=",
"$",
"this",
"->",
"width",
"(",
")",
"/",
"$",
"width",
";",
"$",
"kh",
"=",
"$",
"this",
"->",
"height",
"(",
"... | Resize image correctly scaled and than crop
the necessary area
@param int $width New width
@param int $height New height | [
"Resize",
"image",
"correctly",
"scaled",
"and",
"than",
"crop",
"the",
"necessary",
"area"
] | train | https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/Image.php#L281-L306 |
okitcom/ok-lib-php | src/Service/BaseService.php | BaseService.getAttribute | public function getAttribute($attributes, $name) {
foreach($attributes as $a) {
if ($a->key == $name) {
return $a->value;
}
}
return null;
} | php | public function getAttribute($attributes, $name) {
foreach($attributes as $a) {
if ($a->key == $name) {
return $a->value;
}
}
return null;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"attributes",
",",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"a",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"key",
"==",
"$",
"name",
")",
"{",
"return",
"$",
"a",
"->",
"value... | Returns the value of attribute with name
@param $attributes array of attributes
@param $name string Attribute's name
@return mixed Attribute value | [
"Returns",
"the",
"value",
"of",
"attribute",
"with",
"name"
] | train | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Service/BaseService.php#L33-L40 |
shiftio/safestream-php-sdk | src/Http/SafeStreamHttpClient.php | SafeStreamHttpClient.getAuthToken | public function getAuthToken() {
try {
$response = $this->client->request('GET', "authenticate/accessToken", ['headers' => [
'x-api-client-id' => $this->clientId,
'x-api-key' => $this->apiKey
]]);
$this->authToken = json_decode($response->getB... | php | public function getAuthToken() {
try {
$response = $this->client->request('GET', "authenticate/accessToken", ['headers' => [
'x-api-client-id' => $this->clientId,
'x-api-key' => $this->apiKey
]]);
$this->authToken = json_decode($response->getB... | [
"public",
"function",
"getAuthToken",
"(",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"request",
"(",
"'GET'",
",",
"\"authenticate/accessToken\"",
",",
"[",
"'headers'",
"=>",
"[",
"'x-api-client-id'",
"=>",
"$",
"this",
... | Gets an authorization token using the clients API key. Most requests to the SafeStream API
require an authorization token.
@return mixed: The JSON decoded response
@throws SafeStreamHttpAuthException
@throws SafeStreamHttpBadRequestException
@throws SafeStreamHttpException
@throws SafeStreamHttpThrottleException | [
"Gets",
"an",
"authorization",
"token",
"using",
"the",
"clients",
"API",
"key",
".",
"Most",
"requests",
"to",
"the",
"SafeStream",
"API",
"require",
"an",
"authorization",
"token",
"."
] | train | https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Http/SafeStreamHttpClient.php#L167-L180 |
apioo/psx-sandbox | src/Printer.php | Printer.pParam | protected function pParam(Node\Param $node)
{
return ($node->type ? $this->pType($node->type) . ' ' : '')
. ($node->byRef ? '&' : '')
. ($node->variadic ? '...' : '')
. '$' . $node->name
. ($node->default ? ' = ' . $this->p($node->default) : '');
} | php | protected function pParam(Node\Param $node)
{
return ($node->type ? $this->pType($node->type) . ' ' : '')
. ($node->byRef ? '&' : '')
. ($node->variadic ? '...' : '')
. '$' . $node->name
. ($node->default ? ' = ' . $this->p($node->default) : '');
} | [
"protected",
"function",
"pParam",
"(",
"Node",
"\\",
"Param",
"$",
"node",
")",
"{",
"return",
"(",
"$",
"node",
"->",
"type",
"?",
"$",
"this",
"->",
"pType",
"(",
"$",
"node",
"->",
"type",
")",
".",
"' '",
":",
"''",
")",
".",
"(",
"$",
"no... | Special nodes | [
"Special",
"nodes"
] | train | https://github.com/apioo/psx-sandbox/blob/5d136a398da375056e6526bbbc85d7f5d3df9441/src/Printer.php#L60-L67 |
apioo/psx-sandbox | src/Printer.php | Printer.pScalar_String | protected function pScalar_String(Scalar\String_ $node)
{
$kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED);
switch ($kind) {
case Scalar\String_::KIND_NOWDOC:
$label = $node->getAttribute('docLabel');
if ($label && !$this->containsEn... | php | protected function pScalar_String(Scalar\String_ $node)
{
$kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED);
switch ($kind) {
case Scalar\String_::KIND_NOWDOC:
$label = $node->getAttribute('docLabel');
if ($label && !$this->containsEn... | [
"protected",
"function",
"pScalar_String",
"(",
"Scalar",
"\\",
"String_",
"$",
"node",
")",
"{",
"$",
"kind",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
"'kind'",
",",
"Scalar",
"\\",
"String_",
"::",
"KIND_SINGLE_QUOTED",
")",
";",
"switch",
"(",
"$",
... | Scalars | [
"Scalars"
] | train | https://github.com/apioo/psx-sandbox/blob/5d136a398da375056e6526bbbc85d7f5d3df9441/src/Printer.php#L145-L178 |
apioo/psx-sandbox | src/Printer.php | Printer.pExpr_BinaryOp_Plus | protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node)
{
return $this->pInfixOp('Expr_BinaryOp_Plus', $node->left, ' + ', $node->right);
} | php | protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node)
{
return $this->pInfixOp('Expr_BinaryOp_Plus', $node->left, ' + ', $node->right);
} | [
"protected",
"function",
"pExpr_BinaryOp_Plus",
"(",
"BinaryOp",
"\\",
"Plus",
"$",
"node",
")",
"{",
"return",
"$",
"this",
"->",
"pInfixOp",
"(",
"'Expr_BinaryOp_Plus'",
",",
"$",
"node",
"->",
"left",
",",
"' + '",
",",
"$",
"node",
"->",
"right",
")",
... | Binary expressions | [
"Binary",
"expressions"
] | train | https://github.com/apioo/psx-sandbox/blob/5d136a398da375056e6526bbbc85d7f5d3df9441/src/Printer.php#L327-L330 |
apioo/psx-sandbox | src/Printer.php | Printer.pExpr_FuncCall | protected function pExpr_FuncCall(Expr\FuncCall $node)
{
$functionName = $this->pCallLhs($node->name);
$this->securityManager->checkFunctionCall($functionName, $node->args);
return $functionName
. '(' . $this->pMaybeMultiline($node->args) . ')';
} | php | protected function pExpr_FuncCall(Expr\FuncCall $node)
{
$functionName = $this->pCallLhs($node->name);
$this->securityManager->checkFunctionCall($functionName, $node->args);
return $functionName
. '(' . $this->pMaybeMultiline($node->args) . ')';
} | [
"protected",
"function",
"pExpr_FuncCall",
"(",
"Expr",
"\\",
"FuncCall",
"$",
"node",
")",
"{",
"$",
"functionName",
"=",
"$",
"this",
"->",
"pCallLhs",
"(",
"$",
"node",
"->",
"name",
")",
";",
"$",
"this",
"->",
"securityManager",
"->",
"checkFunctionCa... | Function calls and similar constructs | [
"Function",
"calls",
"and",
"similar",
"constructs"
] | train | https://github.com/apioo/psx-sandbox/blob/5d136a398da375056e6526bbbc85d7f5d3df9441/src/Printer.php#L563-L571 |
zodream/thirdparty | src/ALi/ZhiMa.php | ZhiMa.authQuery | public function authQuery($userId) {
$data = $this->getAuthQuery()->parameters([
'identity_param' => Json::encode([
'userId' => $userId
])
])->text();
return isset($data['authorized']) && $data['authorized'];
} | php | public function authQuery($userId) {
$data = $this->getAuthQuery()->parameters([
'identity_param' => Json::encode([
'userId' => $userId
])
])->text();
return isset($data['authorized']) && $data['authorized'];
} | [
"public",
"function",
"authQuery",
"(",
"$",
"userId",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getAuthQuery",
"(",
")",
"->",
"parameters",
"(",
"[",
"'identity_param'",
"=>",
"Json",
"::",
"encode",
"(",
"[",
"'userId'",
"=>",
"$",
"userId",
"... | 判断用户是否授权
@param $userId
@return bool
@throws \Exception | [
"判断用户是否授权"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/ZhiMa.php#L70-L77 |
zodream/thirdparty | src/ALi/ZhiMa.php | ZhiMa.hasScore | public function hasScore($cert_no, $score, $cert_type = 'IDENTITY_CARD') {
$data = $this->getHasScore()->parameters([
'cert_type' => $cert_type,
'cert_no' => $cert_no,
'admittance_score' => $score,
])->text();
return isset($data['is_admittance']) && $data['is_... | php | public function hasScore($cert_no, $score, $cert_type = 'IDENTITY_CARD') {
$data = $this->getHasScore()->parameters([
'cert_type' => $cert_type,
'cert_no' => $cert_no,
'admittance_score' => $score,
])->text();
return isset($data['is_admittance']) && $data['is_... | [
"public",
"function",
"hasScore",
"(",
"$",
"cert_no",
",",
"$",
"score",
",",
"$",
"cert_type",
"=",
"'IDENTITY_CARD'",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getHasScore",
"(",
")",
"->",
"parameters",
"(",
"[",
"'cert_type'",
"=>",
"$",
"ce... | 用于商户做准入判断 商户输入准入分 判断用户是否准入
@param $cert_no
@param $score
@param string $cert_type
@return bool
@throws \Exception | [
"用于商户做准入判断",
"商户输入准入分",
"判断用户是否准入"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/ZhiMa.php#L102-L109 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Annotation.php | Annotation.getClosureHelpers | public static function getClosureHelpers() {
// constructor
$doctrineAnnotation = function ($shortName, Array $properties = array()) {
return \Psc\Doctrine\Annotation::createDC($shortName)->setProperties($properties);
};
// others
$joinColumn = function ($name, $referencedColumnName = 'id... | php | public static function getClosureHelpers() {
// constructor
$doctrineAnnotation = function ($shortName, Array $properties = array()) {
return \Psc\Doctrine\Annotation::createDC($shortName)->setProperties($properties);
};
// others
$joinColumn = function ($name, $referencedColumnName = 'id... | [
"public",
"static",
"function",
"getClosureHelpers",
"(",
")",
"{",
"// constructor",
"$",
"doctrineAnnotation",
"=",
"function",
"(",
"$",
"shortName",
",",
"Array",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"return",
"\\",
"Psc",
"\\",
"Doctrine... | Gibt alle Helpers für DoctrineAnnotations (oder andere) zurück
Jeder Closure-Helper stellt eine Annotation dar und gibt für diese ein explizites interface:
- $joinTable($name, $joinColumn(s), $inverseJoinColumn(s))
für die columns kann ein array angegeben werden, muss aber nicht
- $joinColumn($name, $referencedColum... | [
"Gibt",
"alle",
"Helpers",
"für",
"DoctrineAnnotations",
"(",
"oder",
"andere",
")",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Annotation.php#L146-L204 |
atkrad/data-tables | src/Column.php | Column.setCreatedCell | public function setCreatedCell($createdCell)
{
$hash = sha1($createdCell);
$this->properties['createdCell'] = $hash;
$this->callbacks[$hash] = $createdCell;
return $this;
} | php | public function setCreatedCell($createdCell)
{
$hash = sha1($createdCell);
$this->properties['createdCell'] = $hash;
$this->callbacks[$hash] = $createdCell;
return $this;
} | [
"public",
"function",
"setCreatedCell",
"(",
"$",
"createdCell",
")",
"{",
"$",
"hash",
"=",
"sha1",
"(",
"$",
"createdCell",
")",
";",
"$",
"this",
"->",
"properties",
"[",
"'createdCell'",
"]",
"=",
"$",
"hash",
";",
"$",
"this",
"->",
"callbacks",
"... | This is a callback function that is executed whenever a cell is created (Ajax source, etc) or read from a
DOM source. It can be used as a compliment to columns.renderDT allowing modification of the cell's
DOM element (add background colour for example) when the element is created (cells my not be
immediately created on... | [
"This",
"is",
"a",
"callback",
"function",
"that",
"is",
"executed",
"whenever",
"a",
"cell",
"is",
"created",
"(",
"Ajax",
"source",
"etc",
")",
"or",
"read",
"from",
"a",
"DOM",
"source",
".",
"It",
"can",
"be",
"used",
"as",
"a",
"compliment",
"to",... | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Column.php#L113-L120 |
atkrad/data-tables | src/Column.php | Column.setData | public function setData($data)
{
if (is_string($data)) {
$pattern = '/^(\s+)*(function)(\s+)*\(/i';
if (preg_match($pattern, $data, $matches) && strtolower($matches[2]) == 'function') {
$hash = sha1($data);
$this->properties['data'] = $hash;
... | php | public function setData($data)
{
if (is_string($data)) {
$pattern = '/^(\s+)*(function)(\s+)*\(/i';
if (preg_match($pattern, $data, $matches) && strtolower($matches[2]) == 'function') {
$hash = sha1($data);
$this->properties['data'] = $hash;
... | [
"public",
"function",
"setData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"pattern",
"=",
"'/^(\\s+)*(function)(\\s+)*\\(/i'",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"data",
",",
"$... | Set the data source for the column from the rows data object / array
This property can be used to read data from any data source property, including deeply nested objects
/ properties. data can be given in a number of different ways which effect its behaviour as
documented below.
@param int|string|null|js object|call... | [
"Set",
"the",
"data",
"source",
"for",
"the",
"column",
"from",
"the",
"rows",
"data",
"object",
"/",
"array"
] | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Column.php#L135-L155 |
atkrad/data-tables | src/Column.php | Column.setRender | public function setRender($render)
{
if (is_string($render)) {
$pattern = '/^(\s+)*(function)(\s+)*\(/i';
if (preg_match($pattern, $render, $matches) && strtolower($matches[2]) == 'function') {
$hash = sha1($render);
$this->properties['render'] = $hash... | php | public function setRender($render)
{
if (is_string($render)) {
$pattern = '/^(\s+)*(function)(\s+)*\(/i';
if (preg_match($pattern, $render, $matches) && strtolower($matches[2]) == 'function') {
$hash = sha1($render);
$this->properties['render'] = $hash... | [
"public",
"function",
"setRender",
"(",
"$",
"render",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"render",
")",
")",
"{",
"$",
"pattern",
"=",
"'/^(\\s+)*(function)(\\s+)*\\(/i'",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"render",
"... | This property is the rendering partner to columns.dataDT and it is suggested that when you want to
manipulate data for display (including filtering, sorting etc) without altering the underlying data for the
table, use this property. render can be considered to be the the read only companion to data which
is read / writ... | [
"This",
"property",
"is",
"the",
"rendering",
"partner",
"to",
"columns",
".",
"dataDT",
"and",
"it",
"is",
"suggested",
"that",
"when",
"you",
"want",
"to",
"manipulate",
"data",
"for",
"display",
"(",
"including",
"filtering",
"sorting",
"etc",
")",
"witho... | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Column.php#L289-L306 |
jacobemerick/pqp | src/Display.php | Display.getReadableTime | protected function getReadableTime($time, $percision = 3)
{
$unit = 's';
if ($time < 1) {
$time *= 1000;
$percision = 0;
$unit = 'ms';
} elseif ($time > 60) {
$time /= 60;
$unit = 'm';
}
$time = number_format($time, ... | php | protected function getReadableTime($time, $percision = 3)
{
$unit = 's';
if ($time < 1) {
$time *= 1000;
$percision = 0;
$unit = 'ms';
} elseif ($time > 60) {
$time /= 60;
$unit = 'm';
}
$time = number_format($time, ... | [
"protected",
"function",
"getReadableTime",
"(",
"$",
"time",
",",
"$",
"percision",
"=",
"3",
")",
"{",
"$",
"unit",
"=",
"'s'",
";",
"if",
"(",
"$",
"time",
"<",
"1",
")",
"{",
"$",
"time",
"*=",
"1000",
";",
"$",
"percision",
"=",
"0",
";",
... | Formatter for human-readable time
Only handles time up to 60 minutes gracefully
@param double $time
@param integer $percision
@return string | [
"Formatter",
"for",
"human",
"-",
"readable",
"time",
"Only",
"handles",
"time",
"up",
"to",
"60",
"minutes",
"gracefully"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/Display.php#L311-L324 |
jacobemerick/pqp | src/Display.php | Display.getReadableMemory | protected function getReadableMemory($size, $percision = 2)
{
$unitOptions = array('b', 'k', 'M', 'G');
$base = log($size, 1024);
$memory = round(pow(1024, $base - floor($base)), $percision);
$unit = $unitOptions[floor($base)];
return "{$memory} {$unit}";
} | php | protected function getReadableMemory($size, $percision = 2)
{
$unitOptions = array('b', 'k', 'M', 'G');
$base = log($size, 1024);
$memory = round(pow(1024, $base - floor($base)), $percision);
$unit = $unitOptions[floor($base)];
return "{$memory} {$unit}";
} | [
"protected",
"function",
"getReadableMemory",
"(",
"$",
"size",
",",
"$",
"percision",
"=",
"2",
")",
"{",
"$",
"unitOptions",
"=",
"array",
"(",
"'b'",
",",
"'k'",
",",
"'M'",
",",
"'G'",
")",
";",
"$",
"base",
"=",
"log",
"(",
"$",
"size",
",",
... | Formatter for human-readable memory
Only handles time up to a few gigs gracefully
@param double $size
@param integer $percision | [
"Formatter",
"for",
"human",
"-",
"readable",
"memory",
"Only",
"handles",
"time",
"up",
"to",
"a",
"few",
"gigs",
"gracefully"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/Display.php#L333-L342 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/ControllerService.php | ControllerService.isResponsibleFor | public function isResponsibleFor(ServiceRequest $request) {
/*
hier könnte man mal den request hashen, dann den controller suchen und zu dem hash speichern
dann könnte man den controller bei route() direkt aufrufen
*/
$this->log('überprüfe ob verantwortlich für: '.$request->debug());
try {
... | php | public function isResponsibleFor(ServiceRequest $request) {
/*
hier könnte man mal den request hashen, dann den controller suchen und zu dem hash speichern
dann könnte man den controller bei route() direkt aufrufen
*/
$this->log('überprüfe ob verantwortlich für: '.$request->debug());
try {
... | [
"public",
"function",
"isResponsibleFor",
"(",
"ServiceRequest",
"$",
"request",
")",
"{",
"/*\n hier könnte man mal den request hashen, dann den controller suchen und zu dem hash speichern\n dann könnte man den controller bei route() direkt aufrufen\n */",
"$",
"this",
"->",
... | Gibt True zurück wenn der Service den ServiceRequest erfolgreich bearbeiten kann
@todo "erfolgreich" definieren
@return bool | [
"Gibt",
"True",
"zurück",
"wenn",
"der",
"Service",
"den",
"ServiceRequest",
"erfolgreich",
"bearbeiten",
"kann"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/ControllerService.php#L58-L77 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/ControllerService.php | ControllerService.route | public function route(ServiceRequest $request) {
list ($controller, $method, $params) = $this->routeController($request);
$this->validateController($controller, $method, $params);
$this->runController(
$controller, $method, $params
);
return $this->response;
} | php | public function route(ServiceRequest $request) {
list ($controller, $method, $params) = $this->routeController($request);
$this->validateController($controller, $method, $params);
$this->runController(
$controller, $method, $params
);
return $this->response;
} | [
"public",
"function",
"route",
"(",
"ServiceRequest",
"$",
"request",
")",
"{",
"list",
"(",
"$",
"controller",
",",
"$",
"method",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"routeController",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
... | Führt den ServiceRequest aus
ruft den passenden ServiceController auf
@return ServiceResponse | [
"Führt",
"den",
"ServiceRequest",
"aus"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/ControllerService.php#L94-L104 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/ControllerService.php | ControllerService.runController | public function runController($controller, $method, Array $params) {
$transactional = $controller instanceof \Psc\CMS\Controller\TransactionalController;
try {
try {
$this->logf('running Controller: %s::%s(%s)', Code::getClass($controller), $method, implode(', ',array_map(function ($param) { ... | php | public function runController($controller, $method, Array $params) {
$transactional = $controller instanceof \Psc\CMS\Controller\TransactionalController;
try {
try {
$this->logf('running Controller: %s::%s(%s)', Code::getClass($controller), $method, implode(', ',array_map(function ($param) { ... | [
"public",
"function",
"runController",
"(",
"$",
"controller",
",",
"$",
"method",
",",
"Array",
"$",
"params",
")",
"{",
"$",
"transactional",
"=",
"$",
"controller",
"instanceof",
"\\",
"Psc",
"\\",
"CMS",
"\\",
"Controller",
"\\",
"TransactionalController",... | Führt den Controller aus
catched dabei Exceptions und wandelt diese gegebenfalls in Error-Responses um | [
"Führt",
"den",
"Controller",
"aus"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/ControllerService.php#L126-L157 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/ControllerService.php | ControllerService.getControllersNamespace | public function getControllersNamespace() {
if (!isset($this->controllersNamespace)) {
$this->controllersNamespace = $this->project->getNamespace().'\\Controllers'; // siehe auch CreateControllerCommand, SimpleContainerEntityService
}
return $this->controllersNamespace;
} | php | public function getControllersNamespace() {
if (!isset($this->controllersNamespace)) {
$this->controllersNamespace = $this->project->getNamespace().'\\Controllers'; // siehe auch CreateControllerCommand, SimpleContainerEntityService
}
return $this->controllersNamespace;
} | [
"public",
"function",
"getControllersNamespace",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"controllersNamespace",
")",
")",
"{",
"$",
"this",
"->",
"controllersNamespace",
"=",
"$",
"this",
"->",
"project",
"->",
"getNamespace",
"(",
... | Gibt den Namespace für die Controllers des Service zurück
ohne \ davor und dahinter | [
"Gibt",
"den",
"Namespace",
"für",
"die",
"Controllers",
"des",
"Service",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/ControllerService.php#L249-L254 |
localhook/localhook | src/Command/AbstractCommand.php | AbstractCommand.loadConfiguration | protected function loadConfiguration()
{
try {
$configuration = $this->configurationStorage->loadFromFile()->get();
} catch (NoConfigurationException $e) {
$this->io->comment($e->getMessage());
if (!$this->secret) {
$this->secret = $this->io->ask... | php | protected function loadConfiguration()
{
try {
$configuration = $this->configurationStorage->loadFromFile()->get();
} catch (NoConfigurationException $e) {
$this->io->comment($e->getMessage());
if (!$this->secret) {
$this->secret = $this->io->ask... | [
"protected",
"function",
"loadConfiguration",
"(",
")",
"{",
"try",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"configurationStorage",
"->",
"loadFromFile",
"(",
")",
"->",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"NoConfigurationException",
"$",
"e"... | Loads the local configuration from "~/.localhook/config.json" file. | [
"Loads",
"the",
"local",
"configuration",
"from",
"~",
"/",
".",
"localhook",
"/",
"config",
".",
"json",
"file",
"."
] | train | https://github.com/localhook/localhook/blob/f8010a7f06ddd514b224ad70dc62e425125d4feb/src/Command/AbstractCommand.php#L39-L55 |
VincentChalnot/SidusAdminBundle | Templating/TemplateResolver.php | TemplateResolver.getTemplate | public function getTemplate(Action $action, $format = 'html'): \Twig_Template
{
$admin = $action->getAdmin();
if ($action->getTemplate()) {
// If the template was specified, do not try to fallback
return $this->twig->loadTemplate($action->getTemplate());
}
//... | php | public function getTemplate(Action $action, $format = 'html'): \Twig_Template
{
$admin = $action->getAdmin();
if ($action->getTemplate()) {
// If the template was specified, do not try to fallback
return $this->twig->loadTemplate($action->getTemplate());
}
//... | [
"public",
"function",
"getTemplate",
"(",
"Action",
"$",
"action",
",",
"$",
"format",
"=",
"'html'",
")",
":",
"\\",
"Twig_Template",
"{",
"$",
"admin",
"=",
"$",
"action",
"->",
"getAdmin",
"(",
")",
";",
"if",
"(",
"$",
"action",
"->",
"getTemplate"... | @param Action $action
@param string $format
@return \Twig_Template | [
"@param",
"Action",
"$action",
"@param",
"string",
"$format"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Templating/TemplateResolver.php#L53-L144 |
hendrikmaus/reynaldo | src/Elements/BaseElement.php | BaseElement.addContentElement | public function addContentElement(ApiElement $element)
{
$newContent = [];
$rawElements = [];
$content = $this->getContent();
if ($this->hasCopy()) {
$newContent[] = array_shift($content);
}
foreach ($content as $resourceGroup) {
if (!is_arra... | php | public function addContentElement(ApiElement $element)
{
$newContent = [];
$rawElements = [];
$content = $this->getContent();
if ($this->hasCopy()) {
$newContent[] = array_shift($content);
}
foreach ($content as $resourceGroup) {
if (!is_arra... | [
"public",
"function",
"addContentElement",
"(",
"ApiElement",
"$",
"element",
")",
"{",
"$",
"newContent",
"=",
"[",
"]",
";",
"$",
"rawElements",
"=",
"[",
"]",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"$"... | Add content element to the current content
This method has to be used sequentially while querying the recursive
element tree. It will replace the raw content element one by one, top to bottom.
Example:
- copy element
- raw array element (1)
- raw array element (2)
Calling `addContentElement` with a resource element... | [
"Add",
"content",
"element",
"to",
"the",
"current",
"content"
] | train | https://github.com/hendrikmaus/reynaldo/blob/be100f56e8f39d86d16ce9222838d20f462e8678/src/Elements/BaseElement.php#L52-L74 |
hendrikmaus/reynaldo | src/Elements/BaseElement.php | BaseElement.getCopyText | public function getCopyText()
{
$content = $this->getContent();
$copy = array_shift($content);
if (!is_array($copy)) {
return null;
}
if ($copy['element'] !== 'copy') {
return null;
}
return $copy['content'];
} | php | public function getCopyText()
{
$content = $this->getContent();
$copy = array_shift($content);
if (!is_array($copy)) {
return null;
}
if ($copy['element'] !== 'copy') {
return null;
}
return $copy['content'];
} | [
"public",
"function",
"getCopyText",
"(",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"$",
"copy",
"=",
"array_shift",
"(",
"$",
"content",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"copy",
")",
")",
"{",
... | Get the copy text of the current element; raw markdown likely
@api
@return string|null | [
"Get",
"the",
"copy",
"text",
"of",
"the",
"current",
"element",
";",
"raw",
"markdown",
"likely"
] | train | https://github.com/hendrikmaus/reynaldo/blob/be100f56e8f39d86d16ce9222838d20f462e8678/src/Elements/BaseElement.php#L109-L123 |
hendrikmaus/reynaldo | src/Elements/BaseElement.php | BaseElement.getElementsByType | public function getElementsByType($fqcn)
{
$elements = [];
$content = $this->getContent();
foreach ($content as $element) {
if ($element instanceof $fqcn) {
$elements[] = $element;
}
}
return $elements;
} | php | public function getElementsByType($fqcn)
{
$elements = [];
$content = $this->getContent();
foreach ($content as $element) {
if ($element instanceof $fqcn) {
$elements[] = $element;
}
}
return $elements;
} | [
"public",
"function",
"getElementsByType",
"(",
"$",
"fqcn",
")",
"{",
"$",
"elements",
"=",
"[",
"]",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"foreach",
"(",
"$",
"content",
"as",
"$",
"element",
")",
"{",
"if",
"... | Query content of current element (single level) for elements of given type
@param string $fqcn Fully Qualified Class Name, e.g. ResourceElement::class
@return ApiElement[] | [
"Query",
"content",
"of",
"current",
"element",
"(",
"single",
"level",
")",
"for",
"elements",
"of",
"given",
"type"
] | train | https://github.com/hendrikmaus/reynaldo/blob/be100f56e8f39d86d16ce9222838d20f462e8678/src/Elements/BaseElement.php#L142-L154 |
hendrikmaus/reynaldo | src/Elements/BaseElement.php | BaseElement.getFirstElementByType | public function getFirstElementByType($fqcn)
{
$match = null;
foreach ($this->getContent() as $element) {
if (!($element instanceof $fqcn)) {
continue;
}
$match = $element;
break;
}
return $match;
} | php | public function getFirstElementByType($fqcn)
{
$match = null;
foreach ($this->getContent() as $element) {
if (!($element instanceof $fqcn)) {
continue;
}
$match = $element;
break;
}
return $match;
} | [
"public",
"function",
"getFirstElementByType",
"(",
"$",
"fqcn",
")",
"{",
"$",
"match",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"getContent",
"(",
")",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"element",
"instanceof",
"... | Find the first occurrence of a given element inside the content (single level)
@param string $fqcn Fully Qualified Class Name, e.g. ResourceElement::class
@return ApiElement|null | [
"Find",
"the",
"first",
"occurrence",
"of",
"a",
"given",
"element",
"inside",
"the",
"content",
"(",
"single",
"level",
")"
] | train | https://github.com/hendrikmaus/reynaldo/blob/be100f56e8f39d86d16ce9222838d20f462e8678/src/Elements/BaseElement.php#L162-L176 |
hendrikmaus/reynaldo | src/Elements/BaseElement.php | BaseElement.hasClass | public function hasClass($className)
{
foreach ($this->meta['classes'] as $classInMeta) {
if ($classInMeta === $className) {
return true;
}
}
return false;
} | php | public function hasClass($className)
{
foreach ($this->meta['classes'] as $classInMeta) {
if ($classInMeta === $className) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasClass",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"meta",
"[",
"'classes'",
"]",
"as",
"$",
"classInMeta",
")",
"{",
"if",
"(",
"$",
"classInMeta",
"===",
"$",
"className",
")",
"{",
"return",
"true",... | Check whether or not this element has a given class
@param string $className e.g. 'resourceGroup', 'messageBody'
@return bool | [
"Check",
"whether",
"or",
"not",
"this",
"element",
"has",
"a",
"given",
"class"
] | train | https://github.com/hendrikmaus/reynaldo/blob/be100f56e8f39d86d16ce9222838d20f462e8678/src/Elements/BaseElement.php#L199-L208 |
orzcc/autometa | src/AutoMeta/Providers/AutoMetaServiceProvider.php | AutoMetaServiceProvider.register | public function register()
{
$this->app->singleton('autometa', function ($app) {
return new AutoMeta($app['config']->get('autometa', []));
});
$this->app->bind('Orzcc\AutoMeta\Contracts\MetaTags', 'Orzcc\AutoMeta\MetaTags');
} | php | public function register()
{
$this->app->singleton('autometa', function ($app) {
return new AutoMeta($app['config']->get('autometa', []));
});
$this->app->bind('Orzcc\AutoMeta\Contracts\MetaTags', 'Orzcc\AutoMeta\MetaTags');
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'autometa'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"AutoMeta",
"(",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'autom... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/orzcc/autometa/blob/1e3bd93f364e2619c9c20820399735c9fe805c9c/src/AutoMeta/Providers/AutoMetaServiceProvider.php#L35-L42 |
Lansoweb/LosBase | src/LosBase/DBAL/Types/BrDateTimeType.php | BrDateTimeType.convertToPHPValue | public function convertToPHPValue($value, AbstractPlatform $platform)
{
$val = parent::convertToPHPValue($value, $platform);
return $val->setTimezone(new \DateTimeZone('America/Sao_Paulo'));
} | php | public function convertToPHPValue($value, AbstractPlatform $platform)
{
$val = parent::convertToPHPValue($value, $platform);
return $val->setTimezone(new \DateTimeZone('America/Sao_Paulo'));
} | [
"public",
"function",
"convertToPHPValue",
"(",
"$",
"value",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"$",
"val",
"=",
"parent",
"::",
"convertToPHPValue",
"(",
"$",
"value",
",",
"$",
"platform",
")",
";",
"return",
"$",
"val",
"->",
"setTimez... | @param string $value
@param DoctrineDBALPlatformsAbstractPlatform $platform
@return DateTime|mixed|null
@throws DoctrineDBALTypesConversionException | [
"@param",
"string",
"$value",
"@param",
"DoctrineDBALPlatformsAbstractPlatform",
"$platform"
] | train | https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/DBAL/Types/BrDateTimeType.php#L17-L22 |
webforge-labs/psc-cms | lib/Psc/CMS/AssociationsLister.php | AssociationsLister.getHTMLForList | public function getHTMLForList(AssociationList $assoc) {
if (!isset($this->entity)) {
throw new \RuntimeException('Entity muss gesetzt sein, wenn html() oder init() aufgerufen wird');
}
$entities = $this->getAssocEntities($assoc); // die collection, ist klar
if (($sorter = $assoc->getSor... | php | public function getHTMLForList(AssociationList $assoc) {
if (!isset($this->entity)) {
throw new \RuntimeException('Entity muss gesetzt sein, wenn html() oder init() aufgerufen wird');
}
$entities = $this->getAssocEntities($assoc); // die collection, ist klar
if (($sorter = $assoc->getSor... | [
"public",
"function",
"getHTMLForList",
"(",
"AssociationList",
"$",
"assoc",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"entity",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Entity muss gesetzt sein, wenn html() oder init() auf... | Gibt das HTML für die AssociationList zurück
ist $assoc->limit angegeben und ist die anzahl der entities größer als diess wird $assoc->limitMessage zurückgegeben
sind keine Entities zu finden, wird $assoc->emptyText zurückgegeben
ansonsten wird für jedes Entities $assoc.withLabel oder ein button erzeugt (withButton(TR... | [
"Gibt",
"das",
"HTML",
"für",
"die",
"AssociationList",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/AssociationsLister.php#L42-L71 |
webforge-labs/psc-cms | lib/Psc/Config.php | Config.reqDefault | public static function reqDefault($keys, $defaultValue) {
try {
$value = self::req($keys);
} catch (MissingConfigVariableException $e) {
if (is_string($defaultValue) && !Preg::match($defaultValue,'/^(\'|")/') && !self::NEW_ARRAY) {
$defaultValue = "'".$defaultValue."'";
}
... | php | public static function reqDefault($keys, $defaultValue) {
try {
$value = self::req($keys);
} catch (MissingConfigVariableException $e) {
if (is_string($defaultValue) && !Preg::match($defaultValue,'/^(\'|")/') && !self::NEW_ARRAY) {
$defaultValue = "'".$defaultValue."'";
}
... | [
"public",
"static",
"function",
"reqDefault",
"(",
"$",
"keys",
",",
"$",
"defaultValue",
")",
"{",
"try",
"{",
"$",
"value",
"=",
"self",
"::",
"req",
"(",
"$",
"keys",
")",
";",
"}",
"catch",
"(",
"MissingConfigVariableException",
"$",
"e",
")",
"{",... | Required eine Variable, schlägt aber einen Default für die Config-Variable vor | [
"Required",
"eine",
"Variable",
"schlägt",
"aber",
"einen",
"Default",
"für",
"die",
"Config",
"-",
"Variable",
"vor"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Config.php#L60-L74 |
webforge-labs/psc-cms | lib/Psc/Config.php | Config.getDefault | public static function getDefault($keys, $defaultValue) {
try {
$value = self::req($keys);
} catch (MissingConfigVariableException $e) {
return $defaultValue;
}
return $value;
} | php | public static function getDefault($keys, $defaultValue) {
try {
$value = self::req($keys);
} catch (MissingConfigVariableException $e) {
return $defaultValue;
}
return $value;
} | [
"public",
"static",
"function",
"getDefault",
"(",
"$",
"keys",
",",
"$",
"defaultValue",
")",
"{",
"try",
"{",
"$",
"value",
"=",
"self",
"::",
"req",
"(",
"$",
"keys",
")",
";",
"}",
"catch",
"(",
"MissingConfigVariableException",
"$",
"e",
")",
"{",... | Required eine Variable, schlägt aber einen Default für die Config-Variable vor | [
"Required",
"eine",
"Variable",
"schlägt",
"aber",
"einen",
"Default",
"für",
"die",
"Config",
"-",
"Variable",
"vor"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Config.php#L81-L89 |
tbreuss/pvc | src/Middleware/RequestHandler.php | RequestHandler.handle | public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->request = $request;
$response = (new HttpFactory())->createResponse();
$response = $response->withHeader('Content-Type', 'text/html');
$pathInfo = RequestHelper::getPathInfo($request);
try {
... | php | public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->request = $request;
$response = (new HttpFactory())->createResponse();
$response = $response->withHeader('Content-Type', 'text/html');
$pathInfo = RequestHelper::getPathInfo($request);
try {
... | [
"public",
"function",
"handle",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"response",
"=",
"(",
"new",
"HttpFactory",
"(",
")",
")",
"->",
"createResponse",... | Handle the request and return a response.
@param ServerRequestInterface $request
@return ResponseInterface
@throws HttpException
@throws SystemException | [
"Handle",
"the",
"request",
"and",
"return",
"a",
"response",
"."
] | train | https://github.com/tbreuss/pvc/blob/ae100351010a8c9f645ccb918f70a26e167de7a7/src/Middleware/RequestHandler.php#L54-L82 |
tbreuss/pvc | src/Middleware/RequestHandler.php | RequestHandler.getHttpGetVars | private function getHttpGetVars(BaseController $controller, string $methodName): array
{
$requestParams = [];
$reflectionMethod = new \ReflectionMethod($controller, $methodName);
$reflectionParameters = $reflectionMethod->getParameters();
foreach ($reflectionParameters as $reflection... | php | private function getHttpGetVars(BaseController $controller, string $methodName): array
{
$requestParams = [];
$reflectionMethod = new \ReflectionMethod($controller, $methodName);
$reflectionParameters = $reflectionMethod->getParameters();
foreach ($reflectionParameters as $reflection... | [
"private",
"function",
"getHttpGetVars",
"(",
"BaseController",
"$",
"controller",
",",
"string",
"$",
"methodName",
")",
":",
"array",
"{",
"$",
"requestParams",
"=",
"[",
"]",
";",
"$",
"reflectionMethod",
"=",
"new",
"\\",
"ReflectionMethod",
"(",
"$",
"c... | Get the HTTP GET vars which are requested by the method using method parameters (a kind of injecting the get
vars into the action method name).
@param BaseController $controller
@param string $methodName
@return array
@throws \ReflectionException | [
"Get",
"the",
"HTTP",
"GET",
"vars",
"which",
"are",
"requested",
"by",
"the",
"method",
"using",
"method",
"parameters",
"(",
"a",
"kind",
"of",
"injecting",
"the",
"get",
"vars",
"into",
"the",
"action",
"method",
"name",
")",
"."
] | train | https://github.com/tbreuss/pvc/blob/ae100351010a8c9f645ccb918f70a26e167de7a7/src/Middleware/RequestHandler.php#L150-L164 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section.php | PHPWord_Section.addLink | public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null) {
$link = new PHPWord_Section_Link($linkSrc, $linkName, $styleFont, $styleParagraph);
$rID = PHPWord_Media::addSectionLinkElement($linkSrc);
$link->setRelationId($rID);
$this->_elementCollection[] = $link;
return... | php | public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null) {
$link = new PHPWord_Section_Link($linkSrc, $linkName, $styleFont, $styleParagraph);
$rID = PHPWord_Media::addSectionLinkElement($linkSrc);
$link->setRelationId($rID);
$this->_elementCollection[] = $link;
return... | [
"public",
"function",
"addLink",
"(",
"$",
"linkSrc",
",",
"$",
"linkName",
"=",
"null",
",",
"$",
"styleFont",
"=",
"null",
",",
"$",
"styleParagraph",
"=",
"null",
")",
"{",
"$",
"link",
"=",
"new",
"PHPWord_Section_Link",
"(",
"$",
"linkSrc",
",",
"... | Add a Link Element
@param string $linkSrc
@param string $linkName
@param mixed $styleFont
@param mixed $styleParagraph
@return PHPWord_Section_Link | [
"Add",
"a",
"Link",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section.php#L126-L133 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section.php | PHPWord_Section.addTable | public function addTable($style = null) {
$table = new PHPWord_Section_Table('section', $this->_sectionCount, $style);
$this->_elementCollection[] = $table;
return $table;
} | php | public function addTable($style = null) {
$table = new PHPWord_Section_Table('section', $this->_sectionCount, $style);
$this->_elementCollection[] = $table;
return $table;
} | [
"public",
"function",
"addTable",
"(",
"$",
"style",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"new",
"PHPWord_Section_Table",
"(",
"'section'",
",",
"$",
"this",
"->",
"_sectionCount",
",",
"$",
"style",
")",
";",
"$",
"this",
"->",
"_elementCollection",
... | Add a Table Element
@param mixed $style
@return PHPWord_Section_Table | [
"Add",
"a",
"Table",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section.php#L159-L163 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section.php | PHPWord_Section.addListItem | public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null) {
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
$this->_elementCollection[] = $listItem;
return $listItem;
} | php | public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null) {
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
$this->_elementCollection[] = $listItem;
return $listItem;
} | [
"public",
"function",
"addListItem",
"(",
"$",
"text",
",",
"$",
"depth",
"=",
"0",
",",
"$",
"styleFont",
"=",
"null",
",",
"$",
"styleList",
"=",
"null",
",",
"$",
"styleParagraph",
"=",
"null",
")",
"{",
"$",
"listItem",
"=",
"new",
"PHPWord_Section... | Add a ListItem Element
@param string $text
@param int $depth
@param mixed $styleFont
@param mixed $styleList
@param mixed $styleParagraph
@return PHPWord_Section_ListItem | [
"Add",
"a",
"ListItem",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section.php#L175-L179 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section.php | PHPWord_Section.addImage | public function addImage($src, $style = null) {
$image = new PHPWord_Section_Image($src, $style);
if(!is_null($image->getSource())) {
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
$image->setRelationId($rID);
$this->_elementCollection[] = $image;
return $image;
} else {
trigge... | php | public function addImage($src, $style = null) {
$image = new PHPWord_Section_Image($src, $style);
if(!is_null($image->getSource())) {
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
$image->setRelationId($rID);
$this->_elementCollection[] = $image;
return $image;
} else {
trigge... | [
"public",
"function",
"addImage",
"(",
"$",
"src",
",",
"$",
"style",
"=",
"null",
")",
"{",
"$",
"image",
"=",
"new",
"PHPWord_Section_Image",
"(",
"$",
"src",
",",
"$",
"style",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"image",
"->",
"getSo... | Add a Image Element
@param string $src
@param mixed $style
@return PHPWord_Section_Image | [
"Add",
"a",
"Image",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section.php#L228-L240 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section.php | PHPWord_Section.addTOC | public function addTOC($styleFont = null, $styleTOC = null) {
$toc = new PHPWord_TOC($styleFont, $styleTOC);
$this->_elementCollection[] = $toc;
return $toc;
} | php | public function addTOC($styleFont = null, $styleTOC = null) {
$toc = new PHPWord_TOC($styleFont, $styleTOC);
$this->_elementCollection[] = $toc;
return $toc;
} | [
"public",
"function",
"addTOC",
"(",
"$",
"styleFont",
"=",
"null",
",",
"$",
"styleTOC",
"=",
"null",
")",
"{",
"$",
"toc",
"=",
"new",
"PHPWord_TOC",
"(",
"$",
"styleFont",
",",
"$",
"styleTOC",
")",
";",
"$",
"this",
"->",
"_elementCollection",
"[",... | Add a Table-of-Contents Element
@param mixed $styleFont
@param mixed $styleTOC
@return PHPWord_TOC | [
"Add",
"a",
"Table",
"-",
"of",
"-",
"Contents",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section.php#L269-L273 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section.php | PHPWord_Section.addTitle | public function addTitle($text, $depth = 1) {
$styles = PHPWord_Style::getStyles();
if(array_key_exists('Heading_'.$depth, $styles)) {
$style = 'Heading'.$depth;
} else {
$style = null;
}
$title = new PHPWord_Section_Title($text, $depth, $style);
$data = PHPWord_TOC::addTitle($text, $depth);
$... | php | public function addTitle($text, $depth = 1) {
$styles = PHPWord_Style::getStyles();
if(array_key_exists('Heading_'.$depth, $styles)) {
$style = 'Heading'.$depth;
} else {
$style = null;
}
$title = new PHPWord_Section_Title($text, $depth, $style);
$data = PHPWord_TOC::addTitle($text, $depth);
$... | [
"public",
"function",
"addTitle",
"(",
"$",
"text",
",",
"$",
"depth",
"=",
"1",
")",
"{",
"$",
"styles",
"=",
"PHPWord_Style",
"::",
"getStyles",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'Heading_'",
".",
"$",
"depth",
",",
"$",
"styles",
... | Add a Title Element
@param string $text
@param int $depth
@return PHPWord_Section_Title | [
"Add",
"a",
"Title",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section.php#L282-L301 |
shrink0r/workflux | src/Transition/ExpressionConstraint.php | ExpressionConstraint.accepts | public function accepts(InputInterface $input, OutputInterface $output): bool
{
return (bool)$this->engine->evaluate(
$this->expression,
[ 'event' => $input->getEvent(), 'input' => $input, 'output' => $output ]
);
} | php | public function accepts(InputInterface $input, OutputInterface $output): bool
{
return (bool)$this->engine->evaluate(
$this->expression,
[ 'event' => $input->getEvent(), 'input' => $input, 'output' => $output ]
);
} | [
"public",
"function",
"accepts",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"bool",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"engine",
"->",
"evaluate",
"(",
"$",
"this",
"->",
"expression",
",",
"[",... | @param InputInterface $input
@param OutputInterface $output
@return bool | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/Transition/ExpressionConstraint.php#L37-L43 |
phpmob/changmin | src/PhpMob/WidgetBundle/DependencyInjection/Compiler/RegisterWidgetPass.php | RegisterWidgetPass.process | public function process(ContainerBuilder $container)
{
$widgets = $container->getParameter('phpmob.widgets');
foreach ($container->findTaggedServiceIds('twig.extension') as $key => $twigs) {
$definition = $container->getDefinition($key);
$class = $definition->getClass();
... | php | public function process(ContainerBuilder $container)
{
$widgets = $container->getParameter('phpmob.widgets');
foreach ($container->findTaggedServiceIds('twig.extension') as $key => $twigs) {
$definition = $container->getDefinition($key);
$class = $definition->getClass();
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"widgets",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'phpmob.widgets'",
")",
";",
"foreach",
"(",
"$",
"container",
"->",
"findTaggedServiceIds",
"(",
"'twig.exte... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/WidgetBundle/DependencyInjection/Compiler/RegisterWidgetPass.php#L30-L64 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/Hostname.php | Zend_Validate_Hostname.isValid | public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
// Check input against IP address schema
if ($this->_ipValidator->setTranslator($this->getTranslator())->isValid($valueString)) {
if (!($this->_allow & self::ALLOW_IP)) {
... | php | public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
// Check input against IP address schema
if ($this->_ipValidator->setTranslator($this->getTranslator())->isValid($valueString)) {
if (!($this->_allow & self::ALLOW_IP)) {
... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"valueString",
"=",
"(",
"string",
")",
"$",
"value",
";",
"$",
"this",
"->",
"_setValue",
"(",
"$",
"valueString",
")",
";",
"// Check input against IP address schema",
"if",
"(",
"$",
"th... | Defined by Zend_Validate_Interface
Returns true if and only if the $value is a valid hostname with respect to the current allow option
@param string $value
@throws Zend_Validate_Exception if a fatal error occurs for validation process
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/Hostname.php#L415-L574 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/Hostname.php | Zend_Validate_Hostname.decodePunycode | protected function decodePunycode($encoded)
{
$matches = array();
$found = preg_match('/([^a-z0-9\x2d]{1,10})$/i', $encoded);
if (empty($encoded) || (count($matches) > 0)) {
// no punycode encoded string, return as is
$this->_error(self::CANNOT_DECODE_PUNYCODE);
... | php | protected function decodePunycode($encoded)
{
$matches = array();
$found = preg_match('/([^a-z0-9\x2d]{1,10})$/i', $encoded);
if (empty($encoded) || (count($matches) > 0)) {
// no punycode encoded string, return as is
$this->_error(self::CANNOT_DECODE_PUNYCODE);
... | [
"protected",
"function",
"decodePunycode",
"(",
"$",
"encoded",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"$",
"found",
"=",
"preg_match",
"(",
"'/([^a-z0-9\\x2d]{1,10})$/i'",
",",
"$",
"encoded",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"enc... | Decodes a punycode encoded string to it's original utf8 string
In case of a decoding failure the original string is returned
@param string $encoded Punycode encoded string to decode
@return string | [
"Decodes",
"a",
"punycode",
"encoded",
"string",
"to",
"it",
"s",
"original",
"utf8",
"string",
"In",
"case",
"of",
"a",
"decoding",
"failure",
"the",
"original",
"string",
"is",
"returned"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/Hostname.php#L583-L672 |
webforge-labs/psc-cms | lib/Psc/UI/Tabs2.php | Tabs2.addItem | public function addItem(TabsContentItem $item) {
if ($item instanceof \Psc\Doctrine\Entity && \Psc\PSC::getProject()->isDevelopment()) {
throw new \Psc\DeprecatedException('Entities übergeben ist deprecated. Psc\CMS\Item\Adapter benutzen.');
}
return $this->add($item->getTabsLabel(TabsContentItem::LAB... | php | public function addItem(TabsContentItem $item) {
if ($item instanceof \Psc\Doctrine\Entity && \Psc\PSC::getProject()->isDevelopment()) {
throw new \Psc\DeprecatedException('Entities übergeben ist deprecated. Psc\CMS\Item\Adapter benutzen.');
}
return $this->add($item->getTabsLabel(TabsContentItem::LAB... | [
"public",
"function",
"addItem",
"(",
"TabsContentItem",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"instanceof",
"\\",
"Psc",
"\\",
"Doctrine",
"\\",
"Entity",
"&&",
"\\",
"Psc",
"\\",
"PSC",
"::",
"getProject",
"(",
")",
"->",
"isDevelopment",
"(",... | Fügt ein TabsContentItem (nur V2) den Tabs hinzu
der Content wird per Ajax geladen mit der URL die das TabsContentItem angibt | [
"Fügt",
"ein",
"TabsContentItem",
"(",
"nur",
"V2",
")",
"den",
"Tabs",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Tabs2.php#L65-L70 |
webforge-labs/psc-cms | lib/Psc/UI/Tabs2.php | Tabs2.addTabOpenable | public function addTabOpenable(TabOpenable $item) {
$rm = $item->getTabRequestMeta();
return $this->add($item->getTabLabel(), NULL, $rm->getUrl(), $this->exporter->convertToId($item));
} | php | public function addTabOpenable(TabOpenable $item) {
$rm = $item->getTabRequestMeta();
return $this->add($item->getTabLabel(), NULL, $rm->getUrl(), $this->exporter->convertToId($item));
} | [
"public",
"function",
"addTabOpenable",
"(",
"TabOpenable",
"$",
"item",
")",
"{",
"$",
"rm",
"=",
"$",
"item",
"->",
"getTabRequestMeta",
"(",
")",
";",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"item",
"->",
"getTabLabel",
"(",
")",
",",
"NULL",
... | Fügt ein TabOpenable den Tabs hinzu | [
"Fügt",
"ein",
"TabOpenable",
"den",
"Tabs",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Tabs2.php#L76-L79 |
webforge-labs/psc-cms | lib/Psc/UI/Tabs2.php | Tabs2.add | public function add($headline, $content = NULL, $contentLink = NULL, $tabName = NULL, $closeable = NULL) {
$this->init();
$this->tabsIndex++;
if (!isset($closeable)) {
$closeable = $this->closeable;
}
if (!isset($tabName)) {
$tabName = $this->prefix.$this->tabsIndex;
}
... | php | public function add($headline, $content = NULL, $contentLink = NULL, $tabName = NULL, $closeable = NULL) {
$this->init();
$this->tabsIndex++;
if (!isset($closeable)) {
$closeable = $this->closeable;
}
if (!isset($tabName)) {
$tabName = $this->prefix.$this->tabsIndex;
}
... | [
"public",
"function",
"add",
"(",
"$",
"headline",
",",
"$",
"content",
"=",
"NULL",
",",
"$",
"contentLink",
"=",
"NULL",
",",
"$",
"tabName",
"=",
"NULL",
",",
"$",
"closeable",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"... | Fügt einen Tab hinzu
Es kann alles angegebenwerden (Low-Level) | [
"Fügt",
"einen",
"Tab",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Tabs2.php#L86-L118 |
webforge-labs/psc-cms | lib/Psc/UI/Tabs2.php | Tabs2.select | public function select($index) {
$this->init();
$this->select = $index;
$this->html->getTemplateContent()->select =
jsHelper::embed(
jsHelper::bootLoad(
array('app/main'),
array('main'),
sprintf("var tabs = main.getTabs(), tab = tabs.tab({index: %d});\n ta... | php | public function select($index) {
$this->init();
$this->select = $index;
$this->html->getTemplateContent()->select =
jsHelper::embed(
jsHelper::bootLoad(
array('app/main'),
array('main'),
sprintf("var tabs = main.getTabs(), tab = tabs.tab({index: %d});\n ta... | [
"public",
"function",
"select",
"(",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"$",
"this",
"->",
"select",
"=",
"$",
"index",
";",
"$",
"this",
"->",
"html",
"->",
"getTemplateContent",
"(",
")",
"->",
"select",
"=",
"jsHel... | Wählt den Index aus, der direkt nach dem Laden der Seite geladen werden soll
dies initialisiert das widget auch auf Javascript-Basis | [
"Wählt",
"den",
"Index",
"aus",
"der",
"direkt",
"nach",
"dem",
"Laden",
"der",
"Seite",
"geladen",
"werden",
"soll"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Tabs2.php#L132-L146 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.deleteContainers | public function deleteContainers($containers, $force = false)
{
if (!empty($containers)) {
if (!isset($containers[0])) {
// single folder, make into array
$containers = [$containers];
}
foreach ($containers as $key => $folder) {
... | php | public function deleteContainers($containers, $force = false)
{
if (!empty($containers)) {
if (!isset($containers[0])) {
// single folder, make into array
$containers = [$containers];
}
foreach ($containers as $key => $folder) {
... | [
"public",
"function",
"deleteContainers",
"(",
"$",
"containers",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"containers",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"containers",
"[",
"0",
"]",
")",
")",
... | Delete multiple containers and all of their content
@param array $containers
@param bool $force Force a delete if it is not empty
@throws DfException
@return array | [
"Delete",
"multiple",
"containers",
"and",
"all",
"of",
"their",
"content"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L79-L103 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.folderExists | public function folderExists($container, $path)
{
$path = FileUtilities::fixFolderPath($path);
if ($this->containerExists($container)) {
if ($this->blobExists($container, $path)) {
return true;
}
}
return false;
} | php | public function folderExists($container, $path)
{
$path = FileUtilities::fixFolderPath($path);
if ($this->containerExists($container)) {
if ($this->blobExists($container, $path)) {
return true;
}
}
return false;
} | [
"public",
"function",
"folderExists",
"(",
"$",
"container",
",",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"FileUtilities",
"::",
"fixFolderPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"this",
"->",
"containerExists",
"(",
"$",
"container",
")",
... | @param string $container
@param $path
@return bool
@throws \Exception | [
"@param",
"string",
"$container",
"@param",
"$path"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L112-L122 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.getFolder | public function getFolder($container, $path, $include_files = true, $include_folders = true, $full_tree = false)
{
$delimiter = ($full_tree) ? '' : '/';
$resources = [];
if ($this->containerExists($container)) {
if (!empty($path)) {
if (!$this->blobExists($contain... | php | public function getFolder($container, $path, $include_files = true, $include_folders = true, $full_tree = false)
{
$delimiter = ($full_tree) ? '' : '/';
$resources = [];
if ($this->containerExists($container)) {
if (!empty($path)) {
if (!$this->blobExists($contain... | [
"public",
"function",
"getFolder",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"include_files",
"=",
"true",
",",
"$",
"include_folders",
"=",
"true",
",",
"$",
"full_tree",
"=",
"false",
")",
"{",
"$",
"delimiter",
"=",
"(",
"$",
"full_tree",
"... | @param string $container
@param string $path
@param bool $include_files
@param bool $include_folders
@param bool $full_tree
@throws NotFoundException
@return array | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"bool",
"$include_files",
"@param",
"bool",
"$include_folders",
"@param",
"bool",
"$full_tree"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L134-L172 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.getFolderProperties | public function getFolderProperties($container, $path)
{
$path = FileUtilities::fixFolderPath($path);
$shortName = FileUtilities::getNameFromPath($path);
$out = ['name' => $shortName, 'path' => $path];
if ($this->containerExists($container) && $this->blobExists($container, $path)) {
... | php | public function getFolderProperties($container, $path)
{
$path = FileUtilities::fixFolderPath($path);
$shortName = FileUtilities::getNameFromPath($path);
$out = ['name' => $shortName, 'path' => $path];
if ($this->containerExists($container) && $this->blobExists($container, $path)) {
... | [
"public",
"function",
"getFolderProperties",
"(",
"$",
"container",
",",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"FileUtilities",
"::",
"fixFolderPath",
"(",
"$",
"path",
")",
";",
"$",
"shortName",
"=",
"FileUtilities",
"::",
"getNameFromPath",
"(",
"$",
... | @param string $container
@param string $path
@throws NotFoundException
@return array | [
"@param",
"string",
"$container",
"@param",
"string",
"$path"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L181-L192 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.createFolder | public function createFolder($container, $path, $is_public = true, $properties = [], $check_exist = true)
{
if (empty($path)) {
throw new BadRequestException("Invalid empty path.");
}
// does this folder already exist?
$path = FileUtilities::fixFolderPath($path);
... | php | public function createFolder($container, $path, $is_public = true, $properties = [], $check_exist = true)
{
if (empty($path)) {
throw new BadRequestException("Invalid empty path.");
}
// does this folder already exist?
$path = FileUtilities::fixFolderPath($path);
... | [
"public",
"function",
"createFolder",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"is_public",
"=",
"true",
",",
"$",
"properties",
"=",
"[",
"]",
",",
"$",
"check_exist",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")"... | @param string $container
@param string $path
@param bool $is_public
@param array $properties
@param bool $check_exist
@throws \Exception
@throws NotFoundException
@throws BadRequestException
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"bool",
"$is_public",
"@param",
"array",
"$properties",
"@param",
"bool",
"$check_exist"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L206-L234 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.copyFolder | public function copyFolder($container, $dest_path, $src_container, $src_path, $check_exist = false)
{
// does this file already exist?
if (!$this->folderExists($container, $src_path)) {
throw new NotFoundException("Folder '$src_path' does not exist.");
}
if ($this->folder... | php | public function copyFolder($container, $dest_path, $src_container, $src_path, $check_exist = false)
{
// does this file already exist?
if (!$this->folderExists($container, $src_path)) {
throw new NotFoundException("Folder '$src_path' does not exist.");
}
if ($this->folder... | [
"public",
"function",
"copyFolder",
"(",
"$",
"container",
",",
"$",
"dest_path",
",",
"$",
"src_container",
",",
"$",
"src_path",
",",
"$",
"check_exist",
"=",
"false",
")",
"{",
"// does this file already exist?",
"if",
"(",
"!",
"$",
"this",
"->",
"folder... | @param string $container
@param string $dest_path
@param string $src_container
@param string $src_path
@param bool $check_exist
@throws \Exception
@throws NotFoundException
@throws BadRequestException
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$dest_path",
"@param",
"string",
"$src_container",
"@param",
"string",
"$src_path",
"@param",
"bool",
"$check_exist"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L248-L280 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.updateFolderProperties | public function updateFolderProperties($container, $path, $properties = [])
{
$path = FileUtilities::fixFolderPath($path);
// does this folder exist?
if (!$this->folderExists($container, $path)) {
throw new NotFoundException("Folder '$path' does not exist.");
}
//... | php | public function updateFolderProperties($container, $path, $properties = [])
{
$path = FileUtilities::fixFolderPath($path);
// does this folder exist?
if (!$this->folderExists($container, $path)) {
throw new NotFoundException("Folder '$path' does not exist.");
}
//... | [
"public",
"function",
"updateFolderProperties",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"$",
"path",
"=",
"FileUtilities",
"::",
"fixFolderPath",
"(",
"$",
"path",
")",
";",
"// does this folder exist?",
"if"... | @param string $container
@param string $path
@param array $properties
@throws NotFoundException
@throws \Exception
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"array",
"$properties"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L291-L301 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.deleteFolder | public function deleteFolder($container, $path, $force = false, $content_only = false)
{
$path = rtrim($path, '/') . '/';
$blobs = $this->listBlobs($container, $path);
if (!empty($blobs)) {
if ((1 === count($blobs)) && (0 === strcasecmp($path, $blobs[0]['name']))) {
... | php | public function deleteFolder($container, $path, $force = false, $content_only = false)
{
$path = rtrim($path, '/') . '/';
$blobs = $this->listBlobs($container, $path);
if (!empty($blobs)) {
if ((1 === count($blobs)) && (0 === strcasecmp($path, $blobs[0]['name']))) {
... | [
"public",
"function",
"deleteFolder",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"force",
"=",
"false",
",",
"$",
"content_only",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/'",
")",
".",
"'/'",
";",
"$",
... | @param string $container
@param string $path
@param bool $force If true, delete folder content as well,
otherwise return error when content present.
@param bool $content_only If true, delete folder itself, false then just the content,
@return void
@throws \Exception | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"bool",
"$force",
"If",
"true",
"delete",
"folder",
"content",
"as",
"well",
"otherwise",
"return",
"error",
"when",
"content",
"present",
".",
"@param",
"bool",
"$content_only",
"If",
"tru... | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L313-L333 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.deleteFolders | public function deleteFolders($container, $folders, $root = '', $force = false)
{
$root = FileUtilities::fixFolderPath($root);
foreach ($folders as $key => $folder) {
try {
// path is full path, name is relative to root, take either
$path = array_get($fold... | php | public function deleteFolders($container, $folders, $root = '', $force = false)
{
$root = FileUtilities::fixFolderPath($root);
foreach ($folders as $key => $folder) {
try {
// path is full path, name is relative to root, take either
$path = array_get($fold... | [
"public",
"function",
"deleteFolders",
"(",
"$",
"container",
",",
"$",
"folders",
",",
"$",
"root",
"=",
"''",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"root",
"=",
"FileUtilities",
"::",
"fixFolderPath",
"(",
"$",
"root",
")",
";",
"foreach",
... | @param string $container
@param array $folders
@param string $root
@param bool $force If true, delete folder content as well,
otherwise return error when content present.
@return array | [
"@param",
"string",
"$container",
"@param",
"array",
"$folders",
"@param",
"string",
"$root",
"@param",
"bool",
"$force",
"If",
"true",
"delete",
"folder",
"content",
"as",
"well",
"otherwise",
"return",
"error",
"when",
"content",
"present",
"."
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L344-L371 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.fileExists | public function fileExists($container, $path)
{
if ($this->containerExists($container)) {
if ($this->blobExists($container, $path)) {
return true;
}
}
return false;
} | php | public function fileExists($container, $path)
{
if ($this->containerExists($container)) {
if ($this->blobExists($container, $path)) {
return true;
}
}
return false;
} | [
"public",
"function",
"fileExists",
"(",
"$",
"container",
",",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"containerExists",
"(",
"$",
"container",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"blobExists",
"(",
"$",
"container",
",",
"$",... | @param string $container
@param $path
@throws \Exception
@return bool | [
"@param",
"string",
"$container",
"@param",
"$path"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L380-L389 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.getFileContent | public function getFileContent($container, $path, $local_file = '', $content_as_base = true)
{
if (!$this->containerExists($container) || !$this->blobExists($container, $path)) {
throw new NotFoundException("File '$path' does not exist in storage.");
}
if (!empty($local_file)) {
... | php | public function getFileContent($container, $path, $local_file = '', $content_as_base = true)
{
if (!$this->containerExists($container) || !$this->blobExists($container, $path)) {
throw new NotFoundException("File '$path' does not exist in storage.");
}
if (!empty($local_file)) {
... | [
"public",
"function",
"getFileContent",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"local_file",
"=",
"''",
",",
"$",
"content_as_base",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"containerExists",
"(",
"$",
"container",
")",
"|... | @param string $container
@param string $path
@param string $local_file
@param bool $content_as_base
@throws NotFoundException
@throws \Exception
@return string | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"string",
"$local_file",
"@param",
"bool",
"$content_as_base"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L401-L420 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.getFileProperties | public function getFileProperties($container, $path, $include_content = false, $content_as_base = true)
{
if (!$this->containerExists($container) || !$this->blobExists($container, $path)) {
throw new NotFoundException("File '$path' does not exist in storage.");
}
$blob = $this->g... | php | public function getFileProperties($container, $path, $include_content = false, $content_as_base = true)
{
if (!$this->containerExists($container) || !$this->blobExists($container, $path)) {
throw new NotFoundException("File '$path' does not exist in storage.");
}
$blob = $this->g... | [
"public",
"function",
"getFileProperties",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"include_content",
"=",
"false",
",",
"$",
"content_as_base",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"containerExists",
"(",
"$",
"container",
... | @param string $container
@param string $path
@param bool $include_content
@param bool $content_as_base
@throws NotFoundException
@throws \Exception
@return array | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"bool",
"$include_content",
"@param",
"bool",
"$content_as_base"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L432-L450 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.streamFile | public function streamFile($container, $path, $download = false)
{
$params = ($download) ? ['disposition' => 'attachment'] : [];
$this->streamBlob($container, $path, $params);
} | php | public function streamFile($container, $path, $download = false)
{
$params = ($download) ? ['disposition' => 'attachment'] : [];
$this->streamBlob($container, $path, $params);
} | [
"public",
"function",
"streamFile",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"download",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"(",
"$",
"download",
")",
"?",
"[",
"'disposition'",
"=>",
"'attachment'",
"]",
":",
"[",
"]",
";",
"$",
... | @param string $container
@param string $path
@param bool $download
@throws \Exception
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"bool",
"$download"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L460-L464 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.updateFileProperties | public function updateFileProperties($container, $path, $properties = [])
{
$path = FileUtilities::fixFolderPath($path);
// does this file exist?
if (!$this->fileExists($container, $path)) {
throw new NotFoundException("Folder '$path' does not exist.");
}
// updat... | php | public function updateFileProperties($container, $path, $properties = [])
{
$path = FileUtilities::fixFolderPath($path);
// does this file exist?
if (!$this->fileExists($container, $path)) {
throw new NotFoundException("Folder '$path' does not exist.");
}
// updat... | [
"public",
"function",
"updateFileProperties",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"$",
"path",
"=",
"FileUtilities",
"::",
"fixFolderPath",
"(",
"$",
"path",
")",
";",
"// does this file exist?",
"if",
... | @param string $container
@param string $path
@param array $properties
@throws NotFoundException
@throws \Exception
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"array",
"$properties"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L475-L485 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.writeFile | public function writeFile($container, $path, $content, $content_is_base = false, $check_exist = false)
{
// does this file already exist?
if ($this->fileExists($container, $path)) {
if (($check_exist)) {
throw new BadRequestException("File '$path' already exists.");
... | php | public function writeFile($container, $path, $content, $content_is_base = false, $check_exist = false)
{
// does this file already exist?
if ($this->fileExists($container, $path)) {
if (($check_exist)) {
throw new BadRequestException("File '$path' already exists.");
... | [
"public",
"function",
"writeFile",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"content",
",",
"$",
"content_is_base",
"=",
"false",
",",
"$",
"check_exist",
"=",
"false",
")",
"{",
"// does this file already exist?",
"if",
"(",
"$",
"this",
"->",
"... | @param string $container
@param string $path
@param string $content
@param boolean $content_is_base
@param bool $check_exist
@throws NotFoundException
@throws \Exception
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"string",
"$content",
"@param",
"boolean",
"$content_is_base",
"@param",
"bool",
"$check_exist"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L498-L520 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.moveFile | public function moveFile($container, $path, $local_path, $check_exist = true)
{
// does local file exist?
if (!file_exists($local_path)) {
throw new NotFoundException("File '$local_path' does not exist.");
}
// does this file already exist?
if ($this->fileExists($... | php | public function moveFile($container, $path, $local_path, $check_exist = true)
{
// does local file exist?
if (!file_exists($local_path)) {
throw new NotFoundException("File '$local_path' does not exist.");
}
// does this file already exist?
if ($this->fileExists($... | [
"public",
"function",
"moveFile",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"local_path",
",",
"$",
"check_exist",
"=",
"true",
")",
"{",
"// does local file exist?",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"local_path",
")",
")",
"{",
"throw",
... | @param string $container
@param string $path
@param string $local_path
@param bool $check_exist
@throws \Exception
@throws NotFoundException
@throws BadRequestException
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"string",
"$local_path",
"@param",
"bool",
"$check_exist"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L533-L556 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.copyFile | public function copyFile($container, $dest_path, $src_container, $src_path, $check_exist = false)
{
// does this file already exist?
if (!$this->fileExists($src_container, $src_path)) {
throw new NotFoundException("File '$src_path' does not exist.");
}
if ($this->fileExis... | php | public function copyFile($container, $dest_path, $src_container, $src_path, $check_exist = false)
{
// does this file already exist?
if (!$this->fileExists($src_container, $src_path)) {
throw new NotFoundException("File '$src_path' does not exist.");
}
if ($this->fileExis... | [
"public",
"function",
"copyFile",
"(",
"$",
"container",
",",
"$",
"dest_path",
",",
"$",
"src_container",
",",
"$",
"src_path",
",",
"$",
"check_exist",
"=",
"false",
")",
"{",
"// does this file already exist?",
"if",
"(",
"!",
"$",
"this",
"->",
"fileExis... | @param string $container
@param string $dest_path
@param string $src_container
@param string $src_path
@param bool $check_exist
@throws \Exception
@throws NotFoundException
@throws BadRequestException
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$dest_path",
"@param",
"string",
"$src_container",
"@param",
"string",
"$src_path",
"@param",
"bool",
"$check_exist"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L570-L590 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.deleteFile | public function deleteFile($container, $path, $noCheck = false)
{
$this->deleteBlob($container, $path, $noCheck);
} | php | public function deleteFile($container, $path, $noCheck = false)
{
$this->deleteBlob($container, $path, $noCheck);
} | [
"public",
"function",
"deleteFile",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"noCheck",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"deleteBlob",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"noCheck",
")",
";",
"}"
] | @param string $container
@param stiring $path
@param bool $noCheck
@return void
@throws \Exception | [
"@param",
"string",
"$container",
"@param",
"stiring",
"$path",
"@param",
"bool",
"$noCheck"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L600-L603 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.deleteFiles | public function deleteFiles($container, $files, $root = '')
{
$root = FileUtilities::fixFolderPath($root);
foreach ($files as $key => $file) {
try {
// path is full path, name is relative to root, take either
$path = array_get($file, 'path');
... | php | public function deleteFiles($container, $files, $root = '')
{
$root = FileUtilities::fixFolderPath($root);
foreach ($files as $key => $file) {
try {
// path is full path, name is relative to root, take either
$path = array_get($file, 'path');
... | [
"public",
"function",
"deleteFiles",
"(",
"$",
"container",
",",
"$",
"files",
",",
"$",
"root",
"=",
"''",
")",
"{",
"$",
"root",
"=",
"FileUtilities",
"::",
"fixFolderPath",
"(",
"$",
"root",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"key"... | @param string $container
@param array $files
@param string $root
@throws BadRequestException
@return array | [
"@param",
"string",
"$container",
"@param",
"array",
"$files",
"@param",
"string",
"$root"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L613-L640 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.getFolderAsZip | public function getFolderAsZip($container, $path, $zip = null, $zipFileName = '', $overwrite = false)
{
$path = FileUtilities::fixFolderPath($path);
$delimiter = '';
if (!$this->containerExists($container)) {
throw new BadRequestException("Can not find directory '$container'.");
... | php | public function getFolderAsZip($container, $path, $zip = null, $zipFileName = '', $overwrite = false)
{
$path = FileUtilities::fixFolderPath($path);
$delimiter = '';
if (!$this->containerExists($container)) {
throw new BadRequestException("Can not find directory '$container'.");
... | [
"public",
"function",
"getFolderAsZip",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"zip",
"=",
"null",
",",
"$",
"zipFileName",
"=",
"''",
",",
"$",
"overwrite",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"FileUtilities",
"::",
"fixFolderPath",
... | @param string $container
@param string $path
@param null|\ZipArchive $zip
@param string $zipFileName
@param bool $overwrite
@throws \Exception
@throws BadRequestException
@throws InternalServerErrorException
@return string Zip File Name created/updated | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"null|",
"\\",
"ZipArchive",
"$zip",
"@param",
"string",
"$zipFileName",
"@param",
"bool",
"$overwrite"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L654-L707 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.extractZipFile | public function extractZipFile($container, $path, $zip, $clean = false, $drop_path = '')
{
if ($clean) {
try {
// clear out anything in this directory
$blobs = $this->listBlobs($container, $path);
if (!empty($blobs)) {
foreach (... | php | public function extractZipFile($container, $path, $zip, $clean = false, $drop_path = '')
{
if ($clean) {
try {
// clear out anything in this directory
$blobs = $this->listBlobs($container, $path);
if (!empty($blobs)) {
foreach (... | [
"public",
"function",
"extractZipFile",
"(",
"$",
"container",
",",
"$",
"path",
",",
"$",
"zip",
",",
"$",
"clean",
"=",
"false",
",",
"$",
"drop_path",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"clean",
")",
"{",
"try",
"{",
"// clear out anything in this... | @param string $container
@param string $path
@param \ZipArchive $zip
@param bool $clean
@param string $drop_path
@return array
@throws \Exception | [
"@param",
"string",
"$container",
"@param",
"string",
"$path",
"@param",
"\\",
"ZipArchive",
"$zip",
"@param",
"bool",
"$clean",
"@param",
"string",
"$drop_path"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L719-L762 |
dreamfactorysoftware/df-file | src/Components/RemoteFileSystem.php | RemoteFileSystem.removeContainerFromPath | private static function removeContainerFromPath($container, $path)
{
if (empty($container)) {
return $path;
}
$container = FileUtilities::fixFolderPath($container);
return substr($path, strlen($container));
} | php | private static function removeContainerFromPath($container, $path)
{
if (empty($container)) {
return $path;
}
$container = FileUtilities::fixFolderPath($container);
return substr($path, strlen($container));
} | [
"private",
"static",
"function",
"removeContainerFromPath",
"(",
"$",
"container",
",",
"$",
"path",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"container",
")",
")",
"{",
"return",
"$",
"path",
";",
"}",
"$",
"container",
"=",
"FileUtilities",
"::",
"fixFo... | @param $container
@param $path
@return string | [
"@param",
"$container",
"@param",
"$path"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/RemoteFileSystem.php#L792-L800 |
phpmob/changmin | src/PhpMob/CoreBundle/EventListener/UserMailerListener.php | UserMailerListener.sendUserRegistrationEmail | public function sendUserRegistrationEmail(GenericEvent $event)
{
if ($this->systemSettingContext->get('security.user_verification')) {
return;
}
$user = $event->getSubject();
Assert::isInstanceOf($user, WebUserInterface::class);
$this->emailSender->send(Emails:... | php | public function sendUserRegistrationEmail(GenericEvent $event)
{
if ($this->systemSettingContext->get('security.user_verification')) {
return;
}
$user = $event->getSubject();
Assert::isInstanceOf($user, WebUserInterface::class);
$this->emailSender->send(Emails:... | [
"public",
"function",
"sendUserRegistrationEmail",
"(",
"GenericEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"systemSettingContext",
"->",
"get",
"(",
"'security.user_verification'",
")",
")",
"{",
"return",
";",
"}",
"$",
"user",
"=",
"$",
... | @param GenericEvent $event
@throws UnexpectedTypeException | [
"@param",
"GenericEvent",
"$event"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/EventListener/UserMailerListener.php#L51-L62 |
geekwright/Po | src/PoInitAbstract.php | PoInitAbstract.msginitFile | public function msginitFile(string $filename): PoFile
{
if (!is_readable($filename)) {
$source = false;
} else {
$source = file_get_contents($filename);
}
if (false===$source) {
throw new FileNotReadableException($filename);
}
retur... | php | public function msginitFile(string $filename): PoFile
{
if (!is_readable($filename)) {
$source = false;
} else {
$source = file_get_contents($filename);
}
if (false===$source) {
throw new FileNotReadableException($filename);
}
retur... | [
"public",
"function",
"msginitFile",
"(",
"string",
"$",
"filename",
")",
":",
"PoFile",
"{",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"source",
"=",
"false",
";",
"}",
"else",
"{",
"$",
"source",
"=",
"file_get_contents... | Inspect the supplied source file, capture gettext references as a PoFile object
@param string $filename name of source file
@return PoFile
@throws FileNotReadableException | [
"Inspect",
"the",
"supplied",
"source",
"file",
"capture",
"gettext",
"references",
"as",
"a",
"PoFile",
"object"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoInitAbstract.php#L173-L184 |
geekwright/Po | src/PoInitAbstract.php | PoInitAbstract.escapeForPo | public function escapeForPo(string $string): string
{
if ($string[0]=='"' || $string[0]=="'") {
$string = substr($string, 1, -1);
}
$string = str_replace("\r\n", "\n", $string);
$string = stripcslashes($string);
return addcslashes($string, "\0..\37\"");
} | php | public function escapeForPo(string $string): string
{
if ($string[0]=='"' || $string[0]=="'") {
$string = substr($string, 1, -1);
}
$string = str_replace("\r\n", "\n", $string);
$string = stripcslashes($string);
return addcslashes($string, "\0..\37\"");
} | [
"public",
"function",
"escapeForPo",
"(",
"string",
"$",
"string",
")",
":",
"string",
"{",
"if",
"(",
"$",
"string",
"[",
"0",
"]",
"==",
"'\"'",
"||",
"$",
"string",
"[",
"0",
"]",
"==",
"\"'\"",
")",
"{",
"$",
"string",
"=",
"substr",
"(",
"$"... | Prepare a string from tokenized output for use in a po file. Remove any
surrounding quotes, escape control characters and double quotes.
@param string $string raw string (T_STRING) identified by php token_get_all
@return string | [
"Prepare",
"a",
"string",
"from",
"tokenized",
"output",
"for",
"use",
"in",
"a",
"po",
"file",
".",
"Remove",
"any",
"surrounding",
"quotes",
"escape",
"control",
"characters",
"and",
"double",
"quotes",
"."
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoInitAbstract.php#L204-L212 |
geekwright/Po | src/PoInitAbstract.php | PoInitAbstract.checkPhpFormatFlag | public function checkPhpFormatFlag(PoEntry $entry): void
{
if (preg_match(
'#(?<!%)%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]#',
$entry->get(PoTokens::MESSAGE) . $entry->get(PoTokens::PLURAL)
)) {
$entry->addFlag('php-format');
}
} | php | public function checkPhpFormatFlag(PoEntry $entry): void
{
if (preg_match(
'#(?<!%)%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]#',
$entry->get(PoTokens::MESSAGE) . $entry->get(PoTokens::PLURAL)
)) {
$entry->addFlag('php-format');
}
} | [
"public",
"function",
"checkPhpFormatFlag",
"(",
"PoEntry",
"$",
"entry",
")",
":",
"void",
"{",
"if",
"(",
"preg_match",
"(",
"'#(?<!%)%(?:\\d+\\$)?[+-]?(?:[ 0]|\\'.{1})?-?\\d*(?:\\.\\d+)?[bcdeEufFgGosxX]#'",
",",
"$",
"entry",
"->",
"get",
"(",
"PoTokens",
"::",
"ME... | Check the supplied entry for sprintf directives and set php-format flag if found
@param PoEntry $entry entry to check
@return void | [
"Check",
"the",
"supplied",
"entry",
"for",
"sprintf",
"directives",
"and",
"set",
"php",
"-",
"format",
"flag",
"if",
"found"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoInitAbstract.php#L221-L229 |
spiral-modules/scaffolder | source/Scaffolder/Commands/CommandCommand.php | CommandCommand.perform | public function perform()
{
/** @var CommandDeclaration $declaration */
$declaration = $this->createDeclaration(compact('alias'));
$declaration->setAlias($this->argument('alias') ?? $this->argument('name'));
$declaration->setDescription((string)$this->option('description'));
... | php | public function perform()
{
/** @var CommandDeclaration $declaration */
$declaration = $this->createDeclaration(compact('alias'));
$declaration->setAlias($this->argument('alias') ?? $this->argument('name'));
$declaration->setDescription((string)$this->option('description'));
... | [
"public",
"function",
"perform",
"(",
")",
"{",
"/** @var CommandDeclaration $declaration */",
"$",
"declaration",
"=",
"$",
"this",
"->",
"createDeclaration",
"(",
"compact",
"(",
"'alias'",
")",
")",
";",
"$",
"declaration",
"->",
"setAlias",
"(",
"$",
"this",... | Create command declaration. | [
"Create",
"command",
"declaration",
"."
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Commands/CommandCommand.php#L36-L45 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/BackendController.php | BackendController.getDatatablesLanguagefileAction | public function getDatatablesLanguagefileAction($sLang)
{
$sPath = $this->get('kernel')->locateResource('@SlashworksBackendBundle/Resources/public/js/plugins/dataTables/languages/' . $sLang . '.json');
$response = new Response(file_get_contents($sPath));
$response->headers-... | php | public function getDatatablesLanguagefileAction($sLang)
{
$sPath = $this->get('kernel')->locateResource('@SlashworksBackendBundle/Resources/public/js/plugins/dataTables/languages/' . $sLang . '.json');
$response = new Response(file_get_contents($sPath));
$response->headers-... | [
"public",
"function",
"getDatatablesLanguagefileAction",
"(",
"$",
"sLang",
")",
"{",
"$",
"sPath",
"=",
"$",
"this",
"->",
"get",
"(",
"'kernel'",
")",
"->",
"locateResource",
"(",
"'@SlashworksBackendBundle/Resources/public/js/plugins/dataTables/languages/'",
".",
"$"... | @param $sLang
@return \Symfony\Component\HttpFoundation\Response | [
"@param",
"$sLang"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/BackendController.php#L40-L49 |
Chill-project/Main | Entity/User.php | User.isGroupCenterPresentOnce | public function isGroupCenterPresentOnce(ExecutionContextInterface $context)
{
$groupCentersIds = array();
foreach ($this->getGroupCenters() as $groupCenter) {
if (in_array($groupCenter->getId(), $groupCentersIds)) {
$context->buildViolation("The user has already those pe... | php | public function isGroupCenterPresentOnce(ExecutionContextInterface $context)
{
$groupCentersIds = array();
foreach ($this->getGroupCenters() as $groupCenter) {
if (in_array($groupCenter->getId(), $groupCentersIds)) {
$context->buildViolation("The user has already those pe... | [
"public",
"function",
"isGroupCenterPresentOnce",
"(",
"ExecutionContextInterface",
"$",
"context",
")",
"{",
"$",
"groupCentersIds",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getGroupCenters",
"(",
")",
"as",
"$",
"groupCenter",
")",
"{... | This function check that groupCenter are present only once. The validator
use this function to avoid a user to be associated to the same groupCenter
more than once. | [
"This",
"function",
"check",
"that",
"groupCenter",
"are",
"present",
"only",
"once",
".",
"The",
"validator",
"use",
"this",
"function",
"to",
"avoid",
"a",
"user",
"to",
"be",
"associated",
"to",
"the",
"same",
"groupCenter",
"more",
"than",
"once",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Entity/User.php#L216-L228 |
yuncms/framework | src/admin/models/UserBizRuleSearch.php | UserBizRuleSearch.search | public function search($params)
{
$models = [];
$included = !($this->load($params) && $this->validate() && trim($this->name) !== '');
foreach (UserRBACHelper::getAuthManager()->getRules() as $name => $item) {
if ($name != RouteRule::RULE_NAME && ($included || stripos($item->name,... | php | public function search($params)
{
$models = [];
$included = !($this->load($params) && $this->validate() && trim($this->name) !== '');
foreach (UserRBACHelper::getAuthManager()->getRules() as $name => $item) {
if ($name != RouteRule::RULE_NAME && ($included || stripos($item->name,... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"models",
"=",
"[",
"]",
";",
"$",
"included",
"=",
"!",
"(",
"$",
"this",
"->",
"load",
"(",
"$",
"params",
")",
"&&",
"$",
"this",
"->",
"validate",
"(",
")",
"&&",
"trim",
"(... | Search BizRule
@param array $params
@return \yii\data\ActiveDataProvider|\yii\data\ArrayDataProvider
@throws \yii\base\InvalidConfigException | [
"Search",
"BizRule"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/models/UserBizRuleSearch.php#L49-L62 |
alanpich/slender | src/Core/Util/Util.php | Util.stringStartsWith | public static function stringStartsWith($str, $prefix)
{
if(is_array($prefix)){
foreach($prefix as $p){
if($p === "" || strpos($str, $p) === 0){
return true;
};
}
return false;
}
return $prefix === "" || ... | php | public static function stringStartsWith($str, $prefix)
{
if(is_array($prefix)){
foreach($prefix as $p){
if($p === "" || strpos($str, $p) === 0){
return true;
};
}
return false;
}
return $prefix === "" || ... | [
"public",
"static",
"function",
"stringStartsWith",
"(",
"$",
"str",
",",
"$",
"prefix",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"prefix",
")",
")",
"{",
"foreach",
"(",
"$",
"prefix",
"as",
"$",
"p",
")",
"{",
"if",
"(",
"$",
"p",
"===",
"\"\... | Does a string start with another string?
@param string $str The string to check
@param string|array $prefix The prefix to check for
@return bool | [
"Does",
"a",
"string",
"start",
"with",
"another",
"string?"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/Util/Util.php#L77-L88 |
alanpich/slender | src/Core/Util/Util.php | Util.stringEndsWith | public static function stringEndsWith($str, $postfix)
{
if(is_array($postfix)){
foreach($postfix as $p){
if($p === "" || substr($str, -strlen($p)) === $p){
return true;
}
}
return false;
}
return $postfix... | php | public static function stringEndsWith($str, $postfix)
{
if(is_array($postfix)){
foreach($postfix as $p){
if($p === "" || substr($str, -strlen($p)) === $p){
return true;
}
}
return false;
}
return $postfix... | [
"public",
"static",
"function",
"stringEndsWith",
"(",
"$",
"str",
",",
"$",
"postfix",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"postfix",
")",
")",
"{",
"foreach",
"(",
"$",
"postfix",
"as",
"$",
"p",
")",
"{",
"if",
"(",
"$",
"p",
"===",
"\"... | Does a string end with another string?
@param string $str The string to check
@param string|array $postfix The postfix to check for
@return bool | [
"Does",
"a",
"string",
"end",
"with",
"another",
"string?"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/Util/Util.php#L98-L109 |
microinginer/yii2-human-formatter | src/HumanFormatter.php | HumanFormatter.asDatetime | public function asDatetime ($value, $format = null)
{
switch ($this->locale) {
case 'ru': {
return $this->datetimeAsHumanRu($value, $format);
}
case 'en': {
return $this->datetimeAsHumanEn($value, $format);
}
default... | php | public function asDatetime ($value, $format = null)
{
switch ($this->locale) {
case 'ru': {
return $this->datetimeAsHumanRu($value, $format);
}
case 'en': {
return $this->datetimeAsHumanEn($value, $format);
}
default... | [
"public",
"function",
"asDatetime",
"(",
"$",
"value",
",",
"$",
"format",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"locale",
")",
"{",
"case",
"'ru'",
":",
"{",
"return",
"$",
"this",
"->",
"datetimeAsHumanRu",
"(",
"$",
"value",
","... | Formats the value as a datetime.
@param integer|string|DateTime $value the value to be formatted. The following
types of value are supported:
- an integer representing a UNIX timestamp
- a string that can be [parsed to create a DateTime object](http://php.net/manual/en/datetime.formats.php).
The timestamp is assumed t... | [
"Formats",
"the",
"value",
"as",
"a",
"datetime",
".",
"@param",
"integer|string|DateTime",
"$value",
"the",
"value",
"to",
"be",
"formatted",
".",
"The",
"following",
"types",
"of",
"value",
"are",
"supported",
":"
] | train | https://github.com/microinginer/yii2-human-formatter/blob/d9a3536e99a22f5cfbbc2dd10b287cb89d85b56b/src/HumanFormatter.php#L73-L86 |
rayrutjes/domain-foundation | src/Command/GenericCommand.php | GenericCommand.enrichMetadata | public function enrichMetadata(array $data)
{
$metadata = $this->message->metadata()->mergeWith($data);
return new self($this->identifier(), $this->payload(), $metadata);
} | php | public function enrichMetadata(array $data)
{
$metadata = $this->message->metadata()->mergeWith($data);
return new self($this->identifier(), $this->payload(), $metadata);
} | [
"public",
"function",
"enrichMetadata",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"message",
"->",
"metadata",
"(",
")",
"->",
"mergeWith",
"(",
"$",
"data",
")",
";",
"return",
"new",
"self",
"(",
"$",
"this",
"->... | @param array $data
@return Message | [
"@param",
"array",
"$data"
] | train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Command/GenericCommand.php#L89-L94 |
4devs/ElfinderPhpConnector | FileInfo.php | FileInfo.toArray | public function toArray()
{
$data = array(
'name' => $this->name,
'hash' => $this->hash,
'phash' => $this->phash,
'mime' => $this->mime,
'ts' => $this->ts,
'size' => $this->size,
'dirs' => $this->dirs,
'read' => ... | php | public function toArray()
{
$data = array(
'name' => $this->name,
'hash' => $this->hash,
'phash' => $this->phash,
'mime' => $this->mime,
'ts' => $this->ts,
'size' => $this->size,
'dirs' => $this->dirs,
'read' => ... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"this",
"->",
"name",
",",
"'hash'",
"=>",
"$",
"this",
"->",
"hash",
",",
"'phash'",
"=>",
"$",
"this",
"->",
"phash",
",",
"'mime'",
"=>",
"$",
... | FileInfo return as array.
@return array | [
"FileInfo",
"return",
"as",
"array",
"."
] | train | https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/FileInfo.php#L574-L602 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client/Adapter/Socket.php | Zend_Http_Client_Adapter_Socket.read | public function read()
{
// First, read headers only
$response = '';
$gotStatus = false;
while (($line = @fgets($this->socket)) !== false) {
$gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
if ($gotStatus) {
$response .= $line;
... | php | public function read()
{
// First, read headers only
$response = '';
$gotStatus = false;
while (($line = @fgets($this->socket)) !== false) {
$gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
if ($gotStatus) {
$response .= $line;
... | [
"public",
"function",
"read",
"(",
")",
"{",
"// First, read headers only",
"$",
"response",
"=",
"''",
";",
"$",
"gotStatus",
"=",
"false",
";",
"while",
"(",
"(",
"$",
"line",
"=",
"@",
"fgets",
"(",
"$",
"this",
"->",
"socket",
")",
")",
"!==",
"f... | Read response from server
@return string | [
"Read",
"response",
"from",
"server"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client/Adapter/Socket.php#L217-L328 |
okitcom/ok-lib-php | src/Model/Cash/LineItem.php | LineItem.create | public static function create($quantity, $productCode, $description, $amount, $vat, $currency = "EUR") {
$item = new LineItem;
$item->quantity = $quantity;
$item->productCode = $productCode;
$item->description = $description;
$item->amount = $amount;
$item->vat = $vat;
... | php | public static function create($quantity, $productCode, $description, $amount, $vat, $currency = "EUR") {
$item = new LineItem;
$item->quantity = $quantity;
$item->productCode = $productCode;
$item->description = $description;
$item->amount = $amount;
$item->vat = $vat;
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"quantity",
",",
"$",
"productCode",
",",
"$",
"description",
",",
"$",
"amount",
",",
"$",
"vat",
",",
"$",
"currency",
"=",
"\"EUR\"",
")",
"{",
"$",
"item",
"=",
"new",
"LineItem",
";",
"$",
"ite... | LineItem creator.
@param int $quantity
@param string $productCode
@param string $description
@param Amount $amount
@param int $vat
@param string $currency
@return LineItem | [
"LineItem",
"creator",
"."
] | train | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Model/Cash/LineItem.php#L66-L75 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php | BaseCountryQuery.create | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CountryQuery) {
return $criteria;
}
$query = new CountryQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}... | php | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CountryQuery) {
return $criteria;
}
$query = new CountryQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}... | [
"public",
"static",
"function",
"create",
"(",
"$",
"modelAlias",
"=",
"null",
",",
"$",
"criteria",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"criteria",
"instanceof",
"CountryQuery",
")",
"{",
"return",
"$",
"criteria",
";",
"}",
"$",
"query",
"=",
"new... | Returns a new CountryQuery object.
@param string $modelAlias The alias of a model in the query
@param CountryQuery|Criteria $criteria Optional Criteria to build the query from
@return CountryQuery | [
"Returns",
"a",
"new",
"CountryQuery",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php#L79-L91 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php | BaseCountryQuery.filterByEn | public function filterByEn($en = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($en)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $en)) {
$en = str_replace('*', '%', $en);
$comparison = Criteria:... | php | public function filterByEn($en = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($en)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $en)) {
$en = str_replace('*', '%', $en);
$comparison = Criteria:... | [
"public",
"function",
"filterByEn",
"(",
"$",
"en",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"en",
")",
")",
"{",
"$",
"comparison",
"=",
"... | Filter the query on the en column
Example usage:
<code>
$query->filterByEn('fooValue'); // WHERE en = 'fooValue'
$query->filterByEn('%fooValue%'); // WHERE en LIKE '%fooValue%'
</code>
@param string $en The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator... | [
"Filter",
"the",
"query",
"on",
"the",
"en",
"column"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php#L330-L342 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php | BaseCountryQuery.filterByDe | public function filterByDe($de = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($de)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $de)) {
$de = str_replace('*', '%', $de);
$comparison = Criteria:... | php | public function filterByDe($de = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($de)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $de)) {
$de = str_replace('*', '%', $de);
$comparison = Criteria:... | [
"public",
"function",
"filterByDe",
"(",
"$",
"de",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"de",
")",
")",
"{",
"$",
"comparison",
"=",
"... | Filter the query on the de column
Example usage:
<code>
$query->filterByDe('fooValue'); // WHERE de = 'fooValue'
$query->filterByDe('%fooValue%'); // WHERE de LIKE '%fooValue%'
</code>
@param string $de The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator... | [
"Filter",
"the",
"query",
"on",
"the",
"de",
"column"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php#L359-L371 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php | BaseCountryQuery.filterByCustomer | public function filterByCustomer($customer, $comparison = null)
{
if ($customer instanceof Customer) {
return $this
->addUsingAlias(CountryPeer::ID, $customer->getCountryId(), $comparison);
} elseif ($customer instanceof PropelObjectCollection) {
return $this
... | php | public function filterByCustomer($customer, $comparison = null)
{
if ($customer instanceof Customer) {
return $this
->addUsingAlias(CountryPeer::ID, $customer->getCountryId(), $comparison);
} elseif ($customer instanceof PropelObjectCollection) {
return $this
... | [
"public",
"function",
"filterByCustomer",
"(",
"$",
"customer",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"customer",
"instanceof",
"Customer",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CountryPeer",
"::",
"ID",
","... | Filter the query by a related Customer object
@param Customer|PropelObjectCollection $customer the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CountryQuery The current query, for fluid interface
@throws... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"Customer",
"object"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountryQuery.php#L382-L395 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.