id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,800 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.addMeta | public function addMeta(array $data):SuccessResponseBuilder
{
$this->meta = array_merge($this->meta, $data);
return $this;
} | php | public function addMeta(array $data):SuccessResponseBuilder
{
$this->meta = array_merge($this->meta, $data);
return $this;
} | [
"public",
"function",
"addMeta",
"(",
"array",
"$",
"data",
")",
":",
"SuccessResponseBuilder",
"{",
"$",
"this",
"->",
"meta",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"meta",
",",
"$",
"data",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add data to the meta data appended to the response data.
@param array $data
@return self | [
"Add",
"data",
"to",
"the",
"meta",
"data",
"appended",
"to",
"the",
"response",
"data",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L92-L97 |
23,801 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.transform | public function transform($data = null, $transformer = null, string $resourceKey = null):SuccessResponseBuilder
{
$resource = $this->resourceFactory->make($data);
if (! is_null($resource->getData())) {
$model = $this->resolveModel($resource->getData());
$transformer = $this-... | php | public function transform($data = null, $transformer = null, string $resourceKey = null):SuccessResponseBuilder
{
$resource = $this->resourceFactory->make($data);
if (! is_null($resource->getData())) {
$model = $this->resolveModel($resource->getData());
$transformer = $this-... | [
"public",
"function",
"transform",
"(",
"$",
"data",
"=",
"null",
",",
"$",
"transformer",
"=",
"null",
",",
"string",
"$",
"resourceKey",
"=",
"null",
")",
":",
"SuccessResponseBuilder",
"{",
"$",
"resource",
"=",
"$",
"this",
"->",
"resourceFactory",
"->... | Set the transformation data. This will set a new resource instance on the response
builder depending on what type of data is provided.
@param mixed|null $data
@param callable|string|null $transformer
@param string|null $resourceKey
@return self | [
"Set",
"the",
"transformation",
"data",
".",
"This",
"will",
"set",
"a",
"new",
"resource",
"instance",
"on",
"the",
"response",
"builder",
"depending",
"on",
"what",
"type",
"of",
"data",
"is",
"provided",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L164-L185 |
23,802 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.getResource | public function getResource():ResourceInterface
{
$this->manager->parseIncludes($this->relations);
$transformer = $this->resource->getTransformer();
if ($transformer instanceof Transformer && $transformer->allRelationsAllowed()) {
$this->resource->setTransformer($transformer->se... | php | public function getResource():ResourceInterface
{
$this->manager->parseIncludes($this->relations);
$transformer = $this->resource->getTransformer();
if ($transformer instanceof Transformer && $transformer->allRelationsAllowed()) {
$this->resource->setTransformer($transformer->se... | [
"public",
"function",
"getResource",
"(",
")",
":",
"ResourceInterface",
"{",
"$",
"this",
"->",
"manager",
"->",
"parseIncludes",
"(",
"$",
"this",
"->",
"relations",
")",
";",
"$",
"transformer",
"=",
"$",
"this",
"->",
"resource",
"->",
"getTransformer",
... | Get the Fractal resource instance.
@return \League\Fractal\Resource\ResourceInterface | [
"Get",
"the",
"Fractal",
"resource",
"instance",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L202-L212 |
23,803 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.resolveSerializer | protected function resolveSerializer($serializer):SerializerAbstract
{
if (is_string($serializer)) {
$serializer = new $serializer;
}
if (! $serializer instanceof SerializerAbstract) {
throw new InvalidSerializerException();
}
return $serializer;
... | php | protected function resolveSerializer($serializer):SerializerAbstract
{
if (is_string($serializer)) {
$serializer = new $serializer;
}
if (! $serializer instanceof SerializerAbstract) {
throw new InvalidSerializerException();
}
return $serializer;
... | [
"protected",
"function",
"resolveSerializer",
"(",
"$",
"serializer",
")",
":",
"SerializerAbstract",
"{",
"if",
"(",
"is_string",
"(",
"$",
"serializer",
")",
")",
"{",
"$",
"serializer",
"=",
"new",
"$",
"serializer",
";",
"}",
"if",
"(",
"!",
"$",
"se... | Resolve a serializer instance from the value.
@param \League\Fractal\Serializer\SerializerAbstract|string $serializer
@return \League\Fractal\Serializer\SerializerAbstract
@throws \Flugg\Responder\Exceptions\InvalidSerializerException | [
"Resolve",
"a",
"serializer",
"instance",
"from",
"the",
"value",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L231-L242 |
23,804 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.resolveModel | protected function resolveModel($data):Model
{
if ($data instanceof Model) {
return $data;
}
$model = array_values($data)[0];
if (! $model instanceof Model) {
throw new InvalidArgumentException('You can only transform data containing Eloquent models.');
... | php | protected function resolveModel($data):Model
{
if ($data instanceof Model) {
return $data;
}
$model = array_values($data)[0];
if (! $model instanceof Model) {
throw new InvalidArgumentException('You can only transform data containing Eloquent models.');
... | [
"protected",
"function",
"resolveModel",
"(",
"$",
"data",
")",
":",
"Model",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"Model",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"model",
"=",
"array_values",
"(",
"$",
"data",
")",
"[",
"0",
"]",
";... | Resolve a model instance from the data.
@param \Illuminate\Database\Eloquent\Model|array $data
@return \Illuminate\Database\Eloquent\Model
@throws \InvalidArgumentException | [
"Resolve",
"a",
"model",
"instance",
"from",
"the",
"data",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L251-L263 |
23,805 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.resolveTransformer | protected function resolveTransformer(Model $model, $transformer = null)
{
$transformer = $transformer ?: $this->resolveTransformerFromModel($model);
if (is_string($transformer)) {
$transformer = new $transformer;
}
return $this->parseTransformer($transformer, $model);
... | php | protected function resolveTransformer(Model $model, $transformer = null)
{
$transformer = $transformer ?: $this->resolveTransformerFromModel($model);
if (is_string($transformer)) {
$transformer = new $transformer;
}
return $this->parseTransformer($transformer, $model);
... | [
"protected",
"function",
"resolveTransformer",
"(",
"Model",
"$",
"model",
",",
"$",
"transformer",
"=",
"null",
")",
"{",
"$",
"transformer",
"=",
"$",
"transformer",
"?",
":",
"$",
"this",
"->",
"resolveTransformerFromModel",
"(",
"$",
"model",
")",
";",
... | Resolve a transformer.
@param \Illuminate\Database\ELoquent\Model $model
@param \Flugg\Responder\Transformer|callable|null $transformer
@return \Flugg\Responder\Transformer|callable | [
"Resolve",
"a",
"transformer",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L272-L281 |
23,806 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.resolveTransformerFromModel | protected function resolveTransformerFromModel(Model $model)
{
if (! $model instanceof Transformable) {
return function ($model) {
return $model->toArray();
};
}
return $model::transformer();
} | php | protected function resolveTransformerFromModel(Model $model)
{
if (! $model instanceof Transformable) {
return function ($model) {
return $model->toArray();
};
}
return $model::transformer();
} | [
"protected",
"function",
"resolveTransformerFromModel",
"(",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"!",
"$",
"model",
"instanceof",
"Transformable",
")",
"{",
"return",
"function",
"(",
"$",
"model",
")",
"{",
"return",
"$",
"model",
"->",
"toArray",
... | Resolve a transformer from the model. If the model is not transformable, a closure
based transformer will be created instead, from the model's fillable attributes.
@param \Illuminate\Database\ELoquent\Model $model
@return \Flugg\Responder\Transformer|callable | [
"Resolve",
"a",
"transformer",
"from",
"the",
"model",
".",
"If",
"the",
"model",
"is",
"not",
"transformable",
"a",
"closure",
"based",
"transformer",
"will",
"be",
"created",
"instead",
"from",
"the",
"model",
"s",
"fillable",
"attributes",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L290-L299 |
23,807 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.parseTransformer | protected function parseTransformer($transformer, Model $model)
{
if ($transformer instanceof Transformer) {
$relations = $transformer->allRelationsAllowed() ? $this->resolveRelations($model) : $transformer->getRelations();
$transformer = $transformer->setRelations($relations);
... | php | protected function parseTransformer($transformer, Model $model)
{
if ($transformer instanceof Transformer) {
$relations = $transformer->allRelationsAllowed() ? $this->resolveRelations($model) : $transformer->getRelations();
$transformer = $transformer->setRelations($relations);
... | [
"protected",
"function",
"parseTransformer",
"(",
"$",
"transformer",
",",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"transformer",
"instanceof",
"Transformer",
")",
"{",
"$",
"relations",
"=",
"$",
"transformer",
"->",
"allRelationsAllowed",
"(",
")",
... | Parse a transformer class and set relations.
@param \Flugg\Responder\Transformer|callable $transformer
@param \Illuminate\Database\ELoquent\Model $model
@return \Flugg\Responder\Transformer|callable
@throws \InvalidTransformerException | [
"Parse",
"a",
"transformer",
"class",
"and",
"set",
"relations",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L309-L320 |
23,808 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.resolveNestedRelations | protected function resolveNestedRelations($data):array
{
if (is_null($data)) {
return [];
}
$data = $data instanceof Model ? [$data] : $data;
return collect($data)->flatMap(function ($model) {
$relations = collect($model->getRelations());
return... | php | protected function resolveNestedRelations($data):array
{
if (is_null($data)) {
return [];
}
$data = $data instanceof Model ? [$data] : $data;
return collect($data)->flatMap(function ($model) {
$relations = collect($model->getRelations());
return... | [
"protected",
"function",
"resolveNestedRelations",
"(",
"$",
"data",
")",
":",
"array",
"{",
"if",
"(",
"is_null",
"(",
"$",
"data",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"data",
"=",
"$",
"data",
"instanceof",
"Model",
"?",
"[",
"$",
"... | Resolve eager loaded relations from the model including any nested relations.
@param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model $data
@return array | [
"Resolve",
"eager",
"loaded",
"relations",
"from",
"the",
"model",
"including",
"any",
"nested",
"relations",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L339-L356 |
23,809 | tttptd/laravel-responder | src/Http/SuccessResponseBuilder.php | SuccessResponseBuilder.resolveResourceKey | protected function resolveResourceKey(Model $model, string $resourceKey = null):string
{
if (! is_null($resourceKey)) {
return $resourceKey;
}
if (method_exists($model, 'getResourceKey')) {
return $model->getResourceKey();
}
return $model->getTable()... | php | protected function resolveResourceKey(Model $model, string $resourceKey = null):string
{
if (! is_null($resourceKey)) {
return $resourceKey;
}
if (method_exists($model, 'getResourceKey')) {
return $model->getResourceKey();
}
return $model->getTable()... | [
"protected",
"function",
"resolveResourceKey",
"(",
"Model",
"$",
"model",
",",
"string",
"$",
"resourceKey",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"resourceKey",
")",
")",
"{",
"return",
"$",
"resourceKey",
";",
"}",... | Resolve the resource key from the model.
@param \Illuminate\Database\Eloquent\Model $model
@param string|null $resourceKey
@return string | [
"Resolve",
"the",
"resource",
"key",
"from",
"the",
"model",
"."
] | 0e4a32701f0de755c1f1af458045829e1bd6caf6 | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/SuccessResponseBuilder.php#L365-L376 |
23,810 | nabab/bbn | src/bbn/mvc.php | mvc.add_view | private static function add_view($path, $mode, mvc\view $view)
{
if ( !isset(self::$loaded_views[$mode][$path]) ){
self::$loaded_views[$mode][$path] = $view;
}
return self::$loaded_views[$mode][$path];
} | php | private static function add_view($path, $mode, mvc\view $view)
{
if ( !isset(self::$loaded_views[$mode][$path]) ){
self::$loaded_views[$mode][$path] = $view;
}
return self::$loaded_views[$mode][$path];
} | [
"private",
"static",
"function",
"add_view",
"(",
"$",
"path",
",",
"$",
"mode",
",",
"mvc",
"\\",
"view",
"$",
"view",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"loaded_views",
"[",
"$",
"mode",
"]",
"[",
"$",
"path",
"]",
")",
... | This function gets the content of a view file and adds it to the loaded_views array.
@param string $p The full path to the view file
@return string The content of the view | [
"This",
"function",
"gets",
"the",
"content",
"of",
"a",
"view",
"file",
"and",
"adds",
"it",
"to",
"the",
"loaded_views",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc.php#L226-L232 |
23,811 | nabab/bbn | src/bbn/mvc.php | mvc.get_external_view | public function get_external_view(string $full_path, string $mode = 'html', array $data=null){
if ( !router::is_mode($mode) ){
die("Incorrect mode $full_path $mode");
}
if ( ($this->get_mode() === 'dom') && (!defined('BBN_DEFAULT_MODE') || (BBN_DEFAULT_MODE !== 'dom')) ){
$full_path .= ($full_pa... | php | public function get_external_view(string $full_path, string $mode = 'html', array $data=null){
if ( !router::is_mode($mode) ){
die("Incorrect mode $full_path $mode");
}
if ( ($this->get_mode() === 'dom') && (!defined('BBN_DEFAULT_MODE') || (BBN_DEFAULT_MODE !== 'dom')) ){
$full_path .= ($full_pa... | [
"public",
"function",
"get_external_view",
"(",
"string",
"$",
"full_path",
",",
"string",
"$",
"mode",
"=",
"'html'",
",",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"router",
"::",
"is_mode",
"(",
"$",
"mode",
")",
")",
"{",
"die"... | This will get a view from a different root.
@param string $full_path
@param string $mode
@param array $data
@return string|false | [
"This",
"will",
"get",
"a",
"view",
"from",
"a",
"different",
"root",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc.php#L482-L501 |
23,812 | nabab/bbn | src/bbn/mvc.php | mvc.get_cached_model | public function get_cached_model($path, array $data, mvc\controller $ctrl, $ttl = 10){
if ( \is_null($data) ){
$data = $this->data;
}
if ( $route = $this->router->route($path, 'model') ){
$model = new mvc\model($this->db, $route, $ctrl, $this);
return $model->get_from_cache($data, '', $ttl... | php | public function get_cached_model($path, array $data, mvc\controller $ctrl, $ttl = 10){
if ( \is_null($data) ){
$data = $this->data;
}
if ( $route = $this->router->route($path, 'model') ){
$model = new mvc\model($this->db, $route, $ctrl, $this);
return $model->get_from_cache($data, '', $ttl... | [
"public",
"function",
"get_cached_model",
"(",
"$",
"path",
",",
"array",
"$",
"data",
",",
"mvc",
"\\",
"controller",
"$",
"ctrl",
",",
"$",
"ttl",
"=",
"10",
")",
"{",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=... | This will get the model as it is in cache if any and otherwise will save it in cache then return it
@params string path to the model
@params array data to send to the model
@return array|false A data model | [
"This",
"will",
"get",
"the",
"model",
"as",
"it",
"is",
"in",
"cache",
"if",
"any",
"and",
"otherwise",
"will",
"save",
"it",
"in",
"cache",
"then",
"return",
"it"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc.php#L561-L570 |
23,813 | nabab/bbn | src/bbn/mvc.php | mvc.set_cached_model | public function set_cached_model($path, array $data, mvc\controller $ctrl, $ttl = 10){
if ( \is_null($data) ){
$data = $this->data;
}
if ( $route = $this->router->route($path, 'model') ){
$model = new mvc\model($this->db, $route, $ctrl, $this);
return $model->set_cache($data, '', $ttl);
... | php | public function set_cached_model($path, array $data, mvc\controller $ctrl, $ttl = 10){
if ( \is_null($data) ){
$data = $this->data;
}
if ( $route = $this->router->route($path, 'model') ){
$model = new mvc\model($this->db, $route, $ctrl, $this);
return $model->set_cache($data, '', $ttl);
... | [
"public",
"function",
"set_cached_model",
"(",
"$",
"path",
",",
"array",
"$",
"data",
",",
"mvc",
"\\",
"controller",
"$",
"ctrl",
",",
"$",
"ttl",
"=",
"10",
")",
"{",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=... | This will set the model in cache
@params string path to the model
@params array data to send to the model
@return array|false A data model | [
"This",
"will",
"set",
"the",
"model",
"in",
"cache"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc.php#L579-L588 |
23,814 | nabab/bbn | src/bbn/mvc.php | mvc.delete_cached_model | public function delete_cached_model($path, array $data, mvc\controller $ctrl){
if ( \is_null($data) ){
$data = $this->data;
}
if ( $route = $this->router->route($path, 'model') ){
$model = new mvc\model($this->db, $route, $ctrl, $this);
return $model->delete_cache($data, '');
}
ret... | php | public function delete_cached_model($path, array $data, mvc\controller $ctrl){
if ( \is_null($data) ){
$data = $this->data;
}
if ( $route = $this->router->route($path, 'model') ){
$model = new mvc\model($this->db, $route, $ctrl, $this);
return $model->delete_cache($data, '');
}
ret... | [
"public",
"function",
"delete_cached_model",
"(",
"$",
"path",
",",
"array",
"$",
"data",
",",
"mvc",
"\\",
"controller",
"$",
"ctrl",
")",
"{",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data... | This will unset the model in cache
@params string path to the model
@params array data to send to the model
@return array|false A data model | [
"This",
"will",
"unset",
"the",
"model",
"in",
"cache"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc.php#L598-L607 |
23,815 | nabab/bbn | src/bbn/mvc.php | mvc.add_inc | public function add_inc($name, $obj){
if ( !isset($this->inc->{$name}) ){
$this->inc->{$name} = $obj;
}
} | php | public function add_inc($name, $obj){
if ( !isset($this->inc->{$name}) ){
$this->inc->{$name} = $obj;
}
} | [
"public",
"function",
"add_inc",
"(",
"$",
"name",
",",
"$",
"obj",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"inc",
"->",
"{",
"$",
"name",
"}",
")",
")",
"{",
"$",
"this",
"->",
"inc",
"->",
"{",
"$",
"name",
"}",
"=",
"$... | Adds a property to the MVC object inc if it has not been declared.
@return bool | [
"Adds",
"a",
"property",
"to",
"the",
"MVC",
"object",
"inc",
"if",
"it",
"has",
"not",
"been",
"declared",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc.php#L614-L618 |
23,816 | eghojansu/moe | src/tools/Session.php | Session.csrf | function csrf() {
return Cache::instance()->
exists(($this->sid?:session_id()).'.@',$data)?
$data['csrf']:FALSE;
} | php | function csrf() {
return Cache::instance()->
exists(($this->sid?:session_id()).'.@',$data)?
$data['csrf']:FALSE;
} | [
"function",
"csrf",
"(",
")",
"{",
"return",
"Cache",
"::",
"instance",
"(",
")",
"->",
"exists",
"(",
"(",
"$",
"this",
"->",
"sid",
"?",
":",
"session_id",
"(",
")",
")",
".",
"'.@'",
",",
"$",
"data",
")",
"?",
"$",
"data",
"[",
"'csrf'",
"]... | Return anti-CSRF token
@return string|FALSE | [
"Return",
"anti",
"-",
"CSRF",
"token"
] | f58ec75a3116d1a572782256e2b38bb9aab95e3c | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Session.php#L100-L104 |
23,817 | Danack/GithubArtaxService | lib/GithubService/GithubArtaxService/GithubService.php | GithubService.parseRateLimit | function parseRateLimit(Response $response) {
$newRateLimit = \GithubService\RateLimit::createFromResponse($response);
if ($newRateLimit != null) {
$this->rateLimit = $newRateLimit;
}
} | php | function parseRateLimit(Response $response) {
$newRateLimit = \GithubService\RateLimit::createFromResponse($response);
if ($newRateLimit != null) {
$this->rateLimit = $newRateLimit;
}
} | [
"function",
"parseRateLimit",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"newRateLimit",
"=",
"\\",
"GithubService",
"\\",
"RateLimit",
"::",
"createFromResponse",
"(",
"$",
"response",
")",
";",
"if",
"(",
"$",
"newRateLimit",
"!=",
"null",
")",
"{",
... | Try to get some rate limiting info from the response, and store it if it is
available.
@param Response $response | [
"Try",
"to",
"get",
"some",
"rate",
"limiting",
"info",
"from",
"the",
"response",
"and",
"store",
"it",
"if",
"it",
"is",
"available",
"."
] | 9f62b5be4f413207d4012e7fa084d0ae505680eb | https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubService.php#L144-L149 |
23,818 | Danack/GithubArtaxService | lib/GithubService/GithubArtaxService/GithubService.php | GithubService.createOrRetrieveAuth | function createOrRetrieveAuth(
$username,
$password,
callable $enterPasswordCallback,
$scopes,
$note,
$noteURL = "http://www.github.com/danack/GithubArtaxService",
$maxAttempts = 3
) {
$basicToken = new BasicAuthToken($username, $password);
$ot... | php | function createOrRetrieveAuth(
$username,
$password,
callable $enterPasswordCallback,
$scopes,
$note,
$noteURL = "http://www.github.com/danack/GithubArtaxService",
$maxAttempts = 3
) {
$basicToken = new BasicAuthToken($username, $password);
$ot... | [
"function",
"createOrRetrieveAuth",
"(",
"$",
"username",
",",
"$",
"password",
",",
"callable",
"$",
"enterPasswordCallback",
",",
"$",
"scopes",
",",
"$",
"note",
",",
"$",
"noteURL",
"=",
"\"http://www.github.com/danack/GithubArtaxService\"",
",",
"$",
"maxAttemp... | Creates an Oauth token for a named application.
@param $username string The username to create the oauth token for
@param $password string The password of the user
@param $enterPasswordCallback callable A callback to get the one-time password
if the user has two factor auth enabled on their account.
@param $scopes arr... | [
"Creates",
"an",
"Oauth",
"token",
"for",
"a",
"named",
"application",
"."
] | 9f62b5be4f413207d4012e7fa084d0ae505680eb | https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/GithubArtaxService/GithubService.php#L227-L268 |
23,819 | silvercommerce/geozones | src/Forms/RegionSelectionField.php | RegionSelectionField.getSource | public function getSource()
{
$field = $this
->getForm()
->Fields()
->dataFieldByName($this->country_field);
if (empty($field) || empty($field->Value())) {
$locale = strtoupper(Locale::getRegion(i18n::get_locale()));
} else {
$loca... | php | public function getSource()
{
$field = $this
->getForm()
->Fields()
->dataFieldByName($this->country_field);
if (empty($field) || empty($field->Value())) {
$locale = strtoupper(Locale::getRegion(i18n::get_locale()));
} else {
$loca... | [
"public",
"function",
"getSource",
"(",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"Fields",
"(",
")",
"->",
"dataFieldByName",
"(",
"$",
"this",
"->",
"country_field",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"field",
... | Overwrite default get source to return
custom list of regions
@return array|ArrayAccess | [
"Overwrite",
"default",
"get",
"source",
"to",
"return",
"custom",
"list",
"of",
"regions"
] | 85af587805ae5cc6dce6a890ca04b338cf5552cb | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Forms/RegionSelectionField.php#L65-L82 |
23,820 | silvercommerce/geozones | src/Forms/RegionSelectionField.php | RegionSelectionField.Field | public function Field($properties = [])
{
Requirements::javascript("silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js");
$country_field = $this->country_field;
// Get source based on selected country (or current/default locale)
$field = $this
-... | php | public function Field($properties = [])
{
Requirements::javascript("silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js");
$country_field = $this->country_field;
// Get source based on selected country (or current/default locale)
$field = $this
-... | [
"public",
"function",
"Field",
"(",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"Requirements",
"::",
"javascript",
"(",
"\"silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js\"",
")",
";",
"$",
"country_field",
"=",
"$",
"this",
"->",
"country_field",... | Render the final field | [
"Render",
"the",
"final",
"field"
] | 85af587805ae5cc6dce6a890ca04b338cf5552cb | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Forms/RegionSelectionField.php#L103-L126 |
23,821 | silvercommerce/geozones | src/Forms/RegionSelectionField.php | RegionSelectionField.getList | public function getList($country)
{
$list = Region::get()
->filter("CountryCode", strtoupper($country));
if (!$list->exists() && $this->getCreateEmptyDefault()) {
$countries = i18n::getData()->getCountries();
if (isset($countries[strtolower($country)])) {
... | php | public function getList($country)
{
$list = Region::get()
->filter("CountryCode", strtoupper($country));
if (!$list->exists() && $this->getCreateEmptyDefault()) {
$countries = i18n::getData()->getCountries();
if (isset($countries[strtolower($country)])) {
... | [
"public",
"function",
"getList",
"(",
"$",
"country",
")",
"{",
"$",
"list",
"=",
"Region",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"\"CountryCode\"",
",",
"strtoupper",
"(",
"$",
"country",
")",
")",
";",
"if",
"(",
"!",
"$",
"list",
"->",
"ex... | Get a list of regions, filtered by the provided country code
@return SSList | [
"Get",
"a",
"list",
"of",
"regions",
"filtered",
"by",
"the",
"provided",
"country",
"code"
] | 85af587805ae5cc6dce6a890ca04b338cf5552cb | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Forms/RegionSelectionField.php#L133-L155 |
23,822 | silvercommerce/geozones | src/Forms/RegionSelectionField.php | RegionSelectionField.regionslist | public function regionslist()
{
$id = $this->getRequest()->param("ID");
$data = $this->getList($id)->map("Code", "Name")->toArray();
return json_encode($data);
} | php | public function regionslist()
{
$id = $this->getRequest()->param("ID");
$data = $this->getList($id)->map("Code", "Name")->toArray();
return json_encode($data);
} | [
"public",
"function",
"regionslist",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"param",
"(",
"\"ID\"",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"getList",
"(",
"$",
"id",
")",
"->",
"map",
"(",
"\"Code\... | Return a list of regions based on the supplied country ID
@return string | [
"Return",
"a",
"list",
"of",
"regions",
"based",
"on",
"the",
"supplied",
"country",
"ID"
] | 85af587805ae5cc6dce6a890ca04b338cf5552cb | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Forms/RegionSelectionField.php#L162-L168 |
23,823 | hametuha/wpametu | src/WPametu/Traits/Reflection.php | Reflection.is_sub_class_of | protected function is_sub_class_of($class_name, $should, $allow_abstract = false){
if( class_exists($class_name) ){
// Check if this is subclass
$refl = new \ReflectionClass($class_name);
return ( $allow_abstract || !$refl->isAbstract() ) && $refl->isSubclassOf($should);
... | php | protected function is_sub_class_of($class_name, $should, $allow_abstract = false){
if( class_exists($class_name) ){
// Check if this is subclass
$refl = new \ReflectionClass($class_name);
return ( $allow_abstract || !$refl->isAbstract() ) && $refl->isSubclassOf($should);
... | [
"protected",
"function",
"is_sub_class_of",
"(",
"$",
"class_name",
",",
"$",
"should",
",",
"$",
"allow_abstract",
"=",
"false",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"class_name",
")",
")",
"{",
"// Check if this is subclass",
"$",
"refl",
"=",
"n... | Detect if specifies class is subclass
@param string $class_name
@param string $should Parent class name
@param bool $allow_abstract Default false
@return bool | [
"Detect",
"if",
"specifies",
"class",
"is",
"subclass"
] | 0939373800815a8396291143d2a57967340da5aa | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Traits/Reflection.php#L46-L53 |
23,824 | thupan/framework | src/Service/Request.php | Request.clean | public static function clean($request = null)
{
switch ($request) {
case 'post':
unset($_POST);
break;
case 'get':
unset($_GET);
break;
case 'any':
unset($_REQUEST);
break;
... | php | public static function clean($request = null)
{
switch ($request) {
case 'post':
unset($_POST);
break;
case 'get':
unset($_GET);
break;
case 'any':
unset($_REQUEST);
break;
... | [
"public",
"static",
"function",
"clean",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"request",
")",
"{",
"case",
"'post'",
":",
"unset",
"(",
"$",
"_POST",
")",
";",
"break",
";",
"case",
"'get'",
":",
"unset",
"(",
"$",
"_GET"... | limpa toda requisicao passada | [
"limpa",
"toda",
"requisicao",
"passada"
] | 43193c67e87942930fb0cbc53aa069b60b27e749 | https://github.com/thupan/framework/blob/43193c67e87942930fb0cbc53aa069b60b27e749/src/Service/Request.php#L204-L224 |
23,825 | Speicher210/monsum-api | src/Service/Invoice/InvoiceService.php | InvoiceService.getInvoices | public function getInvoices(Get\RequestData $requestData)
{
$request = new Get\Request($requestData);
$apiResponse = $this->sendRequest($request, Get\ApiResponse::class);
/** @var Get\Response $response */
$response = $apiResponse->getResponse();
foreach ($response->getInvoi... | php | public function getInvoices(Get\RequestData $requestData)
{
$request = new Get\Request($requestData);
$apiResponse = $this->sendRequest($request, Get\ApiResponse::class);
/** @var Get\Response $response */
$response = $apiResponse->getResponse();
foreach ($response->getInvoi... | [
"public",
"function",
"getInvoices",
"(",
"Get",
"\\",
"RequestData",
"$",
"requestData",
")",
"{",
"$",
"request",
"=",
"new",
"Get",
"\\",
"Request",
"(",
"$",
"requestData",
")",
";",
"$",
"apiResponse",
"=",
"$",
"this",
"->",
"sendRequest",
"(",
"$"... | Get the invoices.
@param Get\RequestData $requestData The request data.
@return Get\ApiResponse | [
"Get",
"the",
"invoices",
"."
] | 4611a048097de5d2b0efe9d4426779c783c0af4d | https://github.com/Speicher210/monsum-api/blob/4611a048097de5d2b0efe9d4426779c783c0af4d/src/Service/Invoice/InvoiceService.php#L18-L41 |
23,826 | loevgaard/altapay-php-sdk | src/Callback/CallbackFactory.php | CallbackFactory.create | public function create(ServerRequestInterface $request) : CallbackInterface
{
$callbacks = [
XmlCallback::class,
FormCallback::class,
RedirectCallback::class
];
foreach ($callbacks as $callback) {
if (call_user_func([$callback, 'initable'], $r... | php | public function create(ServerRequestInterface $request) : CallbackInterface
{
$callbacks = [
XmlCallback::class,
FormCallback::class,
RedirectCallback::class
];
foreach ($callbacks as $callback) {
if (call_user_func([$callback, 'initable'], $r... | [
"public",
"function",
"create",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"CallbackInterface",
"{",
"$",
"callbacks",
"=",
"[",
"XmlCallback",
"::",
"class",
",",
"FormCallback",
"::",
"class",
",",
"RedirectCallback",
"::",
"class",
"]",
";",
"... | Will take a Psr Server Request and return a Form, Xml or Redirect
callback object that represent the actual callback
@param ServerRequestInterface $request
@throws \InvalidArgumentException
@return CallbackInterface | [
"Will",
"take",
"a",
"Psr",
"Server",
"Request",
"and",
"return",
"a",
"Form",
"Xml",
"or",
"Redirect",
"callback",
"object",
"that",
"represent",
"the",
"actual",
"callback"
] | 476664e8725407249c04ca7ae76f92882e4f4583 | https://github.com/loevgaard/altapay-php-sdk/blob/476664e8725407249c04ca7ae76f92882e4f4583/src/Callback/CallbackFactory.php#L20-L35 |
23,827 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.generate | public function generate(array $config)
{
$defaultHTTPCodes = $this->getDefaultHTTPCodes($config);
$defaultOptions = $this->getDefaultOptions($config);
return $this->createUrlChainFromConfig(
$config,
$defaultHTTPCodes,
$defaultOptions
);
} | php | public function generate(array $config)
{
$defaultHTTPCodes = $this->getDefaultHTTPCodes($config);
$defaultOptions = $this->getDefaultOptions($config);
return $this->createUrlChainFromConfig(
$config,
$defaultHTTPCodes,
$defaultOptions
);
} | [
"public",
"function",
"generate",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"defaultHTTPCodes",
"=",
"$",
"this",
"->",
"getDefaultHTTPCodes",
"(",
"$",
"config",
")",
";",
"$",
"defaultOptions",
"=",
"$",
"this",
"->",
"getDefaultOptions",
"(",
"$",
"co... | Given a configuration array, generates a chain of urls
@param array $config Configuration
@return UrlChain Chain of URL instances | [
"Given",
"a",
"configuration",
"array",
"generates",
"a",
"chain",
"of",
"urls"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L61-L71 |
23,828 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.getDefaultHTTPCodes | protected function getDefaultHTTPCodes($config)
{
$defaultHttpCodes = (
isset($config['defaults']) &&
is_array($config['defaults']) &&
isset($config['defaults']['http_codes']) &&
!empty($config['defaults']['http_codes'])
)
? $config['defaul... | php | protected function getDefaultHTTPCodes($config)
{
$defaultHttpCodes = (
isset($config['defaults']) &&
is_array($config['defaults']) &&
isset($config['defaults']['http_codes']) &&
!empty($config['defaults']['http_codes'])
)
? $config['defaul... | [
"protected",
"function",
"getDefaultHTTPCodes",
"(",
"$",
"config",
")",
"{",
"$",
"defaultHttpCodes",
"=",
"(",
"isset",
"(",
"$",
"config",
"[",
"'defaults'",
"]",
")",
"&&",
"is_array",
"(",
"$",
"config",
"[",
"'defaults'",
"]",
")",
"&&",
"isset",
"... | Get default http Codes
@param array $config Configuration
@return string[] Array of HTTP Codes | [
"Get",
"default",
"http",
"Codes"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L80-L96 |
23,829 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.getDefaultOptions | protected function getDefaultOptions($config)
{
$defaultOptions = (
isset($config['defaults']) &&
is_array($config['defaults']) &&
isset($config['defaults']['options']) &&
is_array($config['defaults']['options'])
)
? $config['defaults']['op... | php | protected function getDefaultOptions($config)
{
$defaultOptions = (
isset($config['defaults']) &&
is_array($config['defaults']) &&
isset($config['defaults']['options']) &&
is_array($config['defaults']['options'])
)
? $config['defaults']['op... | [
"protected",
"function",
"getDefaultOptions",
"(",
"$",
"config",
")",
"{",
"$",
"defaultOptions",
"=",
"(",
"isset",
"(",
"$",
"config",
"[",
"'defaults'",
"]",
")",
"&&",
"is_array",
"(",
"$",
"config",
"[",
"'defaults'",
"]",
")",
"&&",
"isset",
"(",
... | Get default options
@param array $config Configuration
@return array Default options | [
"Get",
"default",
"options"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L105-L117 |
23,830 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.createUrlChainFromConfig | protected function createUrlChainFromConfig(
array $config,
array $defaultHTTPCodes,
array $defaultOptions
) {
$urlChain = $this
->urlChainFactory
->create();
if (
!isset($config['urls']) ||
!is_array($config['urls'])
)... | php | protected function createUrlChainFromConfig(
array $config,
array $defaultHTTPCodes,
array $defaultOptions
) {
$urlChain = $this
->urlChainFactory
->create();
if (
!isset($config['urls']) ||
!is_array($config['urls'])
)... | [
"protected",
"function",
"createUrlChainFromConfig",
"(",
"array",
"$",
"config",
",",
"array",
"$",
"defaultHTTPCodes",
",",
"array",
"$",
"defaultOptions",
")",
"{",
"$",
"urlChain",
"=",
"$",
"this",
"->",
"urlChainFactory",
"->",
"create",
"(",
")",
";",
... | Given a config array, create an URLChain instance filled with all defined
URL instances.
@param array $config Configuration
@param string[] $defaultHTTPCodes Array of HTTP Codes
@param array $defaultOptions Default options
@return Url[] Array of URL instances | [
"Given",
"a",
"config",
"array",
"create",
"an",
"URLChain",
"instance",
"filled",
"with",
"all",
"defined",
"URL",
"instances",
"."
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L129-L164 |
23,831 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.getUrlInstanceFromConfig | protected function getUrlInstanceFromConfig(
$urlConfig,
array $defaultHTTPCodes,
array $defaultOptions,
array $profiles
) {
$url = $this->getUrlPathFromConfig($urlConfig);
$urlHTTPCodes = $this->getUrlHTTPCodesFromConfig(
$urlConfig,
$default... | php | protected function getUrlInstanceFromConfig(
$urlConfig,
array $defaultHTTPCodes,
array $defaultOptions,
array $profiles
) {
$url = $this->getUrlPathFromConfig($urlConfig);
$urlHTTPCodes = $this->getUrlHTTPCodesFromConfig(
$urlConfig,
$default... | [
"protected",
"function",
"getUrlInstanceFromConfig",
"(",
"$",
"urlConfig",
",",
"array",
"$",
"defaultHTTPCodes",
",",
"array",
"$",
"defaultOptions",
",",
"array",
"$",
"profiles",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getUrlPathFromConfig",
"(",
"$... | Get Url instance given its configuration
@param mixed $urlConfig Url configuration
@param string[] $defaultHTTPCodes Array of HTTP Codes
@param array $defaultOptions Default options
@param array $profiles Profiles
@return URL Url instance | [
"Get",
"Url",
"instance",
"given",
"its",
"configuration"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L176-L212 |
23,832 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.getUrlHTTPCodesFromConfig | protected function getUrlHTTPCodesFromConfig(
$urlConfig,
array $defaultHTTPCodes
) {
$HTTPCodes = (
is_array($urlConfig) &&
isset($urlConfig[1]) &&
!empty($urlConfig[1])
)
? $urlConfig[1]
: $defaultHTTPCodes;
retur... | php | protected function getUrlHTTPCodesFromConfig(
$urlConfig,
array $defaultHTTPCodes
) {
$HTTPCodes = (
is_array($urlConfig) &&
isset($urlConfig[1]) &&
!empty($urlConfig[1])
)
? $urlConfig[1]
: $defaultHTTPCodes;
retur... | [
"protected",
"function",
"getUrlHTTPCodesFromConfig",
"(",
"$",
"urlConfig",
",",
"array",
"$",
"defaultHTTPCodes",
")",
"{",
"$",
"HTTPCodes",
"=",
"(",
"is_array",
"(",
"$",
"urlConfig",
")",
"&&",
"isset",
"(",
"$",
"urlConfig",
"[",
"1",
"]",
")",
"&&"... | Get url HTTP Codes given its configuration
@param mixed $urlConfig Url configuration
@param string[] $defaultHTTPCodes Array of HTTP Codes
@return string[] Set of HTTP Codes | [
"Get",
"url",
"HTTP",
"Codes",
"given",
"its",
"configuration"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L236-L251 |
23,833 | Visithor/visithor | src/Visithor/Generator/UrlGenerator.php | UrlGenerator.getUrlOptionsFromConfig | protected function getUrlOptionsFromConfig(
$urlConfig,
array $defaultOptions
) {
$urlOptions = (
is_array($urlConfig) &&
isset($urlConfig[2]) &&
is_array($urlConfig[2])
)
? $urlConfig[2]
: [];
return array_merge(
... | php | protected function getUrlOptionsFromConfig(
$urlConfig,
array $defaultOptions
) {
$urlOptions = (
is_array($urlConfig) &&
isset($urlConfig[2]) &&
is_array($urlConfig[2])
)
? $urlConfig[2]
: [];
return array_merge(
... | [
"protected",
"function",
"getUrlOptionsFromConfig",
"(",
"$",
"urlConfig",
",",
"array",
"$",
"defaultOptions",
")",
"{",
"$",
"urlOptions",
"=",
"(",
"is_array",
"(",
"$",
"urlConfig",
")",
"&&",
"isset",
"(",
"$",
"urlConfig",
"[",
"2",
"]",
")",
"&&",
... | Get url options
@param mixed $urlConfig Url configuration
@param array $defaultOptions Default options
@return string[] Set of HTTP Codes | [
"Get",
"url",
"options"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Generator/UrlGenerator.php#L261-L277 |
23,834 | gedex/php-janrain-api | lib/Janrain/Api/Capture/Entity.php | Entity.count | public function count($entityType, $filter = '')
{
$params = array('type_name' => $entityType);
if (!empty($filter)) {
$params['filter'] = $filter;
}
return $this->post('entity.count', $params);
} | php | public function count($entityType, $filter = '')
{
$params = array('type_name' => $entityType);
if (!empty($filter)) {
$params['filter'] = $filter;
}
return $this->post('entity.count', $params);
} | [
"public",
"function",
"count",
"(",
"$",
"entityType",
",",
"$",
"filter",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'type_name'",
"=>",
"$",
"entityType",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"filter",
")",
")",
"{",
"$",
"... | Count the number of records in an entityType.
@param string $entityType The entityType of the entity
@param string $filter The expression to use to filter the results. | [
"Count",
"the",
"number",
"of",
"records",
"in",
"an",
"entityType",
"."
] | 6283f68454e0ad5211ac620f1d337df38cd49597 | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Entity.php#L53-L60 |
23,835 | gedex/php-janrain-api | lib/Janrain/Api/Capture/Entity.php | Entity.delete | public function delete($uuid, array $params = array())
{
$params['uuid'] = $uuid;
if (!isset($params['type_name'])) {
throw new MissingArgumentException('type_name');
}
return $this->_del($params);
} | php | public function delete($uuid, array $params = array())
{
$params['uuid'] = $uuid;
if (!isset($params['type_name'])) {
throw new MissingArgumentException('type_name');
}
return $this->_del($params);
} | [
"public",
"function",
"delete",
"(",
"$",
"uuid",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"[",
"'uuid'",
"]",
"=",
"$",
"uuid",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'type_name'",
"]",
")",
... | Default by UUID. | [
"Default",
"by",
"UUID",
"."
] | 6283f68454e0ad5211ac620f1d337df38cd49597 | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Entity.php#L96-L104 |
23,836 | gedex/php-janrain-api | lib/Janrain/Api/Capture/Entity.php | Entity.replaceByAttribute | public function replaceByAttribute($attributeKey, $attributeValue, array $params)
{
$params['key_attribute'] = $attributeKey;
$params['key_value'] = $this->wrapAttributeValueWithQuotes($attributeValue);
return $this->_replace($params);
} | php | public function replaceByAttribute($attributeKey, $attributeValue, array $params)
{
$params['key_attribute'] = $attributeKey;
$params['key_value'] = $this->wrapAttributeValueWithQuotes($attributeValue);
return $this->_replace($params);
} | [
"public",
"function",
"replaceByAttribute",
"(",
"$",
"attributeKey",
",",
"$",
"attributeValue",
",",
"array",
"$",
"params",
")",
"{",
"$",
"params",
"[",
"'key_attribute'",
"]",
"=",
"$",
"attributeKey",
";",
"$",
"params",
"[",
"'key_value'",
"]",
"=",
... | Replace part of an entity by attribute. | [
"Replace",
"part",
"of",
"an",
"entity",
"by",
"attribute",
"."
] | 6283f68454e0ad5211ac620f1d337df38cd49597 | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Entity.php#L207-L213 |
23,837 | gedex/php-janrain-api | lib/Janrain/Api/Capture/Entity.php | Entity.updateByAttribute | public function updateByAttribute($attributeKey, $attributeValue, array $params)
{
$params['key_attribute'] = $attributeKey;
$params['key_value'] = $this->wrapAttributeValueWithQuotes($attributeValue);
return $this->_update($params);
} | php | public function updateByAttribute($attributeKey, $attributeValue, array $params)
{
$params['key_attribute'] = $attributeKey;
$params['key_value'] = $this->wrapAttributeValueWithQuotes($attributeValue);
return $this->_update($params);
} | [
"public",
"function",
"updateByAttribute",
"(",
"$",
"attributeKey",
",",
"$",
"attributeValue",
",",
"array",
"$",
"params",
")",
"{",
"$",
"params",
"[",
"'key_attribute'",
"]",
"=",
"$",
"attributeKey",
";",
"$",
"params",
"[",
"'key_value'",
"]",
"=",
... | Update entity by attribute | [
"Update",
"entity",
"by",
"attribute"
] | 6283f68454e0ad5211ac620f1d337df38cd49597 | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Entity.php#L259-L265 |
23,838 | alevilar/ristorantino-vendor | Printers/Lib/PrinterOutput/AfipFacturasPrinterOutput.php | AfipFacturasPrinterOutput.send | public function send( $printaitorViewObj ) {
$dv = $printaitorViewObj->dataToView;
$factura['AfipFactura'] = array(
'json_data' => $printaitorViewObj->viewTextRender,
'mesa_id' => Hash::get( $dv, 'Mesa.id'),
'importe... | php | public function send( $printaitorViewObj ) {
$dv = $printaitorViewObj->dataToView;
$factura['AfipFactura'] = array(
'json_data' => $printaitorViewObj->viewTextRender,
'mesa_id' => Hash::get( $dv, 'Mesa.id'),
'importe... | [
"public",
"function",
"send",
"(",
"$",
"printaitorViewObj",
")",
"{",
"$",
"dv",
"=",
"$",
"printaitorViewObj",
"->",
"dataToView",
";",
"$",
"factura",
"[",
"'AfipFactura'",
"]",
"=",
"array",
"(",
"'json_data'",
"=>",
"$",
"printaitorViewObj",
"->",
"view... | Crea un archivo y lo guarda en la tabla afip_facturas
@param PrintaitorViewObj $printaitorViewObj
@return type boolean true si salio todo bien false caso contrario | [
"Crea",
"un",
"archivo",
"y",
"lo",
"guarda",
"en",
"la",
"tabla",
"afip_facturas"
] | 6b91a1e20cc0ba09a1968d77e3de6512cfa2d966 | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Printers/Lib/PrinterOutput/AfipFacturasPrinterOutput.php#L269-L293 |
23,839 | technote-space/wordpress-plugin-base | src/classes/models/lib/upgrade.php | Upgrade.show_plugin_update_notices | private function show_plugin_update_notices() {
add_action( 'in_plugin_update_message-' . $this->app->define->plugin_base_name, function ( $data, $r ) {
$new_version = $r->new_version;
$url = $this->app->utility->array_get( $data, 'PluginURI' );
$notices = $this->get_upgrade_notices( $new_version... | php | private function show_plugin_update_notices() {
add_action( 'in_plugin_update_message-' . $this->app->define->plugin_base_name, function ( $data, $r ) {
$new_version = $r->new_version;
$url = $this->app->utility->array_get( $data, 'PluginURI' );
$notices = $this->get_upgrade_notices( $new_version... | [
"private",
"function",
"show_plugin_update_notices",
"(",
")",
"{",
"add_action",
"(",
"'in_plugin_update_message-'",
".",
"$",
"this",
"->",
"app",
"->",
"define",
"->",
"plugin_base_name",
",",
"function",
"(",
"$",
"data",
",",
"$",
"r",
")",
"{",
"$",
"n... | show plugin upgrade notices
@since 2.4.1
@since 2.4.3 Fixed: get plugin upgrade notice from plugin directory | [
"show",
"plugin",
"upgrade",
"notices"
] | 02cfcba358432a2539af07a69d9db00ff7c14eac | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/upgrade.php#L175-L186 |
23,840 | GordonSchmidt/GSOcr | src/GSOcr/Service/OcrServiceFactory.php | OcrServiceFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Configuration');
if (!isset($config['ocr'])) {
throw new Exception\RuntimeException('No "ocr" section available in configuration.');
}
if (!isset($config['ocr']['servi... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Configuration');
if (!isset($config['ocr'])) {
throw new Exception\RuntimeException('No "ocr" section available in configuration.');
}
if (!isset($config['ocr']['servi... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'Configuration'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'ocr'",
"]",
... | Create OCR service
@param ServiceLocatorInterface $serviceLocator
@return OcrServiceInterface
@throws InvalidArgumentException | [
"Create",
"OCR",
"service"
] | b306f52d35fca8972957051d99cf96927051be79 | https://github.com/GordonSchmidt/GSOcr/blob/b306f52d35fca8972957051d99cf96927051be79/src/GSOcr/Service/OcrServiceFactory.php#L32-L49 |
23,841 | webservices-nl/common | src/Common/Endpoint/Manager.php | Manager.hasEndpoint | public function hasEndpoint($uri)
{
/** @var ArrayCollection $urlsFound */
$urlsFound = $this->getEndpoints()->filter(function (Endpoint $endpoint) use ($uri) {
// return when URI and URI string are equal
return (string) $endpoint->getUri() === $uri;
});
retu... | php | public function hasEndpoint($uri)
{
/** @var ArrayCollection $urlsFound */
$urlsFound = $this->getEndpoints()->filter(function (Endpoint $endpoint) use ($uri) {
// return when URI and URI string are equal
return (string) $endpoint->getUri() === $uri;
});
retu... | [
"public",
"function",
"hasEndpoint",
"(",
"$",
"uri",
")",
"{",
"/** @var ArrayCollection $urlsFound */",
"$",
"urlsFound",
"=",
"$",
"this",
"->",
"getEndpoints",
"(",
")",
"->",
"filter",
"(",
"function",
"(",
"Endpoint",
"$",
"endpoint",
")",
"use",
"(",
... | Checks if the given uri is already added to collection.
@param string $uri
@return bool | [
"Checks",
"if",
"the",
"given",
"uri",
"is",
"already",
"added",
"to",
"collection",
"."
] | f867fb5969636b185b26442446bb021743a6515e | https://github.com/webservices-nl/common/blob/f867fb5969636b185b26442446bb021743a6515e/src/Common/Endpoint/Manager.php#L60-L69 |
23,842 | webservices-nl/common | src/Common/Endpoint/Manager.php | Manager.addEndpoint | public function addEndpoint(Endpoint $newEndpoint)
{
if ($this->hasEndpoint((string) $newEndpoint->getUri())) {
throw new InputException('Endpoint already added');
}
// all newly added Endpoints are set to DISABLED, apart from the first one
$status = $this->getEndpoints(... | php | public function addEndpoint(Endpoint $newEndpoint)
{
if ($this->hasEndpoint((string) $newEndpoint->getUri())) {
throw new InputException('Endpoint already added');
}
// all newly added Endpoints are set to DISABLED, apart from the first one
$status = $this->getEndpoints(... | [
"public",
"function",
"addEndpoint",
"(",
"Endpoint",
"$",
"newEndpoint",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasEndpoint",
"(",
"(",
"string",
")",
"$",
"newEndpoint",
"->",
"getUri",
"(",
")",
")",
")",
"{",
"throw",
"new",
"InputException",
"(",
... | Add Endpoint into the pool.
@param Endpoint $newEndpoint
@throws InputException | [
"Add",
"Endpoint",
"into",
"the",
"pool",
"."
] | f867fb5969636b185b26442446bb021743a6515e | https://github.com/webservices-nl/common/blob/f867fb5969636b185b26442446bb021743a6515e/src/Common/Endpoint/Manager.php#L78-L89 |
23,843 | webservices-nl/common | src/Common/Endpoint/Manager.php | Manager.activateEndpoint | public function activateEndpoint(Endpoint $newActive, $force = false)
{
if (!$this->getEndpoints()->contains($newActive)) {
throw new InputException('Endpoint is not part of this manager');
}
if ($force === false && $this->canBeActivated($newActive) === false) {
thro... | php | public function activateEndpoint(Endpoint $newActive, $force = false)
{
if (!$this->getEndpoints()->contains($newActive)) {
throw new InputException('Endpoint is not part of this manager');
}
if ($force === false && $this->canBeActivated($newActive) === false) {
thro... | [
"public",
"function",
"activateEndpoint",
"(",
"Endpoint",
"$",
"newActive",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getEndpoints",
"(",
")",
"->",
"contains",
"(",
"$",
"newActive",
")",
")",
"{",
"throw",
"new",... | Try to activate an Endpoint as the active endpoint.
If endpoint status is Error, first check if it can be safely enabled.
@param Endpoint $newActive Endpoint to be enabled
@param bool $force when true, skips the cool down check
@throws InputException
@return Endpoint | [
"Try",
"to",
"activate",
"an",
"Endpoint",
"as",
"the",
"active",
"endpoint",
".",
"If",
"endpoint",
"status",
"is",
"Error",
"first",
"check",
"if",
"it",
"can",
"be",
"safely",
"enabled",
"."
] | f867fb5969636b185b26442446bb021743a6515e | https://github.com/webservices-nl/common/blob/f867fb5969636b185b26442446bb021743a6515e/src/Common/Endpoint/Manager.php#L112-L126 |
23,844 | webservices-nl/common | src/Common/Endpoint/Manager.php | Manager.canBeActivated | private function canBeActivated(Endpoint $newActive)
{
// if newActive is currently in error, see if it can be re-enabled
if ($newActive->isError() === true) {
$offlineInterval = new \DateTime();
$offlineInterval->modify('-60 minutes');
return $newActive->getLast... | php | private function canBeActivated(Endpoint $newActive)
{
// if newActive is currently in error, see if it can be re-enabled
if ($newActive->isError() === true) {
$offlineInterval = new \DateTime();
$offlineInterval->modify('-60 minutes');
return $newActive->getLast... | [
"private",
"function",
"canBeActivated",
"(",
"Endpoint",
"$",
"newActive",
")",
"{",
"// if newActive is currently in error, see if it can be re-enabled",
"if",
"(",
"$",
"newActive",
"->",
"isError",
"(",
")",
"===",
"true",
")",
"{",
"$",
"offlineInterval",
"=",
... | Determine if this endpoint can re-enabled.
@param Endpoint $newActive
@return bool | [
"Determine",
"if",
"this",
"endpoint",
"can",
"re",
"-",
"enabled",
"."
] | f867fb5969636b185b26442446bb021743a6515e | https://github.com/webservices-nl/common/blob/f867fb5969636b185b26442446bb021743a6515e/src/Common/Endpoint/Manager.php#L135-L146 |
23,845 | webservices-nl/common | src/Common/Endpoint/Manager.php | Manager.disableAll | private function disableAll()
{
// set all non-error endpoints to disabled
$this->getEndpoints()->map(function (Endpoint $endpoint) {
if ($endpoint->isError() === false) {
$endpoint->setStatus(Endpoint::STATUS_DISABLED);
}
});
} | php | private function disableAll()
{
// set all non-error endpoints to disabled
$this->getEndpoints()->map(function (Endpoint $endpoint) {
if ($endpoint->isError() === false) {
$endpoint->setStatus(Endpoint::STATUS_DISABLED);
}
});
} | [
"private",
"function",
"disableAll",
"(",
")",
"{",
"// set all non-error endpoints to disabled",
"$",
"this",
"->",
"getEndpoints",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"Endpoint",
"$",
"endpoint",
")",
"{",
"if",
"(",
"$",
"endpoint",
"->",
"isError"... | Disable all endpoints, except the ones in error.
@throws InputException | [
"Disable",
"all",
"endpoints",
"except",
"the",
"ones",
"in",
"error",
"."
] | f867fb5969636b185b26442446bb021743a6515e | https://github.com/webservices-nl/common/blob/f867fb5969636b185b26442446bb021743a6515e/src/Common/Endpoint/Manager.php#L153-L161 |
23,846 | webservices-nl/common | src/Common/Endpoint/Manager.php | Manager.getActiveEndpoint | public function getActiveEndpoint()
{
// try to get endpoint with status active
$active = $this->getEndpoints()->filter(function (Endpoint $endpoint) {
return $endpoint->isActive();
});
// when empty, try other endpoints
if ($active->isEmpty() === true) {
... | php | public function getActiveEndpoint()
{
// try to get endpoint with status active
$active = $this->getEndpoints()->filter(function (Endpoint $endpoint) {
return $endpoint->isActive();
});
// when empty, try other endpoints
if ($active->isEmpty() === true) {
... | [
"public",
"function",
"getActiveEndpoint",
"(",
")",
"{",
"// try to get endpoint with status active",
"$",
"active",
"=",
"$",
"this",
"->",
"getEndpoints",
"(",
")",
"->",
"filter",
"(",
"function",
"(",
"Endpoint",
"$",
"endpoint",
")",
"{",
"return",
"$",
... | Returns a active endpoint.
Tries to find the current active endpoint, or enable one.
@return Endpoint
@throws NoServerAvailableException | [
"Returns",
"a",
"active",
"endpoint",
".",
"Tries",
"to",
"find",
"the",
"current",
"active",
"endpoint",
"or",
"enable",
"one",
"."
] | f867fb5969636b185b26442446bb021743a6515e | https://github.com/webservices-nl/common/blob/f867fb5969636b185b26442446bb021743a6515e/src/Common/Endpoint/Manager.php#L171-L194 |
23,847 | surebert/surebert-framework | src/sb/Telnet.php | Telnet.connect | public function connect() {
// check if we need to convert host to IP
if (!preg_match('/([0-9]{1,3}\\.){3,3}[0-9]{1,3}/', $this->host)) {
$ip = gethostbyname($this->host);
if ($this->host == $ip) {
throw new \Exception("Cannot resolve $this->host");
... | php | public function connect() {
// check if we need to convert host to IP
if (!preg_match('/([0-9]{1,3}\\.){3,3}[0-9]{1,3}/', $this->host)) {
$ip = gethostbyname($this->host);
if ($this->host == $ip) {
throw new \Exception("Cannot resolve $this->host");
... | [
"public",
"function",
"connect",
"(",
")",
"{",
"// check if we need to convert host to IP",
"if",
"(",
"!",
"preg_match",
"(",
"'/([0-9]{1,3}\\\\.){3,3}[0-9]{1,3}/'",
",",
"$",
"this",
"->",
"host",
")",
")",
"{",
"$",
"ip",
"=",
"gethostbyname",
"(",
"$",
"thi... | Attempts connection to remote host. Returns TRUE if sucessful.
@return boolean | [
"Attempts",
"connection",
"to",
"remote",
"host",
".",
"Returns",
"TRUE",
"if",
"sucessful",
"."
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Telnet.php#L173-L196 |
23,848 | surebert/surebert-framework | src/sb/Telnet.php | Telnet.disconnect | public function disconnect() {
if ($this->socket) {
if (!fclose($this->socket)) {
throw new \Exception("Error while closing telnet socket");
}
$this->socket = NULL;
}
return true;
} | php | public function disconnect() {
if ($this->socket) {
if (!fclose($this->socket)) {
throw new \Exception("Error while closing telnet socket");
}
$this->socket = NULL;
}
return true;
} | [
"public",
"function",
"disconnect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"socket",
")",
"{",
"if",
"(",
"!",
"fclose",
"(",
"$",
"this",
"->",
"socket",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Error while closing telnet socket\"... | Closes IP socket
@return boolean | [
"Closes",
"IP",
"socket"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Telnet.php#L203-L211 |
23,849 | surebert/surebert-framework | src/sb/Telnet.php | Telnet.readTo | public function readTo($prompt) {
if (!$this->socket) {
throw new \Exception("Telnet connection closed");
}
// clear the buffer
$this->clearBuffer();
$until_t = time() + $this->timeout;
do {
// time's up (loop can be exited at end or through co... | php | public function readTo($prompt) {
if (!$this->socket) {
throw new \Exception("Telnet connection closed");
}
// clear the buffer
$this->clearBuffer();
$until_t = time() + $this->timeout;
do {
// time's up (loop can be exited at end or through co... | [
"public",
"function",
"readTo",
"(",
"$",
"prompt",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"socket",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Telnet connection closed\"",
")",
";",
"}",
"// clear the buffer ",
"$",
"this",
"->",
"clearBuf... | Reads characters from the socket and adds them to command buffer.
Handles telnet control characters. Stops when prompt is ecountered.
@param string $prompt
@return boolean | [
"Reads",
"characters",
"from",
"the",
"socket",
"and",
"adds",
"them",
"to",
"command",
"buffer",
".",
"Handles",
"telnet",
"control",
"characters",
".",
"Stops",
"when",
"prompt",
"is",
"ecountered",
"."
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Telnet.php#L266-L306 |
23,850 | surebert/surebert-framework | src/sb/Telnet.php | Telnet.write | public function write($buffer, $addNewLine = true) {
if (!$this->socket) {
throw new \Exception("Telnet connection closed");
}
// clear buffer from last command
$this->clearBuffer();
if ($addNewLine == true) {
$buffer .= "\n";
}
$this->... | php | public function write($buffer, $addNewLine = true) {
if (!$this->socket) {
throw new \Exception("Telnet connection closed");
}
// clear buffer from last command
$this->clearBuffer();
if ($addNewLine == true) {
$buffer .= "\n";
}
$this->... | [
"public",
"function",
"write",
"(",
"$",
"buffer",
",",
"$",
"addNewLine",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"socket",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Telnet connection closed\"",
")",
";",
"}",
"// clear buff... | Write command to a socket
@param string $buffer Stuff to write to socket
@param boolean $addNewLine Default true, adds newline to the command
@return boolean | [
"Write",
"command",
"to",
"a",
"socket"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Telnet.php#L315-L337 |
23,851 | surebert/surebert-framework | src/sb/Telnet.php | Telnet.getBuffer | public function getBuffer() {
// cut last line (is always prompt)
$buf = explode("\n", $this->buffer);
unset($buf[count($buf) - 1]);
$buf = implode("\n", $buf);
return trim($buf);
} | php | public function getBuffer() {
// cut last line (is always prompt)
$buf = explode("\n", $this->buffer);
unset($buf[count($buf) - 1]);
$buf = implode("\n", $buf);
return trim($buf);
} | [
"public",
"function",
"getBuffer",
"(",
")",
"{",
"// cut last line (is always prompt)",
"$",
"buf",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"this",
"->",
"buffer",
")",
";",
"unset",
"(",
"$",
"buf",
"[",
"count",
"(",
"$",
"buf",
")",
"-",
"1",
"]"... | Returns the content of the command buffer
@return string Content of the command buffer | [
"Returns",
"the",
"content",
"of",
"the",
"command",
"buffer"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Telnet.php#L360-L366 |
23,852 | surebert/surebert-framework | src/sb/Telnet.php | Telnet.negotiateTelnetOptions | public function negotiateTelnetOptions() {
$c = $this->getc();
if ($c != $this->IAC) {
if (($c == $this->DO) || ($c == $this->DONT)) {
$opt = $this->getc();
fwrite($this->socket, $this->IAC . $this->WONT . $opt);
} else if (($c == $this->WILL) ... | php | public function negotiateTelnetOptions() {
$c = $this->getc();
if ($c != $this->IAC) {
if (($c == $this->DO) || ($c == $this->DONT)) {
$opt = $this->getc();
fwrite($this->socket, $this->IAC . $this->WONT . $opt);
} else if (($c == $this->WILL) ... | [
"public",
"function",
"negotiateTelnetOptions",
"(",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"getc",
"(",
")",
";",
"if",
"(",
"$",
"c",
"!=",
"$",
"this",
"->",
"IAC",
")",
"{",
"if",
"(",
"(",
"$",
"c",
"==",
"$",
"this",
"->",
"DO",
")... | Telnet control character magic
@param string $command Character to check
@return boolean | [
"Telnet",
"control",
"character",
"magic"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Telnet.php#L383-L405 |
23,853 | rhosocial/yii2-user | forms/UsernameForm.php | UsernameForm.changeUsername | public function changeUsername()
{
if ($this->validate()) {
$username = $this->user->createUsername($this->username);
if (!$username) {
return false;
}
return $username->save();
}
return false;
} | php | public function changeUsername()
{
if ($this->validate()) {
$username = $this->user->createUsername($this->username);
if (!$username) {
return false;
}
return $username->save();
}
return false;
} | [
"public",
"function",
"changeUsername",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"$",
"username",
"=",
"$",
"this",
"->",
"user",
"->",
"createUsername",
"(",
"$",
"this",
"->",
"username",
")",
";",
"if",
"(",
"... | Change username.
@return bool | [
"Change",
"username",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/forms/UsernameForm.php#L84-L94 |
23,854 | mikemiles86/bazaarvoice-request | src/Request/BazaarvoiceRequest.php | BazaarvoiceRequest.buildUrl | private function buildUrl($endpoint, array $additional_parameters = []) {
// Build base domain URI.
$base = ($this->use_stage ? 'stg.' : '') . $this->domain;
// Build initial array of parameters.
$parameters = [
'passKey=' . $this->apiKey,
'ApiVersion=' . self::$api_version,
];
// A... | php | private function buildUrl($endpoint, array $additional_parameters = []) {
// Build base domain URI.
$base = ($this->use_stage ? 'stg.' : '') . $this->domain;
// Build initial array of parameters.
$parameters = [
'passKey=' . $this->apiKey,
'ApiVersion=' . self::$api_version,
];
// A... | [
"private",
"function",
"buildUrl",
"(",
"$",
"endpoint",
",",
"array",
"$",
"additional_parameters",
"=",
"[",
"]",
")",
"{",
"// Build base domain URI.",
"$",
"base",
"=",
"(",
"$",
"this",
"->",
"use_stage",
"?",
"'stg.'",
":",
"''",
")",
".",
"$",
"th... | Create Bazaarvoice URL with added parameters.
@param string $endpoint
API endpoint to call.
@param array $additional_parameters
Key/value of url parameters to add to URL.
@return string
Formatted API request URL. | [
"Create",
"Bazaarvoice",
"URL",
"with",
"added",
"parameters",
"."
] | 7993b6252ef71437736cb6dc8ddbf2ca6f7b09bd | https://github.com/mikemiles86/bazaarvoice-request/blob/7993b6252ef71437736cb6dc8ddbf2ca6f7b09bd/src/Request/BazaarvoiceRequest.php#L122-L157 |
23,855 | mikemiles86/bazaarvoice-request | src/Request/BazaarvoiceRequest.php | BazaarvoiceRequest.splitConfiguration | private function splitConfiguration(array $options) {
$return_array = [
'method' => 'GET',
'arguments' => [],
'options' => [],
];
// Request method passed?
if (isset($options['method'])) {
$return_array['method'] = $options['method'];
}
// URL arguments passed?
if (i... | php | private function splitConfiguration(array $options) {
$return_array = [
'method' => 'GET',
'arguments' => [],
'options' => [],
];
// Request method passed?
if (isset($options['method'])) {
$return_array['method'] = $options['method'];
}
// URL arguments passed?
if (i... | [
"private",
"function",
"splitConfiguration",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"return_array",
"=",
"[",
"'method'",
"=>",
"'GET'",
",",
"'arguments'",
"=>",
"[",
"]",
",",
"'options'",
"=>",
"[",
"]",
",",
"]",
";",
"// Request method passed?",
... | Splits API request options array into main buckets.
@param array $options
Key/Value array of api request options.
@return array | [
"Splits",
"API",
"request",
"options",
"array",
"into",
"main",
"buckets",
"."
] | 7993b6252ef71437736cb6dc8ddbf2ca6f7b09bd | https://github.com/mikemiles86/bazaarvoice-request/blob/7993b6252ef71437736cb6dc8ddbf2ca6f7b09bd/src/Request/BazaarvoiceRequest.php#L167-L189 |
23,856 | mikemiles86/bazaarvoice-request | src/Request/BazaarvoiceRequest.php | BazaarvoiceRequest.buildResponse | private function buildResponse($response_type, $method, $status_code, $request_url, array $configuration = [], array $response_data = []) {
$object = FALSE;
// Check that a string was passed.
if (is_string($response_type)) {
// Check to see if this class exists.
if (class_exists($response_type))... | php | private function buildResponse($response_type, $method, $status_code, $request_url, array $configuration = [], array $response_data = []) {
$object = FALSE;
// Check that a string was passed.
if (is_string($response_type)) {
// Check to see if this class exists.
if (class_exists($response_type))... | [
"private",
"function",
"buildResponse",
"(",
"$",
"response_type",
",",
"$",
"method",
",",
"$",
"status_code",
",",
"$",
"request_url",
",",
"array",
"$",
"configuration",
"=",
"[",
"]",
",",
"array",
"$",
"response_data",
"=",
"[",
"]",
")",
"{",
"$",
... | Returns a BazaarvoiceRequest\Response object.
@param string $response_type
Class name of response type to load.
@param string $method
HTTP request method.
@param string $status_code
HTTP request status code.
@param string $request_url
URL that request was made to.
@param array $configuration
Configuration settings... | [
"Returns",
"a",
"BazaarvoiceRequest",
"\\",
"Response",
"object",
"."
] | 7993b6252ef71437736cb6dc8ddbf2ca6f7b09bd | https://github.com/mikemiles86/bazaarvoice-request/blob/7993b6252ef71437736cb6dc8ddbf2ca6f7b09bd/src/Request/BazaarvoiceRequest.php#L215-L230 |
23,857 | heidelpay/PhpDoc | src/phpDocumentor/Plugin/Core/Transformer/Writer/Checkstyle.php | Checkstyle.getDestinationPath | protected function getDestinationPath(Transformation $transformation)
{
$artifact = $transformation->getTransformer()->getTarget()
. DIRECTORY_SEPARATOR . $transformation->getArtifact();
return $artifact;
} | php | protected function getDestinationPath(Transformation $transformation)
{
$artifact = $transformation->getTransformer()->getTarget()
. DIRECTORY_SEPARATOR . $transformation->getArtifact();
return $artifact;
} | [
"protected",
"function",
"getDestinationPath",
"(",
"Transformation",
"$",
"transformation",
")",
"{",
"$",
"artifact",
"=",
"$",
"transformation",
"->",
"getTransformer",
"(",
")",
"->",
"getTarget",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"transformation... | Retrieves the destination location for this artifact.
@param \phpDocumentor\Transformer\Transformation $transformation
@return string | [
"Retrieves",
"the",
"destination",
"location",
"for",
"this",
"artifact",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Checkstyle.php#L102-L108 |
23,858 | jasny/controller | src/Controller/Input.php | Input.getQueryParams | public function getQueryParams(array $list = null)
{
return isset($list)
? $this->listQueryParams($list)
: (array)$this->getRequest()->getQueryParams();
} | php | public function getQueryParams(array $list = null)
{
return isset($list)
? $this->listQueryParams($list)
: (array)$this->getRequest()->getQueryParams();
} | [
"public",
"function",
"getQueryParams",
"(",
"array",
"$",
"list",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"list",
")",
"?",
"$",
"this",
"->",
"listQueryParams",
"(",
"$",
"list",
")",
":",
"(",
"array",
")",
"$",
"this",
"->",
"getReque... | Get the request query parameters.
<code>
// Get all parameters
$params = $this->getQueryParams();
// Get specific parameters, specifying defaults for 'bar' and 'zoo'
list($foo, $bar, $zoo) = $this->getQueryParams(['foo', 'bar' => 10, 'zoo' => 'monkey']);
</code>
@param array $list
@return array | [
"Get",
"the",
"request",
"query",
"parameters",
"."
] | 28edf64343f1d8218c166c0c570128e1ee6153d8 | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Input.php#L34-L39 |
23,859 | jasny/controller | src/Controller/Input.php | Input.listQueryParams | protected function listQueryParams(array $list)
{
$result = [];
$params = $this->getRequest()->getQueryParams();
foreach ($list as $key => $value) {
if (is_int($key)) {
$key = $value;
$value = null;
}
$... | php | protected function listQueryParams(array $list)
{
$result = [];
$params = $this->getRequest()->getQueryParams();
foreach ($list as $key => $value) {
if (is_int($key)) {
$key = $value;
$value = null;
}
$... | [
"protected",
"function",
"listQueryParams",
"(",
"array",
"$",
"list",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getQueryParams",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as... | Apply list to query params
@param array $list
@return array | [
"Apply",
"list",
"to",
"query",
"params"
] | 28edf64343f1d8218c166c0c570128e1ee6153d8 | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Input.php#L47-L62 |
23,860 | jasny/controller | src/Controller/Input.php | Input.getQueryParam | public function getQueryParam($param, $default = null, $filter = null, $filterOptions = null)
{
$params = $this->getQueryParams();
$value = isset($params[$param]) ? $params[$param] : $default;
if (isset($filter) && isset($value)) {
$value = filter_var($value, $filter, $f... | php | public function getQueryParam($param, $default = null, $filter = null, $filterOptions = null)
{
$params = $this->getQueryParams();
$value = isset($params[$param]) ? $params[$param] : $default;
if (isset($filter) && isset($value)) {
$value = filter_var($value, $filter, $f... | [
"public",
"function",
"getQueryParam",
"(",
"$",
"param",
",",
"$",
"default",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"filterOptions",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getQueryParams",
"(",
")",
";",
"$"... | Get a query parameter.
Optionally apply filtering to the value.
@link http://php.net/manual/en/filter.filters.php
@param array $param
@param string $default
@param int $filter
@param mixed $filterOptions
@return mixed | [
"Get",
"a",
"query",
"parameter",
"."
] | 28edf64343f1d8218c166c0c570128e1ee6153d8 | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Input.php#L89-L99 |
23,861 | jasny/controller | src/Controller/Input.php | Input.getInput | public function getInput()
{
$data = $this->getRequest()->getParsedBody();
if (is_array($data)) {
$files = $this->getRequest()->getUploadedFiles();
$data = array_replace_recursive($data, (array)$files);
}
return $data;
} | php | public function getInput()
{
$data = $this->getRequest()->getParsedBody();
if (is_array($data)) {
$files = $this->getRequest()->getUploadedFiles();
$data = array_replace_recursive($data, (array)$files);
}
return $data;
} | [
"public",
"function",
"getInput",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getParsedBody",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"get... | Get parsed body and uploaded files as input
@return array|mixed | [
"Get",
"parsed",
"body",
"and",
"uploaded",
"files",
"as",
"input"
] | 28edf64343f1d8218c166c0c570128e1ee6153d8 | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Input.php#L107-L117 |
23,862 | php-comp/lite-database | src/LiteMongo.php | LiteMongo.isSupported | public static function isSupported(string $driver): bool
{
if ($driver === self::DRIVER_MONGO_DB) {
return \extension_loaded('mongodb');
}
if ($driver === self::DRIVER_MONGO) {
return \extension_loaded('mongo');
}
return false;
} | php | public static function isSupported(string $driver): bool
{
if ($driver === self::DRIVER_MONGO_DB) {
return \extension_loaded('mongodb');
}
if ($driver === self::DRIVER_MONGO) {
return \extension_loaded('mongo');
}
return false;
} | [
"public",
"static",
"function",
"isSupported",
"(",
"string",
"$",
"driver",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"driver",
"===",
"self",
"::",
"DRIVER_MONGO_DB",
")",
"{",
"return",
"\\",
"extension_loaded",
"(",
"'mongodb'",
")",
";",
"}",
"if",
"("... | Is this driver supported.
@param string $driver
@return bool | [
"Is",
"this",
"driver",
"supported",
"."
] | af5f73cb89e0e6cd24dd464f7a48fb5088eaafca | https://github.com/php-comp/lite-database/blob/af5f73cb89e0e6cd24dd464f7a48fb5088eaafca/src/LiteMongo.php#L37-L48 |
23,863 | mainio/c5pkg_symfony_forms | src/Mainio/C5/Symfony/Form/Extension/Concrete5/DataTransformer/DateTimeToFormWidgetTransformer.php | DateTimeToFormWidgetTransformer.transform | public function transform($dateTime)
{
if ($dateTime === null || trim($dateTime) == '') {
return '';
}
if (!$dateTime instanceof \DateTime) {
throw new TransformationFailedException('Expected a \DateTime.');
}
$dateTime = clone $dateTime;
if ... | php | public function transform($dateTime)
{
if ($dateTime === null || trim($dateTime) == '') {
return '';
}
if (!$dateTime instanceof \DateTime) {
throw new TransformationFailedException('Expected a \DateTime.');
}
$dateTime = clone $dateTime;
if ... | [
"public",
"function",
"transform",
"(",
"$",
"dateTime",
")",
"{",
"if",
"(",
"$",
"dateTime",
"===",
"null",
"||",
"trim",
"(",
"$",
"dateTime",
")",
"==",
"''",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"$",
"dateTime",
"instanceof",
"\... | Transforms a normalized date into a the concrete5 datetime widget format.
@param \DateTime $dateTime Normalized date.
@return string Widget format date.
@throws TransformationFailedException If the given value is not an
instance of \DateTime or if the
output timezone is not supported. | [
"Transforms",
"a",
"normalized",
"date",
"into",
"a",
"the",
"concrete5",
"datetime",
"widget",
"format",
"."
] | 41a93c293d986574ec5cade8a7c8700e083dbaaa | https://github.com/mainio/c5pkg_symfony_forms/blob/41a93c293d986574ec5cade8a7c8700e083dbaaa/src/Mainio/C5/Symfony/Form/Extension/Concrete5/DataTransformer/DateTimeToFormWidgetTransformer.php#L41-L64 |
23,864 | jim-moser/zf2-validators-empty-or | src/VerboseOrChain.php | VerboseOrChain.setPreMessageTemplate | public function setPreMessageTemplate($template = null)
{
if (null !== $template) {
$template = (string) $template;
}
$this->abstractOptions['messageTemplates']
[self::PRE_MESSAGE_TEMPLATE_KEY] = $template;
return $this;
} | php | public function setPreMessageTemplate($template = null)
{
if (null !== $template) {
$template = (string) $template;
}
$this->abstractOptions['messageTemplates']
[self::PRE_MESSAGE_TEMPLATE_KEY] = $template;
return $this;
} | [
"public",
"function",
"setPreMessageTemplate",
"(",
"$",
"template",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"template",
")",
"{",
"$",
"template",
"=",
"(",
"string",
")",
"$",
"template",
";",
"}",
"$",
"this",
"->",
"abstractOptions",
... | Sets template of validation failure message to be inserted at beginning
of validation failure message map.
Use null to specify no message should be inserted.
@param string|null $template
@return self | [
"Sets",
"template",
"of",
"validation",
"failure",
"message",
"to",
"be",
"inserted",
"at",
"beginning",
"of",
"validation",
"failure",
"message",
"map",
"."
] | 12f799e18ff59986c23ff3f934702834046438f2 | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/VerboseOrChain.php#L257-L265 |
23,865 | jim-moser/zf2-validators-empty-or | src/VerboseOrChain.php | VerboseOrChain.setPostMessageTemplate | public function setPostMessageTemplate($postMessage = null)
{
if (null !== $postMessage) {
$postMessage = (string) $postMessage;
}
$this->abstractOptions['messageTemplates']
[self::POST_MESSAGE_TEMPLATE_KEY] = $postMessage;
return $this;... | php | public function setPostMessageTemplate($postMessage = null)
{
if (null !== $postMessage) {
$postMessage = (string) $postMessage;
}
$this->abstractOptions['messageTemplates']
[self::POST_MESSAGE_TEMPLATE_KEY] = $postMessage;
return $this;... | [
"public",
"function",
"setPostMessageTemplate",
"(",
"$",
"postMessage",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"postMessage",
")",
"{",
"$",
"postMessage",
"=",
"(",
"string",
")",
"$",
"postMessage",
";",
"}",
"$",
"this",
"->",
"abstrac... | Sets template of validation failure message to be inserted at end of
validation failure message map.
Use null to specify no message should be inserted.
@param string|null $postMessage
@return self | [
"Sets",
"template",
"of",
"validation",
"failure",
"message",
"to",
"be",
"inserted",
"at",
"end",
"of",
"validation",
"failure",
"message",
"map",
"."
] | 12f799e18ff59986c23ff3f934702834046438f2 | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/VerboseOrChain.php#L290-L298 |
23,866 | jim-moser/zf2-validators-empty-or | src/VerboseOrChain.php | VerboseOrChain.attach | public function attach(ValidatorInterface $validator,
$showMessages = true,
$leadingTemplate = null,
$trailingTemplate = null,
$priority = self::DEFAULT_PRIORITY)
{
$this->validators->insert(
... | php | public function attach(ValidatorInterface $validator,
$showMessages = true,
$leadingTemplate = null,
$trailingTemplate = null,
$priority = self::DEFAULT_PRIORITY)
{
$this->validators->insert(
... | [
"public",
"function",
"attach",
"(",
"ValidatorInterface",
"$",
"validator",
",",
"$",
"showMessages",
"=",
"true",
",",
"$",
"leadingTemplate",
"=",
"null",
",",
"$",
"trailingTemplate",
"=",
"null",
",",
"$",
"priority",
"=",
"self",
"::",
"DEFAULT_PRIORITY"... | Attaches validator to end of chain.
@param ValidatorInterface $validator
@param boolean $showMessages Show messages for this
validator on failure.
@param string|null $leadingTemplate Validator's leading message
template.
@param string|null $trailingTemplate Validator's trailing message
te... | [
"Attaches",
"validator",
"to",
"end",
"of",
"chain",
"."
] | 12f799e18ff59986c23ff3f934702834046438f2 | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/VerboseOrChain.php#L363-L379 |
23,867 | jim-moser/zf2-validators-empty-or | src/VerboseOrChain.php | VerboseOrChain.prependValidator | public function prependValidator(ValidatorInterface $validator,
$showMessages = true,
$leadingTemplate = null,
$trailingTemplate = null)
{
$priority = self::DEFAULT_PRIORITY;
if (!$this->v... | php | public function prependValidator(ValidatorInterface $validator,
$showMessages = true,
$leadingTemplate = null,
$trailingTemplate = null)
{
$priority = self::DEFAULT_PRIORITY;
if (!$this->v... | [
"public",
"function",
"prependValidator",
"(",
"ValidatorInterface",
"$",
"validator",
",",
"$",
"showMessages",
"=",
"true",
",",
"$",
"leadingTemplate",
"=",
"null",
",",
"$",
"trailingTemplate",
"=",
"null",
")",
"{",
"$",
"priority",
"=",
"self",
"::",
"... | Adds validator to beginning of chain.
@param ValidatorInterface $validator
@param boolean $showMessages Show messages for this
validator on failure.
@param string|null $leadingTemplate Validator's leading message
template.
@param string|null $trailingTemplate Validator's trailing message
... | [
"Adds",
"validator",
"to",
"beginning",
"of",
"chain",
"."
] | 12f799e18ff59986c23ff3f934702834046438f2 | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/VerboseOrChain.php#L393-L416 |
23,868 | jim-moser/zf2-validators-empty-or | src/VerboseOrChain.php | VerboseOrChain.createMessageFromTemplate | protected function createMessageFromTemplate($messageTemplate, $value)
{
// AbstractValidator::translateMessage does not use first argument.
$message = $this->translateMessage('dummyValue',
(string) $messageTemplate);
if (is_object($value) ... | php | protected function createMessageFromTemplate($messageTemplate, $value)
{
// AbstractValidator::translateMessage does not use first argument.
$message = $this->translateMessage('dummyValue',
(string) $messageTemplate);
if (is_object($value) ... | [
"protected",
"function",
"createMessageFromTemplate",
"(",
"$",
"messageTemplate",
",",
"$",
"value",
")",
"{",
"// AbstractValidator::translateMessage does not use first argument.",
"$",
"message",
"=",
"$",
"this",
"->",
"translateMessage",
"(",
"'dummyValue'",
",",
"("... | Constructs and returns validation failure message for specified message
template and value.
This is used in place of AbstractValidator::createMessage() since leading
and trailing union messages are not stored with a message key under
abstractOptions['messageTemplates'].
If a translator is available and a translation ... | [
"Constructs",
"and",
"returns",
"validation",
"failure",
"message",
"for",
"specified",
"message",
"template",
"and",
"value",
"."
] | 12f799e18ff59986c23ff3f934702834046438f2 | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/VerboseOrChain.php#L514-L543 |
23,869 | jim-moser/zf2-validators-empty-or | src/VerboseOrChain.php | VerboseOrChain.merge | public function merge(VerboseOrChain $validatorChain)
{
foreach ($validatorChain->validators->toArray(PriorityQueue::EXTR_BOTH)
as $item) {
$this->attach($item['data']['instance'],
$item['data']['show_... | php | public function merge(VerboseOrChain $validatorChain)
{
foreach ($validatorChain->validators->toArray(PriorityQueue::EXTR_BOTH)
as $item) {
$this->attach($item['data']['instance'],
$item['data']['show_... | [
"public",
"function",
"merge",
"(",
"VerboseOrChain",
"$",
"validatorChain",
")",
"{",
"foreach",
"(",
"$",
"validatorChain",
"->",
"validators",
"->",
"toArray",
"(",
"PriorityQueue",
"::",
"EXTR_BOTH",
")",
"as",
"$",
"item",
")",
"{",
"$",
"this",
"->",
... | Merges in logical "or" validator chain provided as argument.
Priorities of validators within the internal priority queues are
maintained.
Unfortunately this method accesses the OrValidatorChain::validators
property which is protected. This means the type hint for the
$validatorChain argument is restricted to this cla... | [
"Merges",
"in",
"logical",
"or",
"validator",
"chain",
"provided",
"as",
"argument",
"."
] | 12f799e18ff59986c23ff3f934702834046438f2 | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/VerboseOrChain.php#L684-L695 |
23,870 | shipcore-nl/data-object | src/DataObject.php | DataObject.getRawType | private function getRawType(\ReflectionProperty $property)
{
$matches = [];
if (preg_match('/@var\s+([^\s]+)/', $property->getDocComment(), $matches)) {
list(, $rawType) = $matches;
} else {
$rawType = 'mixed';
}
return $rawType;
} | php | private function getRawType(\ReflectionProperty $property)
{
$matches = [];
if (preg_match('/@var\s+([^\s]+)/', $property->getDocComment(), $matches)) {
list(, $rawType) = $matches;
} else {
$rawType = 'mixed';
}
return $rawType;
} | [
"private",
"function",
"getRawType",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"preg_match",
"(",
"'/@var\\s+([^\\s]+)/'",
",",
"$",
"property",
"->",
"getDocComment",
"(",
")",
",",
"$",
"ma... | Returns raw string type format from the var annotation
@param \ReflectionProperty $property
@return string | [
"Returns",
"raw",
"string",
"type",
"format",
"from",
"the",
"var",
"annotation"
] | ad7f43e63e0e149ddb0acaaad7b64466d81da6c6 | https://github.com/shipcore-nl/data-object/blob/ad7f43e63e0e149ddb0acaaad7b64466d81da6c6/src/DataObject.php#L80-L89 |
23,871 | panlatent/boost | src/BString.php | BString.random | public static function random($length = 6, $pool = self::RANDOM_POOL)
{
return substr(str_shuffle(str_repeat($pool, 5)), 0, $length);
} | php | public static function random($length = 6, $pool = self::RANDOM_POOL)
{
return substr(str_shuffle(str_repeat($pool, 5)), 0, $length);
} | [
"public",
"static",
"function",
"random",
"(",
"$",
"length",
"=",
"6",
",",
"$",
"pool",
"=",
"self",
"::",
"RANDOM_POOL",
")",
"{",
"return",
"substr",
"(",
"str_shuffle",
"(",
"str_repeat",
"(",
"$",
"pool",
",",
"5",
")",
")",
",",
"0",
",",
"$... | Make a random string.
@param int $length
@param string $pool
@return string | [
"Make",
"a",
"random",
"string",
"."
] | b0970118d15cda1edb2d9dc66f0b575ee9b00b2c | https://github.com/panlatent/boost/blob/b0970118d15cda1edb2d9dc66f0b575ee9b00b2c/src/BString.php#L53-L56 |
23,872 | WellCommerce/AppBundle | CacheWarmer/TemplatePathsCacheWarmer.php | TemplatePathsCacheWarmer.locateTemplate | protected function locateTemplate(FileLocatorInterface $locator, TemplateReference $template, array &$templates)
{
$templates[$template->getLogicalName()] = $locator->locate($template->getPath());
} | php | protected function locateTemplate(FileLocatorInterface $locator, TemplateReference $template, array &$templates)
{
$templates[$template->getLogicalName()] = $locator->locate($template->getPath());
} | [
"protected",
"function",
"locateTemplate",
"(",
"FileLocatorInterface",
"$",
"locator",
",",
"TemplateReference",
"$",
"template",
",",
"array",
"&",
"$",
"templates",
")",
"{",
"$",
"templates",
"[",
"$",
"template",
"->",
"getLogicalName",
"(",
")",
"]",
"="... | Locates and appends template to an array
@param FileLocatorInterface $locator
@param TemplateReference $template
@param array $templates | [
"Locates",
"and",
"appends",
"template",
"to",
"an",
"array"
] | 2add687d1c898dd0b24afd611d896e3811a0eac3 | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/CacheWarmer/TemplatePathsCacheWarmer.php#L69-L72 |
23,873 | heidelpay/PhpDoc | src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php | AreAllArgumentsValid.validate | public function validate($element)
{
$docBlock = $element->getDocBlock();
if (null === $docBlock) {
throw new \UnexpectedValueException(
'A DocBlock should be present (and validated) before this validator can be applied'
);
}
if ($docBlock->ha... | php | public function validate($element)
{
$docBlock = $element->getDocBlock();
if (null === $docBlock) {
throw new \UnexpectedValueException(
'A DocBlock should be present (and validated) before this validator can be applied'
);
}
if ($docBlock->ha... | [
"public",
"function",
"validate",
"(",
"$",
"element",
")",
"{",
"$",
"docBlock",
"=",
"$",
"element",
"->",
"getDocBlock",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"docBlock",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"'A Doc... | Validates whether the given Reflector's arguments match the business rules of phpDocumentor.
@param BaseReflector $element
@throws \UnexpectedValueException if no DocBlock is associated with the given Reflector.
@return Error|null | [
"Validates",
"whether",
"the",
"given",
"Reflector",
"s",
"arguments",
"match",
"the",
"business",
"rules",
"of",
"phpDocumentor",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php#L36-L53 |
23,874 | heidelpay/PhpDoc | src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php | AreAllArgumentsValid.validateArguments | protected function validateArguments($element)
{
$params = $element->getDocBlock()->getTagsByName('param');
$arguments = $element->getArguments();
foreach (array_values($arguments) as $key => $argument) {
if (!$this->isArgumentInDocBlock($key, $argument, $element, $params)) {
... | php | protected function validateArguments($element)
{
$params = $element->getDocBlock()->getTagsByName('param');
$arguments = $element->getArguments();
foreach (array_values($arguments) as $key => $argument) {
if (!$this->isArgumentInDocBlock($key, $argument, $element, $params)) {
... | [
"protected",
"function",
"validateArguments",
"(",
"$",
"element",
")",
"{",
"$",
"params",
"=",
"$",
"element",
"->",
"getDocBlock",
"(",
")",
"->",
"getTagsByName",
"(",
"'param'",
")",
";",
"$",
"arguments",
"=",
"$",
"element",
"->",
"getArguments",
"(... | Returns an error if the given Reflector's arguments do not match expectations.
@param FunctionReflector $element
@return Error|null | [
"Returns",
"an",
"error",
"if",
"the",
"given",
"Reflector",
"s",
"arguments",
"do",
"not",
"match",
"expectations",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php#L62-L100 |
23,875 | heidelpay/PhpDoc | src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php | AreAllArgumentsValid.isArgumentInDocBlock | protected function isArgumentInDocBlock($index, ArgumentReflector $argument, BaseReflector $element, array $params)
{
if (isset($params[$index])) {
return null;
}
return new Error(
LogLevel::ERROR,
'PPC:ERR-50015',
$argument->getLinenumber(),
... | php | protected function isArgumentInDocBlock($index, ArgumentReflector $argument, BaseReflector $element, array $params)
{
if (isset($params[$index])) {
return null;
}
return new Error(
LogLevel::ERROR,
'PPC:ERR-50015',
$argument->getLinenumber(),
... | [
"protected",
"function",
"isArgumentInDocBlock",
"(",
"$",
"index",
",",
"ArgumentReflector",
"$",
"argument",
",",
"BaseReflector",
"$",
"element",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"$",
"index",
"]",
")",... | Validates whether an argument is mentioned in the docblock.
@param integer $index The position in the argument listing.
@param ArgumentReflector $argument The argument itself.
@param BaseReflector $element
@param Tag[] $params The list of param tags to validate against.
@return bool whe... | [
"Validates",
"whether",
"an",
"argument",
"is",
"mentioned",
"in",
"the",
"docblock",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php#L112-L124 |
23,876 | heidelpay/PhpDoc | src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php | AreAllArgumentsValid.doesArgumentNameMatchParam | protected function doesArgumentNameMatchParam(ParamTag $param, ArgumentReflector $argument, BaseReflector $element)
{
$param_name = $param->getVariableName();
if ($param_name == $argument->getName()) {
return null;
}
if ($param_name == '') {
$param->setVariab... | php | protected function doesArgumentNameMatchParam(ParamTag $param, ArgumentReflector $argument, BaseReflector $element)
{
$param_name = $param->getVariableName();
if ($param_name == $argument->getName()) {
return null;
}
if ($param_name == '') {
$param->setVariab... | [
"protected",
"function",
"doesArgumentNameMatchParam",
"(",
"ParamTag",
"$",
"param",
",",
"ArgumentReflector",
"$",
"argument",
",",
"BaseReflector",
"$",
"element",
")",
"{",
"$",
"param_name",
"=",
"$",
"param",
"->",
"getVariableName",
"(",
")",
";",
"if",
... | Validates whether the name of the argument is the same as that of the
param tag.
If the param tag does not contain a name then this method will set it
based on the argument.
@param ParamTag $param param to validate with.
@param ArgumentReflector $argument Argument to validate against.
@param BaseReflector... | [
"Validates",
"whether",
"the",
"name",
"of",
"the",
"argument",
"is",
"the",
"same",
"as",
"that",
"of",
"the",
"param",
"tag",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Functions/AreAllArgumentsValid.php#L139-L158 |
23,877 | nabab/bbn | src/bbn/mvc/common.php | common.check_path | private function check_path(){
$ar = \func_get_args();
foreach ( $ar as $a ){
$b = bbn\str::parse_path($a, true);
if ( empty($b) && !empty($a) ){
$this->error("The path $a is not an acceptable value");
return false;
}
}
return 1;
} | php | private function check_path(){
$ar = \func_get_args();
foreach ( $ar as $a ){
$b = bbn\str::parse_path($a, true);
if ( empty($b) && !empty($a) ){
$this->error("The path $a is not an acceptable value");
return false;
}
}
return 1;
} | [
"private",
"function",
"check_path",
"(",
")",
"{",
"$",
"ar",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"ar",
"as",
"$",
"a",
")",
"{",
"$",
"b",
"=",
"bbn",
"\\",
"str",
"::",
"parse_path",
"(",
"$",
"a",
",",
"true",
")... | This checks whether an argument used for getting controller, view or model - which are files - doesn't contain malicious content.
@param string $p The request path <em>(e.g books/466565 or html/home)</em>
@return bool | [
"This",
"checks",
"whether",
"an",
"argument",
"used",
"for",
"getting",
"controller",
"view",
"or",
"model",
"-",
"which",
"are",
"files",
"-",
"doesn",
"t",
"contain",
"malicious",
"content",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/mvc/common.php#L21-L31 |
23,878 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriber.php | ezcomSubscriber.fetchByEmail | static function fetchByEmail( $email )
{
$cond = array( 'email' => $email );
$return = eZPersistentObject::fetchObject( self::definition(), null, $cond );
return $return;
} | php | static function fetchByEmail( $email )
{
$cond = array( 'email' => $email );
$return = eZPersistentObject::fetchObject( self::definition(), null, $cond );
return $return;
} | [
"static",
"function",
"fetchByEmail",
"(",
"$",
"email",
")",
"{",
"$",
"cond",
"=",
"array",
"(",
"'email'",
"=>",
"$",
"email",
")",
";",
"$",
"return",
"=",
"eZPersistentObject",
"::",
"fetchObject",
"(",
"self",
"::",
"definition",
"(",
")",
",",
"... | Fetch ezcomSubscriber by given email
@param int $email
@return null|ezcomSubscriber | [
"Fetch",
"ezcomSubscriber",
"by",
"given",
"email"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriber.php#L92-L97 |
23,879 | phpnfe/tools | src/Soap/CurlSoap.php | CurlSoap.getWsdl | public function getWsdl($urlservice)
{
$aURL = explode('?', $urlservice);
if (count($aURL) == 1) {
$urlservice .= '?wsdl';
}
$resposta = $this->zCommCurl($urlservice);
//verifica se foi retornado o wsdl
$nPos = strpos($resposta, '<wsdl:def');
if ($... | php | public function getWsdl($urlservice)
{
$aURL = explode('?', $urlservice);
if (count($aURL) == 1) {
$urlservice .= '?wsdl';
}
$resposta = $this->zCommCurl($urlservice);
//verifica se foi retornado o wsdl
$nPos = strpos($resposta, '<wsdl:def');
if ($... | [
"public",
"function",
"getWsdl",
"(",
"$",
"urlservice",
")",
"{",
"$",
"aURL",
"=",
"explode",
"(",
"'?'",
",",
"$",
"urlservice",
")",
";",
"if",
"(",
"count",
"(",
"$",
"aURL",
")",
"==",
"1",
")",
"{",
"$",
"urlservice",
".=",
"'?wsdl'",
";",
... | getWsdl
Baixa o arquivo wsdl do webservice.
@param string $urlsefaz
@return bool|string | [
"getWsdl",
"Baixa",
"o",
"arquivo",
"wsdl",
"do",
"webservice",
"."
] | 303ca311989e0b345071f61b71d2b3bf7ee80454 | https://github.com/phpnfe/tools/blob/303ca311989e0b345071f61b71d2b3bf7ee80454/src/Soap/CurlSoap.php#L227-L246 |
23,880 | ronaldborla/chikka | src/Borla/Chikka/Support/Http/Http.php | Http.post | public function post($url, $body, array $headers = array()) {
// If body is array
if (is_array($body)) {
// Convert to string
$body = http_build_query($body);
}
// Do post and get response
$response = $this->getClient()->post($url, $body, $headers);
// If not response
if ( ! $res... | php | public function post($url, $body, array $headers = array()) {
// If body is array
if (is_array($body)) {
// Convert to string
$body = http_build_query($body);
}
// Do post and get response
$response = $this->getClient()->post($url, $body, $headers);
// If not response
if ( ! $res... | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"$",
"body",
",",
"array",
"$",
"headers",
"=",
"array",
"(",
")",
")",
"{",
"// If body is array",
"if",
"(",
"is_array",
"(",
"$",
"body",
")",
")",
"{",
"// Convert to string",
"$",
"body",
"=",
... | Create post request
@return \Borla\Chikka\Support\Http\Response | [
"Create",
"post",
"request"
] | 446987706f81d5a0efbc8bd6b7d3b259d0527719 | https://github.com/ronaldborla/chikka/blob/446987706f81d5a0efbc8bd6b7d3b259d0527719/src/Borla/Chikka/Support/Http/Http.php#L24-L39 |
23,881 | flowcode/AmulenUserBundle | src/Flowcode/UserBundle/Repository/UserRepository.php | UserRepository.findByUsername | public function findByUsername($username)
{
$qb = $this->createQueryBuilder("u");
$qb->where("(u.username = :username OR u.email = :email)")
->setParameter("username", $username)
->setParameter("email", $username);
$qb->andWhere("u.status = :status")->setParameter("st... | php | public function findByUsername($username)
{
$qb = $this->createQueryBuilder("u");
$qb->where("(u.username = :username OR u.email = :email)")
->setParameter("username", $username)
->setParameter("email", $username);
$qb->andWhere("u.status = :status")->setParameter("st... | [
"public",
"function",
"findByUsername",
"(",
"$",
"username",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"\"u\"",
")",
";",
"$",
"qb",
"->",
"where",
"(",
"\"(u.username = :username OR u.email = :email)\"",
")",
"->",
"setParameter",... | Find by username.
@param string $username A username.
@return User The user. | [
"Find",
"by",
"username",
"."
] | 00055834d9f094e63dcd8d66e2fedb822fcddee0 | https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Repository/UserRepository.php#L22-L31 |
23,882 | DesignPond/newsletter | src/Newsletter/Helper/Helper.php | Helper.getPrefixString | public function getPrefixString($array, $prefix)
{
$items = array();
if(!empty($array)){
foreach($array as $item){
preg_match('/'.$prefix.'(.*)/', $item, $results);
if(isset($results[1])){
$items[] = $results[1];
}
... | php | public function getPrefixString($array, $prefix)
{
$items = array();
if(!empty($array)){
foreach($array as $item){
preg_match('/'.$prefix.'(.*)/', $item, $results);
if(isset($results[1])){
$items[] = $results[1];
}
... | [
"public",
"function",
"getPrefixString",
"(",
"$",
"array",
",",
"$",
"prefix",
")",
"{",
"$",
"items",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"item",
")",
... | Get array of string using prefix
@return | [
"Get",
"array",
"of",
"string",
"using",
"prefix"
] | 0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3 | https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Newsletter/Helper/Helper.php#L260-L274 |
23,883 | Danzabar/config-builder | src/Data/Reader.php | Reader.read | public function read($file)
{
$this->file = $file;
if($this->fs->exists($this->file)) {
$this->data = file_get_contents($this->file);
return $this;
}
// Throw exception
throw new Exceptions\FileNotExists($this->file);
} | php | public function read($file)
{
$this->file = $file;
if($this->fs->exists($this->file)) {
$this->data = file_get_contents($this->file);
return $this;
}
// Throw exception
throw new Exceptions\FileNotExists($this->file);
} | [
"public",
"function",
"read",
"(",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"file",
"=",
"$",
"file",
";",
"if",
"(",
"$",
"this",
"->",
"fs",
"->",
"exists",
"(",
"$",
"this",
"->",
"file",
")",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"fi... | Read from the file
@param String $file
@return Reader
@author Dan Cox
@throws Exceptions\FileNotExists | [
"Read",
"from",
"the",
"file"
] | 3b237be578172c32498bbcdfb360e69a6243739d | https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/Reader.php#L56-L69 |
23,884 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings.fromString | public static function fromString($json, $directory = ".") {
$json = json_decode($json, true);
if (is_null($json))
throw new SettingsException("invalid json");
return new static($json, $directory);
} | php | public static function fromString($json, $directory = ".") {
$json = json_decode($json, true);
if (is_null($json))
throw new SettingsException("invalid json");
return new static($json, $directory);
} | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"json",
",",
"$",
"directory",
"=",
"\".\"",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"json",
")",
")",
"throw",
"new... | Creates settings from a JSON-encoded string.
@param string $json
@param string $directory the directory the settings apply to
@return Settings | [
"Creates",
"settings",
"from",
"a",
"JSON",
"-",
"encoded",
"string",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L74-L79 |
23,885 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings.fromFile | public static function fromFile($fileName) {
if (!file_exists($fileName))
throw new SettingsException("file $fileName does not exist");
return static::fromString(file_get_contents($fileName), dirname($fileName));
} | php | public static function fromFile($fileName) {
if (!file_exists($fileName))
throw new SettingsException("file $fileName does not exist");
return static::fromString(file_get_contents($fileName), dirname($fileName));
} | [
"public",
"static",
"function",
"fromFile",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"throw",
"new",
"SettingsException",
"(",
"\"file $fileName does not exist\"",
")",
";",
"return",
"static",
"::",
"fromS... | Creates settings from a JSON-encoded file.
@param string $fileName
@return Settings | [
"Creates",
"settings",
"from",
"a",
"JSON",
"-",
"encoded",
"file",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L86-L90 |
23,886 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings.has | protected function has($key, $cfg = null) {
if (!$cfg)
$cfg = $this->cfg;
return array_key_exists($key, $cfg);
} | php | protected function has($key, $cfg = null) {
if (!$cfg)
$cfg = $this->cfg;
return array_key_exists($key, $cfg);
} | [
"protected",
"function",
"has",
"(",
"$",
"key",
",",
"$",
"cfg",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"cfg",
")",
"$",
"cfg",
"=",
"$",
"this",
"->",
"cfg",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"cfg",
")",
";",
... | Returns whether a plain settings array has a key.
If no settings array is given, the internal settings array
is assumed.
@param string $key
@param array $cfg
@return bool | [
"Returns",
"whether",
"a",
"plain",
"settings",
"array",
"has",
"a",
"key",
".",
"If",
"no",
"settings",
"array",
"is",
"given",
"the",
"internal",
"settings",
"array",
"is",
"assumed",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L160-L164 |
23,887 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings._get | private function _get($cfg/*, ... */) {
$args = array_slice(func_get_args(), 1);
if (count($args) === 0)
return $cfg;
else {
if (!is_array($cfg) || !$this->has($args[0], $cfg))
throw new NotFoundSettingsException($args[0]);
$args[0] = $cfg[$arg... | php | private function _get($cfg/*, ... */) {
$args = array_slice(func_get_args(), 1);
if (count($args) === 0)
return $cfg;
else {
if (!is_array($cfg) || !$this->has($args[0], $cfg))
throw new NotFoundSettingsException($args[0]);
$args[0] = $cfg[$arg... | [
"private",
"function",
"_get",
"(",
"$",
"cfg",
"/*, ... */",
")",
"{",
"$",
"args",
"=",
"array_slice",
"(",
"func_get_args",
"(",
")",
",",
"1",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"===",
"0",
")",
"return",
"$",
"cfg",
";",
"e... | Returns a setting in a plain settings array.
A setting path can be supplied variadically.
@param array $cfg
@return mixed | [
"Returns",
"a",
"setting",
"in",
"a",
"plain",
"settings",
"array",
".",
"A",
"setting",
"path",
"can",
"be",
"supplied",
"variadically",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L172-L182 |
23,888 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings.get | public function get(/* ... */) {
$args = func_get_args();
array_unshift($args, $this->cfg);
return call_user_func_array(array($this, "_get"), $args);
} | php | public function get(/* ... */) {
$args = func_get_args();
array_unshift($args, $this->cfg);
return call_user_func_array(array($this, "_get"), $args);
} | [
"public",
"function",
"get",
"(",
"/* ... */",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_unshift",
"(",
"$",
"args",
",",
"$",
"this",
"->",
"cfg",
")",
";",
"return",
"call_user_func_array",
"(",
"array",
"(",
"$",
"this",
","... | Returns a setting.
A setting path can be supplied variadically.
@return mixed | [
"Returns",
"a",
"setting",
".",
"A",
"setting",
"path",
"can",
"be",
"supplied",
"variadically",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L189-L193 |
23,889 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings.getOptional | public function getOptional(/* ..., */$defaultValue) {
$args = func_get_args();
try {
return call_user_func_array(array($this, "get"), array_slice($args, 0, -1));
} catch (fphp\NotFoundSettingsException $e) {
return $args[count($args) - 1];
}
} | php | public function getOptional(/* ..., */$defaultValue) {
$args = func_get_args();
try {
return call_user_func_array(array($this, "get"), array_slice($args, 0, -1));
} catch (fphp\NotFoundSettingsException $e) {
return $args[count($args) - 1];
}
} | [
"public",
"function",
"getOptional",
"(",
"/* ..., */",
"$",
"defaultValue",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"try",
"{",
"return",
"call_user_func_array",
"(",
"array",
"(",
"$",
"this",
",",
"\"get\"",
")",
",",
"array_slice",
... | Returns an optional setting, defaulting to a value.
A setting path can be supplied variadically.
@param mixed $defaultValue
@return mixed | [
"Returns",
"an",
"optional",
"setting",
"defaulting",
"to",
"a",
"value",
".",
"A",
"setting",
"path",
"can",
"be",
"supplied",
"variadically",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L226-L233 |
23,890 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings._set | private function _set(&$cfg, $args) {
if (count($args) === 2) {
$key = $args[count($args) - 2];
$value = $args[count($args) - 1];
$cfg[$key] = $value;
} else {
if (!is_array($cfg) || !$this->has($args[0], $cfg))
throw new NotFoundSettingsEx... | php | private function _set(&$cfg, $args) {
if (count($args) === 2) {
$key = $args[count($args) - 2];
$value = $args[count($args) - 1];
$cfg[$key] = $value;
} else {
if (!is_array($cfg) || !$this->has($args[0], $cfg))
throw new NotFoundSettingsEx... | [
"private",
"function",
"_set",
"(",
"&",
"$",
"cfg",
",",
"$",
"args",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"===",
"2",
")",
"{",
"$",
"key",
"=",
"$",
"args",
"[",
"count",
"(",
"$",
"args",
")",
"-",
"2",
"]",
";",
"$",
... | Sets a setting in a plain settings array.
@param array $cfg
@param array $args a setting path followed by the setting's new value | [
"Sets",
"a",
"setting",
"in",
"a",
"plain",
"settings",
"array",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L240-L251 |
23,891 | ekuiter/feature-php | FeaturePhp/Settings.php | Settings.setOptional | protected function setOptional($key, $value) {
if (!$this->has($key))
$this->set($key, $value);
} | php | protected function setOptional($key, $value) {
if (!$this->has($key))
$this->set($key, $value);
} | [
"protected",
"function",
"setOptional",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] | Sets a setting if it is not already set.
@param string $key
@param mixed $value | [
"Sets",
"a",
"setting",
"if",
"it",
"is",
"not",
"already",
"set",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Settings.php#L269-L272 |
23,892 | zicht/z | src/Zicht/Tool/Script/TokenStream.php | TokenStream.current | public function current()
{
if (!isset($this->tokenList[$this->ptr])) {
throw new \UnexpectedValueException("Unexpected input at offset {$this->ptr}, unexpected end of stream");
}
return $this->tokenList[$this->ptr];
} | php | public function current()
{
if (!isset($this->tokenList[$this->ptr])) {
throw new \UnexpectedValueException("Unexpected input at offset {$this->ptr}, unexpected end of stream");
}
return $this->tokenList[$this->ptr];
} | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tokenList",
"[",
"$",
"this",
"->",
"ptr",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"\"Unexpected input at offset {$this->ptr}... | Returns the current token
@return Token
@throws \UnexpectedValueException | [
"Returns",
"the",
"current",
"token"
] | 6a1731dad20b018555a96b726a61d4bf8ec8c886 | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Script/TokenStream.php#L73-L79 |
23,893 | brianium/nomnom | src/Nomnom/Nomnom.php | Nomnom.to | public function to($unit, $precision = null)
{
$fromUnit = UnitResolver::resolve($this->from);
$toUnit = UnitResolver::resolve($unit);
$this->setBase($unit);
$base = $this->getBase() == 2 ? 1024 : 1000;
//some funky stuff with negative exponents and pow
if ($toUnit > ... | php | public function to($unit, $precision = null)
{
$fromUnit = UnitResolver::resolve($this->from);
$toUnit = UnitResolver::resolve($unit);
$this->setBase($unit);
$base = $this->getBase() == 2 ? 1024 : 1000;
//some funky stuff with negative exponents and pow
if ($toUnit > ... | [
"public",
"function",
"to",
"(",
"$",
"unit",
",",
"$",
"precision",
"=",
"null",
")",
"{",
"$",
"fromUnit",
"=",
"UnitResolver",
"::",
"resolve",
"(",
"$",
"this",
"->",
"from",
")",
";",
"$",
"toUnit",
"=",
"UnitResolver",
"::",
"resolve",
"(",
"$"... | Convert the start value to the given unit.
Accepts an optional precision for how many significant digits to
retain
@param $unit
@param int|null $precision
@return float | [
"Convert",
"the",
"start",
"value",
"to",
"the",
"given",
"unit",
".",
"Accepts",
"an",
"optional",
"precision",
"for",
"how",
"many",
"significant",
"digits",
"to",
"retain"
] | 012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd | https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/Nomnom.php#L77-L87 |
23,894 | brianium/nomnom | src/Nomnom/Nomnom.php | Nomnom.toBest | public function toBest($precision = null)
{
$fromUnit = UnitResolver::resolve($this->from);
$base = $this->getBase() == 2 ? 1024 : 1000;
$converted = $this->start;
while ($converted >= 1) {
$fromUnit++;
$result = $this->div($this->start, pow($base, $fromUnit),... | php | public function toBest($precision = null)
{
$fromUnit = UnitResolver::resolve($this->from);
$base = $this->getBase() == 2 ? 1024 : 1000;
$converted = $this->start;
while ($converted >= 1) {
$fromUnit++;
$result = $this->div($this->start, pow($base, $fromUnit),... | [
"public",
"function",
"toBest",
"(",
"$",
"precision",
"=",
"null",
")",
"{",
"$",
"fromUnit",
"=",
"UnitResolver",
"::",
"resolve",
"(",
"$",
"this",
"->",
"from",
")",
";",
"$",
"base",
"=",
"$",
"this",
"->",
"getBase",
"(",
")",
"==",
"2",
"?",... | Convert the start value to it's highest whole unit.
Accespts an optional precision for how many significant digits
to retain
@param int|null $precision
@return float | [
"Convert",
"the",
"start",
"value",
"to",
"it",
"s",
"highest",
"whole",
"unit",
".",
"Accespts",
"an",
"optional",
"precision",
"for",
"how",
"many",
"significant",
"digits",
"to",
"retain"
] | 012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd | https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/Nomnom.php#L97-L109 |
23,895 | brianium/nomnom | src/Nomnom/Nomnom.php | Nomnom.div | protected function div($left, $right, $precision)
{
if (is_null($precision)) return $left / $right;
return floatval(\bcdiv($left, $right, $precision));
} | php | protected function div($left, $right, $precision)
{
if (is_null($precision)) return $left / $right;
return floatval(\bcdiv($left, $right, $precision));
} | [
"protected",
"function",
"div",
"(",
"$",
"left",
",",
"$",
"right",
",",
"$",
"precision",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"precision",
")",
")",
"return",
"$",
"left",
"/",
"$",
"right",
";",
"return",
"floatval",
"(",
"\\",
"bcdiv",
"(... | Use bcdiv if precision is specified
otherwise use native division operator
@param $left
@param $right
@param $precision
@return float | [
"Use",
"bcdiv",
"if",
"precision",
"is",
"specified",
"otherwise",
"use",
"native",
"division",
"operator"
] | 012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd | https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/Nomnom.php#L152-L156 |
23,896 | brianium/nomnom | src/Nomnom/Nomnom.php | Nomnom.mul | protected function mul($left, $right, $precision)
{
if (is_null($precision)) return $left * $right;
return floatval(\bcmul($left, $right, $precision));
} | php | protected function mul($left, $right, $precision)
{
if (is_null($precision)) return $left * $right;
return floatval(\bcmul($left, $right, $precision));
} | [
"protected",
"function",
"mul",
"(",
"$",
"left",
",",
"$",
"right",
",",
"$",
"precision",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"precision",
")",
")",
"return",
"$",
"left",
"*",
"$",
"right",
";",
"return",
"floatval",
"(",
"\\",
"bcmul",
"(... | Use bcmul if precision is specified
otherwise use native multiplication operator
@param $left
@param $right
@param $precision
@return float | [
"Use",
"bcmul",
"if",
"precision",
"is",
"specified",
"otherwise",
"use",
"native",
"multiplication",
"operator"
] | 012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd | https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/Nomnom.php#L167-L171 |
23,897 | brianium/nomnom | src/Nomnom/Nomnom.php | Nomnom.shouldSetBaseTen | protected function shouldSetBaseTen($unit)
{
$unitMatchesIec = preg_match(UnitResolver::IEC_PATTERN, $unit);
return
($this->from == 'B' && !$unitMatchesIec) ||
(preg_match(UnitResolver::SI_PATTERN, $this->from) && !$unitMatchesIec);
} | php | protected function shouldSetBaseTen($unit)
{
$unitMatchesIec = preg_match(UnitResolver::IEC_PATTERN, $unit);
return
($this->from == 'B' && !$unitMatchesIec) ||
(preg_match(UnitResolver::SI_PATTERN, $this->from) && !$unitMatchesIec);
} | [
"protected",
"function",
"shouldSetBaseTen",
"(",
"$",
"unit",
")",
"{",
"$",
"unitMatchesIec",
"=",
"preg_match",
"(",
"UnitResolver",
"::",
"IEC_PATTERN",
",",
"$",
"unit",
")",
";",
"return",
"(",
"$",
"this",
"->",
"from",
"==",
"'B'",
"&&",
"!",
"$"... | Match from against the unit to see if
the base should be set to 10
@param $unit
@return bool | [
"Match",
"from",
"against",
"the",
"unit",
"to",
"see",
"if",
"the",
"base",
"should",
"be",
"set",
"to",
"10"
] | 012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd | https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/Nomnom.php#L192-L198 |
23,898 | aalfiann/json-class-php | src/JSON.php | JSON.isValid | public function isValid($json=null) {
if (empty($json) || ctype_space($json)) return false;
json_decode($json);
return (json_last_error() === JSON_ERROR_NONE);
} | php | public function isValid($json=null) {
if (empty($json) || ctype_space($json)) return false;
json_decode($json);
return (json_last_error() === JSON_ERROR_NONE);
} | [
"public",
"function",
"isValid",
"(",
"$",
"json",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"json",
")",
"||",
"ctype_space",
"(",
"$",
"json",
")",
")",
"return",
"false",
";",
"json_decode",
"(",
"$",
"json",
")",
";",
"return",
"(",
... | Determine is valid json or not
@param json is the json string
@return bool | [
"Determine",
"is",
"valid",
"json",
"or",
"not"
] | 524be94b162031946137ea1b729ba390d83dc41e | https://github.com/aalfiann/json-class-php/blob/524be94b162031946137ea1b729ba390d83dc41e/src/JSON.php#L131-L135 |
23,899 | WellCommerce/AppBundle | Service/Theme/Locator/FileLocator.php | FileLocator.locate | public function locate($name, $dir = null, $first = true)
{
if ('@' === $name[0]) {
return $this->themeLocator->locateTemplate($name);
}
return parent::locate($name, $dir, $first);
} | php | public function locate($name, $dir = null, $first = true)
{
if ('@' === $name[0]) {
return $this->themeLocator->locateTemplate($name);
}
return parent::locate($name, $dir, $first);
} | [
"public",
"function",
"locate",
"(",
"$",
"name",
",",
"$",
"dir",
"=",
"null",
",",
"$",
"first",
"=",
"true",
")",
"{",
"if",
"(",
"'@'",
"===",
"$",
"name",
"[",
"0",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"themeLocator",
"->",
"locateTem... | Returns a full path for a given template
@param mixed $name
@param string|null $dir
@param bool $first
@return array|string | [
"Returns",
"a",
"full",
"path",
"for",
"a",
"given",
"template"
] | 2add687d1c898dd0b24afd611d896e3811a0eac3 | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Service/Theme/Locator/FileLocator.php#L50-L57 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.