repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Nayjest/Grids | src/Grid.php | Grid.getSorter | public function getSorter()
{
if (null === $this->sorter) {
$this->sorter = new Sorter($this);
}
return $this->sorter;
} | php | public function getSorter()
{
if (null === $this->sorter) {
$this->sorter = new Sorter($this);
}
return $this->sorter;
} | [
"public",
"function",
"getSorter",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"sorter",
")",
"{",
"$",
"this",
"->",
"sorter",
"=",
"new",
"Sorter",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"sorter",
";",
"}"... | Returns data sorting manager.
@return Sorter | [
"Returns",
"data",
"sorting",
"manager",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Grid.php#L138-L144 |
Nayjest/Grids | src/Grid.php | Grid.getInputProcessor | public function getInputProcessor()
{
if (null === $this->input_processor) {
$this->input_processor = new GridInputProcessor($this);
}
return $this->input_processor;
} | php | public function getInputProcessor()
{
if (null === $this->input_processor) {
$this->input_processor = new GridInputProcessor($this);
}
return $this->input_processor;
} | [
"public",
"function",
"getInputProcessor",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"input_processor",
")",
"{",
"$",
"this",
"->",
"input_processor",
"=",
"new",
"GridInputProcessor",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"t... | Returns instance of GridInputProcessor.
@return GridInputProcessor | [
"Returns",
"instance",
"of",
"GridInputProcessor",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Grid.php#L151-L157 |
Nayjest/Grids | src/Grid.php | Grid.render | public function render()
{
$key = $this->getInputProcessor()->getUniqueRequestId();
$caching_time = $this->config->getCachingTime();
if ($caching_time && ($output = Cache::get($key))) {
return $output;
} else {
$this->prepare();
$provider = $this->config->getDataProvider();
$provider->reset();
$output = View::make(
$this->getMainTemplate(),
$this->getViewData()
)->render();
if ($caching_time) {
Cache::put($key, $output, $caching_time);
}
return $output;
}
} | php | public function render()
{
$key = $this->getInputProcessor()->getUniqueRequestId();
$caching_time = $this->config->getCachingTime();
if ($caching_time && ($output = Cache::get($key))) {
return $output;
} else {
$this->prepare();
$provider = $this->config->getDataProvider();
$provider->reset();
$output = View::make(
$this->getMainTemplate(),
$this->getViewData()
)->render();
if ($caching_time) {
Cache::put($key, $output, $caching_time);
}
return $output;
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getInputProcessor",
"(",
")",
"->",
"getUniqueRequestId",
"(",
")",
";",
"$",
"caching_time",
"=",
"$",
"this",
"->",
"config",
"->",
"getCachingTime",
"(",
")",
";",
"... | Renders grid.
@return View|string | [
"Renders",
"grid",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Grid.php#L182-L201 |
Nayjest/Grids | src/Grid.php | Grid.getFiltering | public function getFiltering()
{
if ($this->filtering === null) {
$this->filtering = new Filtering($this);
}
return $this->filtering;
} | php | public function getFiltering()
{
if ($this->filtering === null) {
$this->filtering = new Filtering($this);
}
return $this->filtering;
} | [
"public",
"function",
"getFiltering",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"filtering",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"filtering",
"=",
"new",
"Filtering",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"filtering... | Returns data filtering manager.
@return Filtering | [
"Returns",
"data",
"filtering",
"manager",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Grid.php#L228-L234 |
Nayjest/Grids | src/GridConfig.php | GridConfig.getColumn | public function getColumn($name)
{
foreach ($this->getColumns() as $column) {
if ($column->getName() === $name) {
return $column;
}
}
} | php | public function getColumn($name)
{
foreach ($this->getColumns() as $column) {
if ($column->getName() === $name) {
return $column;
}
}
} | [
"public",
"function",
"getColumn",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"->",
"getName",
"(",
")",
"===",
"$",
"name",
")",
"{",
"return",
... | Returns column by name.
@param string $name
@return null|FieldConfig | [
"Returns",
"column",
"by",
"name",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/GridConfig.php#L177-L185 |
Nayjest/Grids | src/GridConfig.php | GridConfig.addColumn | public function addColumn(FieldConfig $column)
{
if ($this->columns === null) {
$this->setColumns([]);
}
$this->columns->push($column);
return $this;
} | php | public function addColumn(FieldConfig $column)
{
if ($this->columns === null) {
$this->setColumns([]);
}
$this->columns->push($column);
return $this;
} | [
"public",
"function",
"addColumn",
"(",
"FieldConfig",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"columns",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setColumns",
"(",
"[",
"]",
")",
";",
"}",
"$",
"this",
"->",
"columns",
"->",
"pu... | Adds column to grid.
@param FieldConfig $column
@return $this | [
"Adds",
"column",
"to",
"grid",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/GridConfig.php#L216-L223 |
Nayjest/Grids | src/Components/HtmlTag.php | HtmlTag.suggestTagName | private function suggestTagName()
{
$class_name = get_class($this);
$parts = explode('\\', $class_name);
$base_name = array_pop($parts);
return ($base_name === 'HtmlTag') ? 'div' : strtolower($base_name);
} | php | private function suggestTagName()
{
$class_name = get_class($this);
$parts = explode('\\', $class_name);
$base_name = array_pop($parts);
return ($base_name === 'HtmlTag') ? 'div' : strtolower($base_name);
} | [
"private",
"function",
"suggestTagName",
"(",
")",
"{",
"$",
"class_name",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"class_name",
")",
";",
"$",
"base_name",
"=",
"array_pop",
"(",
"$",
"parts... | Suggests tag name by class name.
@return string | [
"Suggests",
"tag",
"name",
"by",
"class",
"name",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/HtmlTag.php#L57-L63 |
Nayjest/Grids | src/Components/HtmlTag.php | HtmlTag.render | public function render()
{
if ($this->getTemplate()) {
$inner = $this->renderTemplate();
} else {
$this->is_rendered = true;
$inner = $this->renderOpeningTag()
. $this->renderComponents(self::SECTION_BEGIN)
. $this->getContent()
. $this->renderComponents(null)
. $this->renderComponents(self::SECTION_END)
. $this->renderClosingTag();
}
return $this->wrapWithOutsideComponents($inner);
} | php | public function render()
{
if ($this->getTemplate()) {
$inner = $this->renderTemplate();
} else {
$this->is_rendered = true;
$inner = $this->renderOpeningTag()
. $this->renderComponents(self::SECTION_BEGIN)
. $this->getContent()
. $this->renderComponents(null)
. $this->renderComponents(self::SECTION_END)
. $this->renderClosingTag();
}
return $this->wrapWithOutsideComponents($inner);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getTemplate",
"(",
")",
")",
"{",
"$",
"inner",
"=",
"$",
"this",
"->",
"renderTemplate",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"is_rendered",
"=",
"true",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/HtmlTag.php#L139-L153 |
Nayjest/Grids | src/Components/ShowingRecords.php | ShowingRecords.getViewData | protected function getViewData()
{
$paginator = $this
->grid
->getConfig()
->getDataProvider()
->getPaginator();
# Laravel 4
if (method_exists($paginator, 'getFrom')) {
$from = $paginator->getFrom();
$to = $paginator->getTo();
$total = $paginator->getTotal();
# Laravel 5
} else {
$from = $paginator->firstItem();
$to = $paginator->lastItem();
$total = $paginator->total();
}
return parent::getViewData() + compact('from', 'to', 'total');
} | php | protected function getViewData()
{
$paginator = $this
->grid
->getConfig()
->getDataProvider()
->getPaginator();
# Laravel 4
if (method_exists($paginator, 'getFrom')) {
$from = $paginator->getFrom();
$to = $paginator->getTo();
$total = $paginator->getTotal();
# Laravel 5
} else {
$from = $paginator->firstItem();
$to = $paginator->lastItem();
$total = $paginator->total();
}
return parent::getViewData() + compact('from', 'to', 'total');
} | [
"protected",
"function",
"getViewData",
"(",
")",
"{",
"$",
"paginator",
"=",
"$",
"this",
"->",
"grid",
"->",
"getConfig",
"(",
")",
"->",
"getDataProvider",
"(",
")",
"->",
"getPaginator",
"(",
")",
";",
"# Laravel 4",
"if",
"(",
"method_exists",
"(",
... | Passing $from, $to, $total to view
@return mixed | [
"Passing",
"$from",
"$to",
"$total",
"to",
"view"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/ShowingRecords.php#L22-L41 |
Nayjest/Grids | src/Filtering.php | Filtering.createFilters | protected function createFilters()
{
$filters = [];
foreach ($this->grid->getConfig()->getColumns() as $column) {
if ($column->hasFilters()) {
foreach ($column->getFilters() as $filterConfig) {
$filters[$filterConfig->getId()] = new Filter(
$filterConfig,
$column,
$this->grid
);
}
}
}
$this->filters = Collection::make($filters);
} | php | protected function createFilters()
{
$filters = [];
foreach ($this->grid->getConfig()->getColumns() as $column) {
if ($column->hasFilters()) {
foreach ($column->getFilters() as $filterConfig) {
$filters[$filterConfig->getId()] = new Filter(
$filterConfig,
$column,
$this->grid
);
}
}
}
$this->filters = Collection::make($filters);
} | [
"protected",
"function",
"createFilters",
"(",
")",
"{",
"$",
"filters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"grid",
"->",
"getConfig",
"(",
")",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"colum... | Creates filter objects. | [
"Creates",
"filter",
"objects",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Filtering.php#L44-L59 |
Nayjest/Grids | src/Filtering.php | Filtering.getFilter | public function getFilter($idOrConfig)
{
if ($idOrConfig instanceof FilterConfig) {
$idOrConfig = $idOrConfig->getId();
}
return $this->getFilters()[$idOrConfig];
} | php | public function getFilter($idOrConfig)
{
if ($idOrConfig instanceof FilterConfig) {
$idOrConfig = $idOrConfig->getId();
}
return $this->getFilters()[$idOrConfig];
} | [
"public",
"function",
"getFilter",
"(",
"$",
"idOrConfig",
")",
"{",
"if",
"(",
"$",
"idOrConfig",
"instanceof",
"FilterConfig",
")",
"{",
"$",
"idOrConfig",
"=",
"$",
"idOrConfig",
"->",
"getId",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getFilt... | Returns filter instance.
@param $idOrConfig
@return mixed|Filter | [
"Returns",
"filter",
"instance",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Filtering.php#L87-L93 |
Nayjest/Grids | src/SelectFilterConfig.php | SelectFilterConfig.setMultipleMode | public function setMultipleMode($multipleMode)
{
$this->multipleMode = $multipleMode;
if ($multipleMode) {
$this->operator = FilterConfig::OPERATOR_IN;
}
return $this;
} | php | public function setMultipleMode($multipleMode)
{
$this->multipleMode = $multipleMode;
if ($multipleMode) {
$this->operator = FilterConfig::OPERATOR_IN;
}
return $this;
} | [
"public",
"function",
"setMultipleMode",
"(",
"$",
"multipleMode",
")",
"{",
"$",
"this",
"->",
"multipleMode",
"=",
"$",
"multipleMode",
";",
"if",
"(",
"$",
"multipleMode",
")",
"{",
"$",
"this",
"->",
"operator",
"=",
"FilterConfig",
"::",
"OPERATOR_IN",
... | Enabled multiple mode.
This will switch the selected operator to IN, as any other operator does not work with multiple selections.
@param $multipleMode
@return $this | [
"Enabled",
"multiple",
"mode",
".",
"This",
"will",
"switch",
"the",
"selected",
"operator",
"to",
"IN",
"as",
"any",
"other",
"operator",
"does",
"not",
"work",
"with",
"multiple",
"selections",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/SelectFilterConfig.php#L98-L107 |
Nayjest/Grids | src/FieldConfig.php | FieldConfig.setFilters | public function setFilters($filters)
{
$this->filters = Collection::make($filters);
foreach ($this->filters as $filterConfig) {
$filterConfig->attach($this);
}
return $this;
} | php | public function setFilters($filters)
{
$this->filters = Collection::make($filters);
foreach ($this->filters as $filterConfig) {
$filterConfig->attach($this);
}
return $this;
} | [
"public",
"function",
"setFilters",
"(",
"$",
"filters",
")",
"{",
"$",
"this",
"->",
"filters",
"=",
"Collection",
"::",
"make",
"(",
"$",
"filters",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"filterConfig",
")",
"{",
"$",
"... | Allows to specify filtering controls for column.
@param Collection|FilterConfig[] $filters
@return $this | [
"Allows",
"to",
"specify",
"filtering",
"controls",
"for",
"column",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/FieldConfig.php#L262-L270 |
Nayjest/Grids | src/FieldConfig.php | FieldConfig.addFilter | public function addFilter(FilterConfig $filter)
{
$this->getFilters()->push($filter);
$filter->attach($this);
return $this;
} | php | public function addFilter(FilterConfig $filter)
{
$this->getFilters()->push($filter);
$filter->attach($this);
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"FilterConfig",
"$",
"filter",
")",
"{",
"$",
"this",
"->",
"getFilters",
"(",
")",
"->",
"push",
"(",
"$",
"filter",
")",
";",
"$",
"filter",
"->",
"attach",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
... | Allows to add filtering control to column.
@param FilterConfig $filter
@return $this | [
"Allows",
"to",
"add",
"filtering",
"control",
"to",
"column",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/FieldConfig.php#L278-L283 |
Nayjest/Grids | src/Components/Base/TRegistry.php | TRegistry.getComponents | final public function getComponents()
{
if ($this->components === null) {
$this->setComponents($this->getDefaultComponents());
}
return $this->components;
} | php | final public function getComponents()
{
if ($this->components === null) {
$this->setComponents($this->getDefaultComponents());
}
return $this->components;
} | [
"final",
"public",
"function",
"getComponents",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"components",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setComponents",
"(",
"$",
"this",
"->",
"getDefaultComponents",
"(",
")",
")",
";",
"}",
"return",
"... | Returns child components.
@return Collection|ComponentInterface[] | [
"Returns",
"child",
"components",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRegistry.php#L28-L34 |
Nayjest/Grids | src/Components/Base/TRegistry.php | TRegistry.getComponentByName | public function getComponentByName($name)
{
foreach ($this->getComponents() as $component) {
if ($component->getName() === $name) {
return $component;
}
}
} | php | public function getComponentByName($name)
{
foreach ($this->getComponents() as $component) {
if ($component->getName() === $name) {
return $component;
}
}
} | [
"public",
"function",
"getComponentByName",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getComponents",
"(",
")",
"as",
"$",
"component",
")",
"{",
"if",
"(",
"$",
"component",
"->",
"getName",
"(",
")",
"===",
"$",
"name",
")",
"... | Finds child component by name.
@param string $name
@return null|ComponentInterface | [
"Finds",
"child",
"component",
"by",
"name",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRegistry.php#L42-L49 |
Nayjest/Grids | src/Components/Base/TRegistry.php | TRegistry.getComponentByNameRecursive | public function getComponentByNameRecursive($name)
{
foreach ($this->getComponents() as $component) {
if ($component->getName() === $name) {
return $component;
}
if ($component instanceof TRegistry || $component instanceof RegistryInterface) {
if ($res = $component->getComponentByNameRecursive($name)) {
return $res;
}
}
}
return null;
} | php | public function getComponentByNameRecursive($name)
{
foreach ($this->getComponents() as $component) {
if ($component->getName() === $name) {
return $component;
}
if ($component instanceof TRegistry || $component instanceof RegistryInterface) {
if ($res = $component->getComponentByNameRecursive($name)) {
return $res;
}
}
}
return null;
} | [
"public",
"function",
"getComponentByNameRecursive",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getComponents",
"(",
")",
"as",
"$",
"component",
")",
"{",
"if",
"(",
"$",
"component",
"->",
"getName",
"(",
")",
"===",
"$",
"name",
... | Finds child component by name recursively.
@param string $name
@return null|ComponentInterface | [
"Finds",
"child",
"component",
"by",
"name",
"recursively",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRegistry.php#L57-L71 |
Nayjest/Grids | src/Components/Base/TRegistry.php | TRegistry.addComponent | public function addComponent(ComponentInterface $component)
{
$this->getComponents()->push($component);
$component->attachTo($this);
return $this;
} | php | public function addComponent(ComponentInterface $component)
{
$this->getComponents()->push($component);
$component->attachTo($this);
return $this;
} | [
"public",
"function",
"addComponent",
"(",
"ComponentInterface",
"$",
"component",
")",
"{",
"$",
"this",
"->",
"getComponents",
"(",
")",
"->",
"push",
"(",
"$",
"component",
")",
";",
"$",
"component",
"->",
"attachTo",
"(",
"$",
"this",
")",
";",
"ret... | Adds component to the collection of child components.
@param ComponentInterface $component
@return $this | [
"Adds",
"component",
"to",
"the",
"collection",
"of",
"child",
"components",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRegistry.php#L92-L97 |
Nayjest/Grids | src/Components/Base/TRegistry.php | TRegistry.setComponents | public function setComponents($components)
{
$this->components = Collection::make($components);
foreach ($components as $component) {
$component->attachTo($this);
}
return $this;
} | php | public function setComponents($components)
{
$this->components = Collection::make($components);
foreach ($components as $component) {
$component->attachTo($this);
}
return $this;
} | [
"public",
"function",
"setComponents",
"(",
"$",
"components",
")",
"{",
"$",
"this",
"->",
"components",
"=",
"Collection",
"::",
"make",
"(",
"$",
"components",
")",
";",
"foreach",
"(",
"$",
"components",
"as",
"$",
"component",
")",
"{",
"$",
"compon... | Allows to specify collection of child components.
@param \Illuminate\Support\Collection|ComponentInterface[]|array $components
@return $this | [
"Allows",
"to",
"specify",
"collection",
"of",
"child",
"components",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRegistry.php#L105-L112 |
Nayjest/Grids | src/Components/Base/TRegistry.php | TRegistry.initializeComponents | public function initializeComponents(Grid $grid)
{
foreach ($this->getComponents() as $component) {
$component->initialize($grid);
}
} | php | public function initializeComponents(Grid $grid)
{
foreach ($this->getComponents() as $component) {
$component->initialize($grid);
}
} | [
"public",
"function",
"initializeComponents",
"(",
"Grid",
"$",
"grid",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getComponents",
"(",
")",
"as",
"$",
"component",
")",
"{",
"$",
"component",
"->",
"initialize",
"(",
"$",
"grid",
")",
";",
"}",
"}"... | Initializes child components.
@param Grid $grid | [
"Initializes",
"child",
"components",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRegistry.php#L147-L152 |
Nayjest/Grids | src/ArrayDataRow.php | ArrayDataRow.extractCellValue | protected function extractCellValue($fieldName)
{
if (strpos($fieldName, '.') !== false) {
$parts = explode('.', $fieldName);
$res = $this->src;
foreach ($parts as $part) {
if (isset($res[$part])) {
$res = $res[$part];
} else {
return $res;
}
}
return $res;
} else {
if (array_key_exists($fieldName, $this->src)) {
return $this->src[$fieldName];
} else {
return null;
}
}
} | php | protected function extractCellValue($fieldName)
{
if (strpos($fieldName, '.') !== false) {
$parts = explode('.', $fieldName);
$res = $this->src;
foreach ($parts as $part) {
if (isset($res[$part])) {
$res = $res[$part];
} else {
return $res;
}
}
return $res;
} else {
if (array_key_exists($fieldName, $this->src)) {
return $this->src[$fieldName];
} else {
return null;
}
}
} | [
"protected",
"function",
"extractCellValue",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"fieldName",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"fieldName",
")",
";",
"$",
"res"... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/ArrayDataRow.php#L9-L29 |
Nayjest/Grids | src/DataRow.php | DataRow.getCellValue | public function getCellValue($field)
{
$fieldName = $field instanceof FieldConfig ? $field->getName() : $field;
return $this->extractCellValue($fieldName);
} | php | public function getCellValue($field)
{
$fieldName = $field instanceof FieldConfig ? $field->getName() : $field;
return $this->extractCellValue($fieldName);
} | [
"public",
"function",
"getCellValue",
"(",
"$",
"field",
")",
"{",
"$",
"fieldName",
"=",
"$",
"field",
"instanceof",
"FieldConfig",
"?",
"$",
"field",
"->",
"getName",
"(",
")",
":",
"$",
"field",
";",
"return",
"$",
"this",
"->",
"extractCellValue",
"(... | Returns value of specified column from row.
@param FieldConfig|string $field
@return mixed | [
"Returns",
"value",
"of",
"specified",
"column",
"from",
"row",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/DataRow.php#L68-L72 |
Nayjest/Grids | src/Components/Base/TRenderable.php | TRenderable.render | public function render()
{
$this->is_rendered = true;
return View::make(
$this->getTemplate(),
$this->getViewData()
)->render();
} | php | public function render()
{
$this->is_rendered = true;
return View::make(
$this->getTemplate(),
$this->getViewData()
)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"is_rendered",
"=",
"true",
";",
"return",
"View",
"::",
"make",
"(",
"$",
"this",
"->",
"getTemplate",
"(",
")",
",",
"$",
"this",
"->",
"getViewData",
"(",
")",
")",
"->",
"render",
... | Renders object.
@return string | [
"Renders",
"object",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TRenderable.php#L33-L40 |
Nayjest/Grids | src/EloquentDataProvider.php | EloquentDataProvider.getCollection | public function getCollection()
{
if (!$this->collection) {
$paginator = $this->getPaginator();
if (version_compare(Application::VERSION, '5', '<')) {
$this->collection = $paginator->getCollection();
} else {
$this->collection = Collection::make(
$this->getPaginator()->items()
);
}
}
return $this->collection;
} | php | public function getCollection()
{
if (!$this->collection) {
$paginator = $this->getPaginator();
if (version_compare(Application::VERSION, '5', '<')) {
$this->collection = $paginator->getCollection();
} else {
$this->collection = Collection::make(
$this->getPaginator()->items()
);
}
}
return $this->collection;
} | [
"public",
"function",
"getCollection",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"collection",
")",
"{",
"$",
"paginator",
"=",
"$",
"this",
"->",
"getPaginator",
"(",
")",
";",
"if",
"(",
"version_compare",
"(",
"Application",
"::",
"VERSION",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/EloquentDataProvider.php#L40-L53 |
Nayjest/Grids | src/EloquentDataProvider.php | EloquentDataProvider.filter | public function filter($fieldName, $operator, $value)
{
switch ($operator) {
case "eq":
$operator = '=';
break;
case "n_eq":
$operator = '<>';
break;
case "gt":
$operator = '>';
break;
case "lt":
$operator = '<';
break;
case "ls_e":
$operator = '<=';
break;
case "gt_e":
$operator = '>=';
break;
case "in":
if (!is_array($value)) {
$operator = '=';
break;
}
$this->src->whereIn($fieldName, $value);
return $this;
}
$this->src->where($fieldName, $operator, $value);
return $this;
} | php | public function filter($fieldName, $operator, $value)
{
switch ($operator) {
case "eq":
$operator = '=';
break;
case "n_eq":
$operator = '<>';
break;
case "gt":
$operator = '>';
break;
case "lt":
$operator = '<';
break;
case "ls_e":
$operator = '<=';
break;
case "gt_e":
$operator = '>=';
break;
case "in":
if (!is_array($value)) {
$operator = '=';
break;
}
$this->src->whereIn($fieldName, $value);
return $this;
}
$this->src->where($fieldName, $operator, $value);
return $this;
} | [
"public",
"function",
"filter",
"(",
"$",
"fieldName",
",",
"$",
"operator",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"operator",
")",
"{",
"case",
"\"eq\"",
":",
"$",
"operator",
"=",
"'='",
";",
"break",
";",
"case",
"\"n_eq\"",
":",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/EloquentDataProvider.php#L121-L152 |
Nayjest/Grids | src/GridInputProcessor.php | GridInputProcessor.getUniqueRequestId | public function getUniqueRequestId()
{
$cookies_str = '';
foreach ($_COOKIE as $key => $val) {
if (strpos($key, $this->getKey()) !== false) {
$cookies_str .= $key . json_encode($val);
}
}
return md5($cookies_str . $this->getKey() . json_encode($this->getInput()));
} | php | public function getUniqueRequestId()
{
$cookies_str = '';
foreach ($_COOKIE as $key => $val) {
if (strpos($key, $this->getKey()) !== false) {
$cookies_str .= $key . json_encode($val);
}
}
return md5($cookies_str . $this->getKey() . json_encode($this->getInput()));
} | [
"public",
"function",
"getUniqueRequestId",
"(",
")",
"{",
"$",
"cookies_str",
"=",
"''",
";",
"foreach",
"(",
"$",
"_COOKIE",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"getKey",
"("... | Returns UID for current grid state.
Currently used as key for caching.
@return string | [
"Returns",
"UID",
"for",
"current",
"grid",
"state",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/GridInputProcessor.php#L93-L103 |
Nayjest/Grids | src/GridInputProcessor.php | GridInputProcessor.getFilterValue | public function getFilterValue($filterName)
{
if (isset($this->input['filters'][$filterName])) {
return $this->input['filters'][$filterName];
} else {
return null;
}
} | php | public function getFilterValue($filterName)
{
if (isset($this->input['filters'][$filterName])) {
return $this->input['filters'][$filterName];
} else {
return null;
}
} | [
"public",
"function",
"getFilterValue",
"(",
"$",
"filterName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"input",
"[",
"'filters'",
"]",
"[",
"$",
"filterName",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"input",
"[",
"'filters'",
... | Returns input value for filter.
@param string $filterName
@return mixed | [
"Returns",
"input",
"value",
"for",
"filter",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/GridInputProcessor.php#L124-L131 |
Nayjest/Grids | src/GridInputProcessor.php | GridInputProcessor.getQueryString | public function getQueryString(array $new_params = [])
{
$params = $_GET;
if (!empty($this->input)) {
$params[$this->getKey()] = $this->input;
}
if (!empty($new_params)) {
if (empty($params[$this->getKey()])) {
$params[$this->getKey()] = [];
}
foreach ($new_params as $key => $value) {
$params[$this->getKey()][$key] = $value;
}
}
return http_build_query($params);
} | php | public function getQueryString(array $new_params = [])
{
$params = $_GET;
if (!empty($this->input)) {
$params[$this->getKey()] = $this->input;
}
if (!empty($new_params)) {
if (empty($params[$this->getKey()])) {
$params[$this->getKey()] = [];
}
foreach ($new_params as $key => $value) {
$params[$this->getKey()][$key] = $value;
}
}
return http_build_query($params);
} | [
"public",
"function",
"getQueryString",
"(",
"array",
"$",
"new_params",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"$",
"_GET",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"input",
")",
")",
"{",
"$",
"params",
"[",
"$",
"this",
"->"... | Returns current query string extended by specified GET parameters.
@param array $new_params
@return string | [
"Returns",
"current",
"query",
"string",
"extended",
"by",
"specified",
"GET",
"parameters",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/GridInputProcessor.php#L166-L181 |
Nayjest/Grids | src/GridInputProcessor.php | GridInputProcessor.getUrl | public function getUrl(array $new_params = [])
{
if (null !== $query_string = $this->getQueryString($new_params)) {
$query_string = '?' . $query_string;
}
$request = Request::instance();
return $request->getSchemeAndHttpHost()
. $request->getBaseUrl()
. $request->getPathInfo()
. $query_string;
} | php | public function getUrl(array $new_params = [])
{
if (null !== $query_string = $this->getQueryString($new_params)) {
$query_string = '?' . $query_string;
}
$request = Request::instance();
return $request->getSchemeAndHttpHost()
. $request->getBaseUrl()
. $request->getPathInfo()
. $query_string;
} | [
"public",
"function",
"getUrl",
"(",
"array",
"$",
"new_params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"query_string",
"=",
"$",
"this",
"->",
"getQueryString",
"(",
"$",
"new_params",
")",
")",
"{",
"$",
"query_string",
"=",
"'?'",
... | Returns current URL extended by specified GET parameters.
@param array $new_params
@return string | [
"Returns",
"current",
"URL",
"extended",
"by",
"specified",
"GET",
"parameters",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/GridInputProcessor.php#L189-L199 |
Nayjest/Grids | src/Components/Filter.php | Filter.getValue | public function getValue()
{
$from_input = $this
->grid
->getInputProcessor()
->getFilterValue($this->name);
if ($from_input === null) {
return $this->getDefaultValue();
} else {
return $from_input;
}
} | php | public function getValue()
{
$from_input = $this
->grid
->getInputProcessor()
->getFilterValue($this->name);
if ($from_input === null) {
return $this->getDefaultValue();
} else {
return $from_input;
}
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"from_input",
"=",
"$",
"this",
"->",
"grid",
"->",
"getInputProcessor",
"(",
")",
"->",
"getFilterValue",
"(",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"$",
"from_input",
"===",
"null",
")",... | Returns filter value from input or default if there is no input.
@return mixed | [
"Returns",
"filter",
"value",
"from",
"input",
"or",
"default",
"if",
"there",
"is",
"no",
"input",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Filter.php#L100-L111 |
Nayjest/Grids | src/Build/Setup.php | Setup.run | public function run()
{
$this->blueprints = Env::instance()->blueprints();
$this->blueprints
->add($this->makeFilterBlueprint())
->add($this->makeFieldBlueprint())
->add($this->makeComponentBlueprint())
->add($config_blueprint = $this->makeConfigBlueprint());
return new Builder($config_blueprint);
} | php | public function run()
{
$this->blueprints = Env::instance()->blueprints();
$this->blueprints
->add($this->makeFilterBlueprint())
->add($this->makeFieldBlueprint())
->add($this->makeComponentBlueprint())
->add($config_blueprint = $this->makeConfigBlueprint());
return new Builder($config_blueprint);
} | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"blueprints",
"=",
"Env",
"::",
"instance",
"(",
")",
"->",
"blueprints",
"(",
")",
";",
"$",
"this",
"->",
"blueprints",
"->",
"add",
"(",
"$",
"this",
"->",
"makeFilterBlueprint",
"(",
... | Creates blueprints required to construct grids from configuration.
@return Builder | [
"Creates",
"blueprints",
"required",
"to",
"construct",
"grids",
"from",
"configuration",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Build/Setup.php#L51-L60 |
Nayjest/Grids | src/Build/Setup.php | Setup.makeConfigBlueprint | protected function makeConfigBlueprint()
{
$component_blueprint = $this->blueprints->getFor(self::COMPONENT_CLASS);
if (!$component_blueprint) {
throw new LogicException(
'Blueprint for grid components must be created before main blueprint.'
);
}
$column_blueprint = $this->blueprints->getFor(self::COLUMN_CLASS);
if (!$column_blueprint) {
throw new LogicException(
'Blueprint for grid columns must be created before main blueprint.'
);
}
$b = new Blueprint(self::GRID_CLASS, [
new BuildDataProvider(),
new CustomInstruction(function (Scaffold $s) {
/** @var EloquentDataProvider $provider */
$provider = $s->getInput('data_provider');
$is_eloquent = $provider instanceof EloquentDataProvider;
if ($is_eloquent && !$s->getInput('columns')) {
$table = $provider->getBuilder()->getModel()->getTable();
$columns = DB
::connection()
->getSchemaBuilder()
->getColumnListing($table);
$s->input['columns'] = $columns;
}
}, Instruction::PHASE_PRE_INST),
new BuildChildren(
'components',
$component_blueprint
),
new Build('row_component', $component_blueprint),
new BuildChildren(
'columns',
$column_blueprint
),
]);
return $b;
} | php | protected function makeConfigBlueprint()
{
$component_blueprint = $this->blueprints->getFor(self::COMPONENT_CLASS);
if (!$component_blueprint) {
throw new LogicException(
'Blueprint for grid components must be created before main blueprint.'
);
}
$column_blueprint = $this->blueprints->getFor(self::COLUMN_CLASS);
if (!$column_blueprint) {
throw new LogicException(
'Blueprint for grid columns must be created before main blueprint.'
);
}
$b = new Blueprint(self::GRID_CLASS, [
new BuildDataProvider(),
new CustomInstruction(function (Scaffold $s) {
/** @var EloquentDataProvider $provider */
$provider = $s->getInput('data_provider');
$is_eloquent = $provider instanceof EloquentDataProvider;
if ($is_eloquent && !$s->getInput('columns')) {
$table = $provider->getBuilder()->getModel()->getTable();
$columns = DB
::connection()
->getSchemaBuilder()
->getColumnListing($table);
$s->input['columns'] = $columns;
}
}, Instruction::PHASE_PRE_INST),
new BuildChildren(
'components',
$component_blueprint
),
new Build('row_component', $component_blueprint),
new BuildChildren(
'columns',
$column_blueprint
),
]);
return $b;
} | [
"protected",
"function",
"makeConfigBlueprint",
"(",
")",
"{",
"$",
"component_blueprint",
"=",
"$",
"this",
"->",
"blueprints",
"->",
"getFor",
"(",
"self",
"::",
"COMPONENT_CLASS",
")",
";",
"if",
"(",
"!",
"$",
"component_blueprint",
")",
"{",
"throw",
"n... | Creates main blueprint of grid configuration.
@return Blueprint | [
"Creates",
"main",
"blueprint",
"of",
"grid",
"configuration",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Build/Setup.php#L67-L111 |
Nayjest/Grids | src/Build/Setup.php | Setup.makeComponentBlueprint | protected function makeComponentBlueprint()
{
$blueprint = new Blueprint(self::COMPONENT_CLASS, [
new CustomInstruction(function (Scaffold $s) {
if ($s->input instanceof Closure) {
$s->class = 'Nayjest\Grids\Components\RenderFunc';
$s->constructor_arguments = [$s->input];
$s->input = [];
} elseif (is_string($s->input)) {
$s->class = 'Nayjest\Grids\Components\RenderFunc';
$out = $s->input;
$s->constructor_arguments = [function () use ($out) {
return $out;
}];
$s->input = [];
}
}, Instruction::PHASE_PRE_INST),
new CustomMapping('type', function ($type, Scaffold $s) {
if (strpos($type, '\\') !== false) {
$s->class = $type;
} else {
$s->class = 'Nayjest\Grids\Components\\' . str_replace(
' ',
'',
ucwords(str_replace(array('-', '_'), ' ', $type))
);
}
}, null, Instruction::PHASE_PRE_INST)
]);
$blueprint->add(new BuildChildren('components', $blueprint));
$blueprint->add(new Rename('component', 'add_component'));
$blueprint->add(new Build('add_component', $blueprint));
$blueprint->add(new CallMethodWith('add_component','addComponent'));
return $blueprint;
} | php | protected function makeComponentBlueprint()
{
$blueprint = new Blueprint(self::COMPONENT_CLASS, [
new CustomInstruction(function (Scaffold $s) {
if ($s->input instanceof Closure) {
$s->class = 'Nayjest\Grids\Components\RenderFunc';
$s->constructor_arguments = [$s->input];
$s->input = [];
} elseif (is_string($s->input)) {
$s->class = 'Nayjest\Grids\Components\RenderFunc';
$out = $s->input;
$s->constructor_arguments = [function () use ($out) {
return $out;
}];
$s->input = [];
}
}, Instruction::PHASE_PRE_INST),
new CustomMapping('type', function ($type, Scaffold $s) {
if (strpos($type, '\\') !== false) {
$s->class = $type;
} else {
$s->class = 'Nayjest\Grids\Components\\' . str_replace(
' ',
'',
ucwords(str_replace(array('-', '_'), ' ', $type))
);
}
}, null, Instruction::PHASE_PRE_INST)
]);
$blueprint->add(new BuildChildren('components', $blueprint));
$blueprint->add(new Rename('component', 'add_component'));
$blueprint->add(new Build('add_component', $blueprint));
$blueprint->add(new CallMethodWith('add_component','addComponent'));
return $blueprint;
} | [
"protected",
"function",
"makeComponentBlueprint",
"(",
")",
"{",
"$",
"blueprint",
"=",
"new",
"Blueprint",
"(",
"self",
"::",
"COMPONENT_CLASS",
",",
"[",
"new",
"CustomInstruction",
"(",
"function",
"(",
"Scaffold",
"$",
"s",
")",
"{",
"if",
"(",
"$",
"... | Creates blueprint for grid components.
@return Blueprint | [
"Creates",
"blueprint",
"for",
"grid",
"components",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Build/Setup.php#L118-L155 |
Nayjest/Grids | src/Build/Setup.php | Setup.makeFilterBlueprint | protected function makeFilterBlueprint()
{
return new Blueprint(self::FILTER_CLASS, [
new SimpleValueAsField('name'),
new CustomMapping('type', function ($type, Scaffold $s) {
switch($type) {
case 'select':
$s->class = 'Nayjest\Grids\SelectFilterConfig';
break;
default:
break;
}
}, null, Instruction::PHASE_PRE_INST),
new Rename(0,'name'),
new Rename(1,'operator'),
]);
} | php | protected function makeFilterBlueprint()
{
return new Blueprint(self::FILTER_CLASS, [
new SimpleValueAsField('name'),
new CustomMapping('type', function ($type, Scaffold $s) {
switch($type) {
case 'select':
$s->class = 'Nayjest\Grids\SelectFilterConfig';
break;
default:
break;
}
}, null, Instruction::PHASE_PRE_INST),
new Rename(0,'name'),
new Rename(1,'operator'),
]);
} | [
"protected",
"function",
"makeFilterBlueprint",
"(",
")",
"{",
"return",
"new",
"Blueprint",
"(",
"self",
"::",
"FILTER_CLASS",
",",
"[",
"new",
"SimpleValueAsField",
"(",
"'name'",
")",
",",
"new",
"CustomMapping",
"(",
"'type'",
",",
"function",
"(",
"$",
... | Creates blueprint for filters.
@return Blueprint | [
"Creates",
"blueprint",
"for",
"filters",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Build/Setup.php#L162-L178 |
Nayjest/Grids | src/Build/Setup.php | Setup.makeFieldBlueprint | protected function makeFieldBlueprint()
{
$filter_blueprint = $this->blueprints->getFor(self::FILTER_CLASS);
if (!$filter_blueprint) {
throw new LogicException(
'Blueprint for grid filters must be created before grid columns blueprint.'
);
}
return new Blueprint(self::COLUMN_CLASS, [
new SimpleValueAsField('name'),
new Rename(0,'name'),
new BuildChildren('filters', $filter_blueprint),
new Rename('filter', 'add_filter'),
new Build('add_filter', $filter_blueprint),
new CallMethodWith('add_filter','addFilter'),
]);
} | php | protected function makeFieldBlueprint()
{
$filter_blueprint = $this->blueprints->getFor(self::FILTER_CLASS);
if (!$filter_blueprint) {
throw new LogicException(
'Blueprint for grid filters must be created before grid columns blueprint.'
);
}
return new Blueprint(self::COLUMN_CLASS, [
new SimpleValueAsField('name'),
new Rename(0,'name'),
new BuildChildren('filters', $filter_blueprint),
new Rename('filter', 'add_filter'),
new Build('add_filter', $filter_blueprint),
new CallMethodWith('add_filter','addFilter'),
]);
} | [
"protected",
"function",
"makeFieldBlueprint",
"(",
")",
"{",
"$",
"filter_blueprint",
"=",
"$",
"this",
"->",
"blueprints",
"->",
"getFor",
"(",
"self",
"::",
"FILTER_CLASS",
")",
";",
"if",
"(",
"!",
"$",
"filter_blueprint",
")",
"{",
"throw",
"new",
"Lo... | Creates blueprint for grid columns.
@return Blueprint | [
"Creates",
"blueprint",
"for",
"grid",
"columns",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Build/Setup.php#L185-L202 |
Nayjest/Grids | src/Components/ColumnHeadersRow.php | ColumnHeadersRow.createHeaders | protected function createHeaders(Grid $grid)
{
foreach ($grid->getConfig()->getColumns() as $column) {
$this->addComponent(new ColumnHeader($column));
}
} | php | protected function createHeaders(Grid $grid)
{
foreach ($grid->getConfig()->getColumns() as $column) {
$this->addComponent(new ColumnHeader($column));
}
} | [
"protected",
"function",
"createHeaders",
"(",
"Grid",
"$",
"grid",
")",
"{",
"foreach",
"(",
"$",
"grid",
"->",
"getConfig",
"(",
")",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"addComponent",
"(",
"new",
"ColumnH... | Creates children components for rendering column headers.
@param Grid $grid | [
"Creates",
"children",
"components",
"for",
"rendering",
"column",
"headers",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/ColumnHeadersRow.php#L34-L39 |
Nayjest/Grids | src/DbalDataProvider.php | DbalDataProvider.getCollection | public function getCollection()
{
if (!$this->collection) {
$query = clone $this->src;
$query
->setFirstResult(
($this->getCurrentPage() - 1) * $this->page_size
)
->setMaxResults($this->page_size);
if ($this->isExecUsingLaravel()) {
$res = DB::select($query, $query->getParameters());
} else {
$res = $query->execute()->fetchAll(\PDO::FETCH_OBJ);
}
$this->collection = Collection::make($res);
}
return $this->collection;
} | php | public function getCollection()
{
if (!$this->collection) {
$query = clone $this->src;
$query
->setFirstResult(
($this->getCurrentPage() - 1) * $this->page_size
)
->setMaxResults($this->page_size);
if ($this->isExecUsingLaravel()) {
$res = DB::select($query, $query->getParameters());
} else {
$res = $query->execute()->fetchAll(\PDO::FETCH_OBJ);
}
$this->collection = Collection::make($res);
}
return $this->collection;
} | [
"public",
"function",
"getCollection",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"collection",
")",
"{",
"$",
"query",
"=",
"clone",
"$",
"this",
"->",
"src",
";",
"$",
"query",
"->",
"setFirstResult",
"(",
"(",
"$",
"this",
"->",
"getCurrent... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/DbalDataProvider.php#L48-L66 |
Nayjest/Grids | src/Components/Laravel5/Pager.php | Pager.links | protected function links()
{
/** @var Paginator $paginator */
$paginator = $this->grid->getConfig()
->getDataProvider()
->getPaginator();
$input = $this->grid->getInputProcessor()->getInput();
if (isset($input['page'])) {
unset($input['page']);
}
return str_replace('/?', '?',$paginator->appends($this->input_key, $input)->render());
} | php | protected function links()
{
/** @var Paginator $paginator */
$paginator = $this->grid->getConfig()
->getDataProvider()
->getPaginator();
$input = $this->grid->getInputProcessor()->getInput();
if (isset($input['page'])) {
unset($input['page']);
}
return str_replace('/?', '?',$paginator->appends($this->input_key, $input)->render());
} | [
"protected",
"function",
"links",
"(",
")",
"{",
"/** @var Paginator $paginator */",
"$",
"paginator",
"=",
"$",
"this",
"->",
"grid",
"->",
"getConfig",
"(",
")",
"->",
"getDataProvider",
"(",
")",
"->",
"getPaginator",
"(",
")",
";",
"$",
"input",
"=",
... | Renders pagination links & returns rendered html. | [
"Renders",
"pagination",
"links",
"&",
"returns",
"rendered",
"html",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Laravel5/Pager.php#L43-L54 |
Nayjest/Grids | src/Components/Base/RenderableRegistry.php | RenderableRegistry.renderComponents | public function renderComponents($sectionName = null)
{
$output = '';
$components = $this->getSectionComponents($sectionName);
foreach ($components as $component) {
$output .= $component->render();
}
return $output;
} | php | public function renderComponents($sectionName = null)
{
$output = '';
$components = $this->getSectionComponents($sectionName);
foreach ($components as $component) {
$output .= $component->render();
}
return $output;
} | [
"public",
"function",
"renderComponents",
"(",
"$",
"sectionName",
"=",
"null",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"getSectionComponents",
"(",
"$",
"sectionName",
")",
";",
"foreach",
"(",
"$",
"components"... | Renders components related to specified section.
By default components without specified section will be rendered.
@param string|null $sectionName
@return string | [
"Renders",
"components",
"related",
"to",
"specified",
"section",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/RenderableRegistry.php#L34-L42 |
Nayjest/Grids | src/Components/Base/RenderableRegistry.php | RenderableRegistry.getSectionComponents | public function getSectionComponents($sectionName)
{
return $this->getComponents()->filter(
function (ComponentInterface $component) use ($sectionName) {
return $component instanceof RenderableComponentInterface
&& $component->getRenderSection() === $sectionName;
}
);
} | php | public function getSectionComponents($sectionName)
{
return $this->getComponents()->filter(
function (ComponentInterface $component) use ($sectionName) {
return $component instanceof RenderableComponentInterface
&& $component->getRenderSection() === $sectionName;
}
);
} | [
"public",
"function",
"getSectionComponents",
"(",
"$",
"sectionName",
")",
"{",
"return",
"$",
"this",
"->",
"getComponents",
"(",
")",
"->",
"filter",
"(",
"function",
"(",
"ComponentInterface",
"$",
"component",
")",
"use",
"(",
"$",
"sectionName",
")",
"... | Returns components filtered by section name.
@param string $sectionName
@return \Illuminate\Support\Collection | [
"Returns",
"components",
"filtered",
"by",
"section",
"name",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/RenderableRegistry.php#L50-L58 |
Nayjest/Grids | src/Components/Base/RenderableRegistry.php | RenderableRegistry.wrapWithOutsideComponents | protected function wrapWithOutsideComponents($output)
{
return $this->renderComponents(self::SECTION_BEFORE)
. $output
. $this->renderComponents(self::SECTION_AFTER);
} | php | protected function wrapWithOutsideComponents($output)
{
return $this->renderComponents(self::SECTION_BEFORE)
. $output
. $this->renderComponents(self::SECTION_AFTER);
} | [
"protected",
"function",
"wrapWithOutsideComponents",
"(",
"$",
"output",
")",
"{",
"return",
"$",
"this",
"->",
"renderComponents",
"(",
"self",
"::",
"SECTION_BEFORE",
")",
".",
"$",
"output",
".",
"$",
"this",
"->",
"renderComponents",
"(",
"self",
"::",
... | Wraps content with outside components (components that have 'before' or 'after' render_section value).
@param string $output
@return string | [
"Wraps",
"content",
"with",
"outside",
"components",
"(",
"components",
"that",
"have",
"before",
"or",
"after",
"render_section",
"value",
")",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/RenderableRegistry.php#L66-L71 |
Nayjest/Grids | src/Components/Base/RenderableRegistry.php | RenderableRegistry.renderInnerComponents | protected function renderInnerComponents()
{
return $this->renderComponents(self::SECTION_BEGIN)
. $this->renderComponents()
. $this->renderComponents(self::SECTION_END);
} | php | protected function renderInnerComponents()
{
return $this->renderComponents(self::SECTION_BEGIN)
. $this->renderComponents()
. $this->renderComponents(self::SECTION_END);
} | [
"protected",
"function",
"renderInnerComponents",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"renderComponents",
"(",
"self",
"::",
"SECTION_BEGIN",
")",
".",
"$",
"this",
"->",
"renderComponents",
"(",
")",
".",
"$",
"this",
"->",
"renderComponents",
"(",
... | Renders inner components.
@return string | [
"Renders",
"inner",
"components",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/RenderableRegistry.php#L78-L83 |
Nayjest/Grids | src/Components/Base/RenderableRegistry.php | RenderableRegistry.render | public function render()
{
$this->is_rendered = true;
return $this->wrapWithOutsideComponents(
$this->getTemplate()
? $this->renderTemplate()
: $this->renderInnerComponents()
);
} | php | public function render()
{
$this->is_rendered = true;
return $this->wrapWithOutsideComponents(
$this->getTemplate()
? $this->renderTemplate()
: $this->renderInnerComponents()
);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"is_rendered",
"=",
"true",
";",
"return",
"$",
"this",
"->",
"wrapWithOutsideComponents",
"(",
"$",
"this",
"->",
"getTemplate",
"(",
")",
"?",
"$",
"this",
"->",
"renderTemplate",
"(",
"... | Renders component.
@return string | [
"Renders",
"component",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/RenderableRegistry.php#L90-L98 |
Nayjest/Grids | src/Components/OneCellRow.php | OneCellRow.render | public function render()
{
$colspan = $this->grid->getConfig()->getColumns()->count();
$opening = "<tr><td colspan=\"$colspan\">";
$closing = '</td></tr>';
return $this->wrapWithOutsideComponents(
$opening . $this->renderInnerComponents() . $closing
);
} | php | public function render()
{
$colspan = $this->grid->getConfig()->getColumns()->count();
$opening = "<tr><td colspan=\"$colspan\">";
$closing = '</td></tr>';
return $this->wrapWithOutsideComponents(
$opening . $this->renderInnerComponents() . $closing
);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"colspan",
"=",
"$",
"this",
"->",
"grid",
"->",
"getConfig",
"(",
")",
"->",
"getColumns",
"(",
")",
"->",
"count",
"(",
")",
";",
"$",
"opening",
"=",
"\"<tr><td colspan=\\\"$colspan\\\">\"",
";",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/OneCellRow.php#L13-L21 |
Nayjest/Grids | src/Components/TotalsRow.php | TotalsRow.listen | protected function listen(DataProvider $provider)
{
Event::listen(
DataProvider::EVENT_FETCH_ROW,
function (DataRow $row, DataProvider $currentProvider) use ($provider) {
if ($currentProvider !== $provider) return;
$this->rows_processed++;
foreach ($this->fields as $field) {
$name = $field->getName();
$operation = $this->getFieldOperation($name);
switch($operation) {
case self::OPERATION_SUM:
$this->src[$name] += $row->getCellValue($field);
break;
case self::OPERATION_COUNT:
$this->src[$name] = $this->rows_processed;
break;
case self::OPERATION_AVG:
$key = "{$name}_sum";
if (empty($this->src[$key])) {
$this->src[$key] = 0;
}
$this->src[$key] += $row->getCellValue($field);
$this->src[$name] = round(
$this->src[$key] / $this->rows_processed,
2
);
break;
default:
throw new LogicException(
'TotalsRow: Unknown aggregation operation.'
);
}
}
}
);
} | php | protected function listen(DataProvider $provider)
{
Event::listen(
DataProvider::EVENT_FETCH_ROW,
function (DataRow $row, DataProvider $currentProvider) use ($provider) {
if ($currentProvider !== $provider) return;
$this->rows_processed++;
foreach ($this->fields as $field) {
$name = $field->getName();
$operation = $this->getFieldOperation($name);
switch($operation) {
case self::OPERATION_SUM:
$this->src[$name] += $row->getCellValue($field);
break;
case self::OPERATION_COUNT:
$this->src[$name] = $this->rows_processed;
break;
case self::OPERATION_AVG:
$key = "{$name}_sum";
if (empty($this->src[$key])) {
$this->src[$key] = 0;
}
$this->src[$key] += $row->getCellValue($field);
$this->src[$name] = round(
$this->src[$key] / $this->rows_processed,
2
);
break;
default:
throw new LogicException(
'TotalsRow: Unknown aggregation operation.'
);
}
}
}
);
} | [
"protected",
"function",
"listen",
"(",
"DataProvider",
"$",
"provider",
")",
"{",
"Event",
"::",
"listen",
"(",
"DataProvider",
"::",
"EVENT_FETCH_ROW",
",",
"function",
"(",
"DataRow",
"$",
"row",
",",
"DataProvider",
"$",
"currentProvider",
")",
"use",
"(",... | Creates listener for grid.dp.fetch_row event.
The listener will perform totals calculation.
@param DataProvider $provider | [
"Creates",
"listener",
"for",
"grid",
".",
"dp",
".",
"fetch_row",
"event",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/TotalsRow.php#L75-L114 |
Nayjest/Grids | src/Components/TotalsRow.php | TotalsRow.initialize | public function initialize(Grid $grid)
{
$this->initializeComponent($grid);
$this->provideFields();
$this->listen(
$this->grid->getConfig()->getDataProvider()
);
return null;
} | php | public function initialize(Grid $grid)
{
$this->initializeComponent($grid);
$this->provideFields();
$this->listen(
$this->grid->getConfig()->getDataProvider()
);
return null;
} | [
"public",
"function",
"initialize",
"(",
"Grid",
"$",
"grid",
")",
"{",
"$",
"this",
"->",
"initializeComponent",
"(",
"$",
"grid",
")",
";",
"$",
"this",
"->",
"provideFields",
"(",
")",
";",
"$",
"this",
"->",
"listen",
"(",
"$",
"this",
"->",
"gri... | Performs component initialization.
@param Grid $grid
@return null | [
"Performs",
"component",
"initialization",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/TotalsRow.php#L122-L130 |
Nayjest/Grids | src/Components/TotalsRow.php | TotalsRow.uses | public function uses(FieldConfig $field)
{
return in_array($field, $this->fields->toArray()) || $field instanceof IdFieldConfig;
} | php | public function uses(FieldConfig $field)
{
return in_array($field, $this->fields->toArray()) || $field instanceof IdFieldConfig;
} | [
"public",
"function",
"uses",
"(",
"FieldConfig",
"$",
"field",
")",
"{",
"return",
"in_array",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"fields",
"->",
"toArray",
"(",
")",
")",
"||",
"$",
"field",
"instanceof",
"IdFieldConfig",
";",
"}"
] | Returns true if the component uses specified column for totals calculation.
@param FieldConfig $field
@return bool | [
"Returns",
"true",
"if",
"the",
"component",
"uses",
"specified",
"column",
"for",
"totals",
"calculation",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/TotalsRow.php#L138-L141 |
Nayjest/Grids | src/Components/TotalsRow.php | TotalsRow.setFieldNames | public function setFieldNames(array $fieldNames)
{
$this->field_names = $fieldNames;
$this->src = [];
foreach ($this->field_names as $name) {
$this->src[$name] = 0;
}
return $this;
} | php | public function setFieldNames(array $fieldNames)
{
$this->field_names = $fieldNames;
$this->src = [];
foreach ($this->field_names as $name) {
$this->src[$name] = 0;
}
return $this;
} | [
"public",
"function",
"setFieldNames",
"(",
"array",
"$",
"fieldNames",
")",
"{",
"$",
"this",
"->",
"field_names",
"=",
"$",
"fieldNames",
";",
"$",
"this",
"->",
"src",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"field_names",
"as",
"$",
... | Allows to specify list of fields
which will be used for totals calculation.
@param array|string[] $fieldNames
@return $this | [
"Allows",
"to",
"specify",
"list",
"of",
"fields",
"which",
"will",
"be",
"used",
"for",
"totals",
"calculation",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/TotalsRow.php#L176-L184 |
Nayjest/Grids | src/Components/Filters/DateRangePicker.php | DateRangePicker.hasValue | protected function hasValue()
{
list($start, $end) = $this->getValue();
return $start !== null && $start !== '' && $end !== null && $end !== '';
} | php | protected function hasValue()
{
list($start, $end) = $this->getValue();
return $start !== null && $start !== '' && $end !== null && $end !== '';
} | [
"protected",
"function",
"hasValue",
"(",
")",
"{",
"list",
"(",
"$",
"start",
",",
"$",
"end",
")",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"return",
"$",
"start",
"!==",
"null",
"&&",
"$",
"start",
"!==",
"''",
"&&",
"$",
"end",
"!==... | Returns true if non-empty value specified for the filter.
@return bool | [
"Returns",
"true",
"if",
"non",
"-",
"empty",
"value",
"specified",
"for",
"the",
"filter",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Filters/DateRangePicker.php#L119-L123 |
Nayjest/Grids | src/Components/Filters/DateRangePicker.php | DateRangePicker.getDefaultJsOptions | protected function getDefaultJsOptions()
{
$carbon = new Carbon();
$prev_month = Carbon::now()->startOfMonth()->subWeek();
$today = Carbon::now();
$res = [
'format' => 'YYYY-MM-DD',
'ranges' => [
'previous_month' => [
'Previous month (' . $prev_month->format('F') . ')',
[
$prev_month->startOfMonth()->format('Y-m-d'),
$prev_month->endOfMonth()->format('Y-m-d'),
]
],
'current_month' => [
'Cur. month (' . date('F'). ')',
[
$carbon->startOfMonth()->format('Y-m-d'),
$carbon->endOfMonth()->format('Y-m-d')
]
],
'last_week' => [
'This Week',
[
$carbon->startOfWeek()->format('Y-m-d'),
$carbon->endOfWeek()->format('Y-m-d')
]
],
'last_14' => [
'Last 14 days',
[
Carbon::now()->subDays(13)->format('Y-m-d'),
$today->format('Y-m-d')
]
],
],
];
// will not set dates when '' passed but set default date when null passed
if ($this->getStartValue()) {
$res['startDate'] = $this->getStartValue();
}
if ($this->getEndValue()) {
$res['endDate'] = $this->getEndValue();
}
return $res;
} | php | protected function getDefaultJsOptions()
{
$carbon = new Carbon();
$prev_month = Carbon::now()->startOfMonth()->subWeek();
$today = Carbon::now();
$res = [
'format' => 'YYYY-MM-DD',
'ranges' => [
'previous_month' => [
'Previous month (' . $prev_month->format('F') . ')',
[
$prev_month->startOfMonth()->format('Y-m-d'),
$prev_month->endOfMonth()->format('Y-m-d'),
]
],
'current_month' => [
'Cur. month (' . date('F'). ')',
[
$carbon->startOfMonth()->format('Y-m-d'),
$carbon->endOfMonth()->format('Y-m-d')
]
],
'last_week' => [
'This Week',
[
$carbon->startOfWeek()->format('Y-m-d'),
$carbon->endOfWeek()->format('Y-m-d')
]
],
'last_14' => [
'Last 14 days',
[
Carbon::now()->subDays(13)->format('Y-m-d'),
$today->format('Y-m-d')
]
],
],
];
// will not set dates when '' passed but set default date when null passed
if ($this->getStartValue()) {
$res['startDate'] = $this->getStartValue();
}
if ($this->getEndValue()) {
$res['endDate'] = $this->getEndValue();
}
return $res;
} | [
"protected",
"function",
"getDefaultJsOptions",
"(",
")",
"{",
"$",
"carbon",
"=",
"new",
"Carbon",
"(",
")",
";",
"$",
"prev_month",
"=",
"Carbon",
"::",
"now",
"(",
")",
"->",
"startOfMonth",
"(",
")",
"->",
"subWeek",
"(",
")",
";",
"$",
"today",
... | Returns default javascript options
Available options:
@see https://github.com/dangrossman/bootstrap-daterangepicker#options
@return array | [
"Returns",
"default",
"javascript",
"options"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Filters/DateRangePicker.php#L133-L180 |
Nayjest/Grids | src/Components/Filters/DateRangePicker.php | DateRangePicker.getDefaultValue | public function getDefaultValue()
{
return is_array($this->default_value) ? $this->default_value : [
Carbon::now()->subWeek()->format('Y-m-d'),
Carbon::now()->format('Y-m-d'),
];
} | php | public function getDefaultValue()
{
return is_array($this->default_value) ? $this->default_value : [
Carbon::now()->subWeek()->format('Y-m-d'),
Carbon::now()->format('Y-m-d'),
];
} | [
"public",
"function",
"getDefaultValue",
"(",
")",
"{",
"return",
"is_array",
"(",
"$",
"this",
"->",
"default_value",
")",
"?",
"$",
"this",
"->",
"default_value",
":",
"[",
"Carbon",
"::",
"now",
"(",
")",
"->",
"subWeek",
"(",
")",
"->",
"format",
"... | Returns default filter value as [$startDate, $endDate]
@return array | [
"Returns",
"default",
"filter",
"value",
"as",
"[",
"$startDate",
"$endDate",
"]"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Filters/DateRangePicker.php#L197-L203 |
Nayjest/Grids | src/Components/RecordsPerPage.php | RecordsPerPage.getValue | public function getValue()
{
$from_input = $this
->grid
->getInputProcessor()
->getFilterValue('records_per_page');
if ($from_input === null) {
return $this->grid->getConfig()->getPageSize();
} else {
return (int) $from_input;
}
} | php | public function getValue()
{
$from_input = $this
->grid
->getInputProcessor()
->getFilterValue('records_per_page');
if ($from_input === null) {
return $this->grid->getConfig()->getPageSize();
} else {
return (int) $from_input;
}
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"from_input",
"=",
"$",
"this",
"->",
"grid",
"->",
"getInputProcessor",
"(",
")",
"->",
"getFilterValue",
"(",
"'records_per_page'",
")",
";",
"if",
"(",
"$",
"from_input",
"===",
"null",
")",
"{",
"... | Returns current value from input.
Default grids pre-configured page size will be returned if there is no input.
@return int|null | [
"Returns",
"current",
"value",
"from",
"input",
".",
"Default",
"grids",
"pre",
"-",
"configured",
"page",
"size",
"will",
"be",
"returned",
"if",
"there",
"is",
"no",
"input",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/RecordsPerPage.php#L67-L78 |
Nayjest/Grids | src/Components/RecordsPerPage.php | RecordsPerPage.prepare | public function prepare()
{
$value = $this->getValue();
if (!$value || !is_numeric($value)) return;
$this->grid->getConfig()->getDataProvider()->setPageSize($value);
} | php | public function prepare()
{
$value = $this->getValue();
if (!$value || !is_numeric($value)) return;
$this->grid->getConfig()->getDataProvider()->setPageSize($value);
} | [
"public",
"function",
"prepare",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"$",
"value",
"||",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"return",
";",
"$",
"this",
"->",
"grid",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/RecordsPerPage.php#L83-L88 |
Nayjest/Grids | src/Components/Base/TComponent.php | TComponent.initialize | public function initialize(Grid $grid)
{
$this->grid = $grid;
if (method_exists($this, 'initializeComponents')) {
$this->initializeComponents($grid);
}
} | php | public function initialize(Grid $grid)
{
$this->grid = $grid;
if (method_exists($this, 'initializeComponents')) {
$this->initializeComponents($grid);
}
} | [
"public",
"function",
"initialize",
"(",
"Grid",
"$",
"grid",
")",
"{",
"$",
"this",
"->",
"grid",
"=",
"$",
"grid",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'initializeComponents'",
")",
")",
"{",
"$",
"this",
"->",
"initializeComponents... | Initializes component with grid.
@param Grid $grid
@return null | [
"Initializes",
"component",
"with",
"grid",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Components/Base/TComponent.php#L54-L60 |
Nayjest/Grids | src/Grids.php | Grids.getBuilder | protected static function getBuilder()
{
if (self::$builder === null) {
$setup = new Setup();
self::$builder = $setup->run();
}
return self::$builder;
} | php | protected static function getBuilder()
{
if (self::$builder === null) {
$setup = new Setup();
self::$builder = $setup->run();
}
return self::$builder;
} | [
"protected",
"static",
"function",
"getBuilder",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"builder",
"===",
"null",
")",
"{",
"$",
"setup",
"=",
"new",
"Setup",
"(",
")",
";",
"self",
"::",
"$",
"builder",
"=",
"$",
"setup",
"->",
"run",
"(",
... | Returns builder instance.
@return \Nayjest\Builder\Builder | [
"Returns",
"builder",
"instance",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Grids.php#L23-L30 |
Nayjest/Grids | src/Grids.php | Grids.make | public static function make(array $config)
{
$builder = self::getBuilder();
$configObject = $builder->build($config);
$grid = new Grid($configObject);
return $grid;
} | php | public static function make(array $config)
{
$builder = self::getBuilder();
$configObject = $builder->build($config);
$grid = new Grid($configObject);
return $grid;
} | [
"public",
"static",
"function",
"make",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"builder",
"=",
"self",
"::",
"getBuilder",
"(",
")",
";",
"$",
"configObject",
"=",
"$",
"builder",
"->",
"build",
"(",
"$",
"config",
")",
";",
"$",
"grid",
"=",
... | Creates grid using configuration.
@param array $config
@return Grid | [
"Creates",
"grid",
"using",
"configuration",
"."
] | train | https://github.com/Nayjest/Grids/blob/06f0a3d1b62844006d7c5e177e554dba0933d18e/src/Grids.php#L38-L44 |
bushbaby/BsbFlysystem | src/Adapter/Factory/AbstractAdapterFactory.php | AbstractAdapterFactory.mergeMvcConfig | protected function mergeMvcConfig(ServiceLocatorInterface $serviceLocator, string $requestedName = null)
{
$config = $serviceLocator->has('config') ? $serviceLocator->get('config') : [];
if (! isset($config['bsb_flysystem']['adapters'][$requestedName]['options']) ||
! is_array(($config['bsb_flysystem']['adapters'][$requestedName]['options']))
) {
return;
}
$this->options = ArrayUtils::merge(
$config['bsb_flysystem']['adapters'][$requestedName]['options'],
$this->options
);
} | php | protected function mergeMvcConfig(ServiceLocatorInterface $serviceLocator, string $requestedName = null)
{
$config = $serviceLocator->has('config') ? $serviceLocator->get('config') : [];
if (! isset($config['bsb_flysystem']['adapters'][$requestedName]['options']) ||
! is_array(($config['bsb_flysystem']['adapters'][$requestedName]['options']))
) {
return;
}
$this->options = ArrayUtils::merge(
$config['bsb_flysystem']['adapters'][$requestedName]['options'],
$this->options
);
} | [
"protected",
"function",
"mergeMvcConfig",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
",",
"string",
"$",
"requestedName",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"has",
"(",
"'config'",
")",
"?",
"$",
"serviceLocator"... | Merges the options given from the ServiceLocator Config object with the create options of the class. | [
"Merges",
"the",
"options",
"given",
"from",
"the",
"ServiceLocator",
"Config",
"object",
"with",
"the",
"create",
"options",
"of",
"the",
"class",
"."
] | train | https://github.com/bushbaby/BsbFlysystem/blob/457381aecb3bd9c5d2d07fd49c1c04b6c4291664/src/Adapter/Factory/AbstractAdapterFactory.php#L69-L83 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.deleteAction | public function deleteAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->delete( $request, new Response() );
} | php | public function deleteAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->delete( $request, new Response() );
} | [
"public",
"function",
"deleteAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
",",
"$",
"site",
"=",
"'default'",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resource",
",",
"$... | Deletes the resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "product/property/type"
@param string $site Unique site code
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Deletes",
"the",
"resource",
"object",
"or",
"a",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L34-L38 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.getAction | public function getAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->get( $request, new Response() );
} | php | public function getAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->get( $request, new Response() );
} | [
"public",
"function",
"getAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
",",
"$",
"site",
"=",
"'default'",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resource",
",",
"$",
... | Returns the requested resource object or list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "product/property/type"
@param string $site Unique site code
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Returns",
"the",
"requested",
"resource",
"object",
"or",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L49-L53 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.patchAction | public function patchAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->patch( $request, new Response() );
} | php | public function patchAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->patch( $request, new Response() );
} | [
"public",
"function",
"patchAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
",",
"$",
"site",
"=",
"'default'",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resource",
",",
"$"... | Updates a resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "product/property/type"
@param string $site Unique site code
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Updates",
"a",
"resource",
"object",
"or",
"a",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L64-L68 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.postAction | public function postAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->post( $request, new Response() );
} | php | public function postAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->post( $request, new Response() );
} | [
"public",
"function",
"postAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
",",
"$",
"site",
"=",
"'default'",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resource",
",",
"$",... | Creates a new resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "product/property/type"
@param string $site Unique site code
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Creates",
"a",
"new",
"resource",
"object",
"or",
"a",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L79-L83 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.putAction | public function putAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->put( $request, new Response() );
} | php | public function putAction( ServerRequestInterface $request, $resource, $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->put( $request, new Response() );
} | [
"public",
"function",
"putAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
",",
"$",
"site",
"=",
"'default'",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resource",
",",
"$",
... | Creates or updates a single resource object
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "product/property/type"
@param string $site Unique site code
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Creates",
"or",
"updates",
"a",
"single",
"resource",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L94-L98 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.optionsAction | public function optionsAction( ServerRequestInterface $request, $resource = '', $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->options( $request, new Response() );
} | php | public function optionsAction( ServerRequestInterface $request, $resource = '', $site = 'default' )
{
$client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) );
return $client->options( $request, new Response() );
} | [
"public",
"function",
"optionsAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
"=",
"''",
",",
"$",
"site",
"=",
"'default'",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resour... | Returns the available HTTP verbs and the resource URLs
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "product/property/type"
@param string $site Unique site code
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Returns",
"the",
"available",
"HTTP",
"verbs",
"and",
"the",
"resource",
"URLs"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L109-L113 |
aimeos/aimeos-symfony | Controller/JsonadmController.php | JsonadmController.createAdmin | protected function createAdmin( $site, $resource, $lang )
{
$aimeos = $this->get( 'aimeos' )->get();
$templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' );
$context = $this->get( 'aimeos.context' )->get( false, 'backend' );
$context->setI18n( $this->get('aimeos.i18n')->get( array( $lang, 'en' ) ) );
$context->setLocale( $this->get('aimeos.locale')->getBackend( $context, $site ) );
$view = $this->get('aimeos.view')->create( $context, $templatePaths, $lang );
$context->setView( $view );
return \Aimeos\Admin\JsonAdm::create( $context, $aimeos, $resource );
} | php | protected function createAdmin( $site, $resource, $lang )
{
$aimeos = $this->get( 'aimeos' )->get();
$templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' );
$context = $this->get( 'aimeos.context' )->get( false, 'backend' );
$context->setI18n( $this->get('aimeos.i18n')->get( array( $lang, 'en' ) ) );
$context->setLocale( $this->get('aimeos.locale')->getBackend( $context, $site ) );
$view = $this->get('aimeos.view')->create( $context, $templatePaths, $lang );
$context->setView( $view );
return \Aimeos\Admin\JsonAdm::create( $context, $aimeos, $resource );
} | [
"protected",
"function",
"createAdmin",
"(",
"$",
"site",
",",
"$",
"resource",
",",
"$",
"lang",
")",
"{",
"$",
"aimeos",
"=",
"$",
"this",
"->",
"get",
"(",
"'aimeos'",
")",
"->",
"get",
"(",
")",
";",
"$",
"templatePaths",
"=",
"$",
"aimeos",
"-... | Returns the resource controller
@param string $site Unique site code
@param string Resource location, e.g. "product/property/type"
@param string $lang Language code
@return \Aimeos\MShop\Context\Item\Iface Context item | [
"Returns",
"the",
"resource",
"controller"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonadmController.php#L124-L137 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.deleteAction | public function deleteAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->delete( $request, new Response() );
} | php | public function deleteAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->delete( $request, new Response() );
} | [
"public",
"function",
"deleteAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
")",
"{",
"return",
"$",
"this",
"->",
"createClient",
"(",
"$",
"request",
",",
"$",
"resource",
")",
"->",
"delete",
"(",
"$",
"request",
",",
"new... | Deletes the resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Deletes",
"the",
"resource",
"object",
"or",
"a",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L33-L36 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.getAction | public function getAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->get( $request, new Response() );
} | php | public function getAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->get( $request, new Response() );
} | [
"public",
"function",
"getAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
")",
"{",
"return",
"$",
"this",
"->",
"createClient",
"(",
"$",
"request",
",",
"$",
"resource",
")",
"->",
"get",
"(",
"$",
"request",
",",
"new",
"... | Returns the requested resource object or list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Returns",
"the",
"requested",
"resource",
"object",
"or",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L46-L49 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.patchAction | public function patchAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->patch( $request, new Response() );
} | php | public function patchAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->patch( $request, new Response() );
} | [
"public",
"function",
"patchAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
")",
"{",
"return",
"$",
"this",
"->",
"createClient",
"(",
"$",
"request",
",",
"$",
"resource",
")",
"->",
"patch",
"(",
"$",
"request",
",",
"new",... | Updates a resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Updates",
"a",
"resource",
"object",
"or",
"a",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L59-L62 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.postAction | public function postAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->post( $request, new Response() );
} | php | public function postAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->post( $request, new Response() );
} | [
"public",
"function",
"postAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
")",
"{",
"return",
"$",
"this",
"->",
"createClient",
"(",
"$",
"request",
",",
"$",
"resource",
")",
"->",
"post",
"(",
"$",
"request",
",",
"new",
... | Creates a new resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Creates",
"a",
"new",
"resource",
"object",
"or",
"a",
"list",
"of",
"resource",
"objects"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L72-L75 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.putAction | public function putAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->put( $request, new Response() );
} | php | public function putAction( ServerRequestInterface $request, $resource )
{
return $this->createClient( $request, $resource )->put( $request, new Response() );
} | [
"public",
"function",
"putAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
")",
"{",
"return",
"$",
"this",
"->",
"createClient",
"(",
"$",
"request",
",",
"$",
"resource",
")",
"->",
"put",
"(",
"$",
"request",
",",
"new",
"... | Creates or updates a single resource object
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Creates",
"or",
"updates",
"a",
"single",
"resource",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L85-L88 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.optionsAction | public function optionsAction( ServerRequestInterface $request, $resource = '' )
{
return $this->createClient( $request, $resource )->options( $request, new Response() );
} | php | public function optionsAction( ServerRequestInterface $request, $resource = '' )
{
return $this->createClient( $request, $resource )->options( $request, new Response() );
} | [
"public",
"function",
"optionsAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"createClient",
"(",
"$",
"request",
",",
"$",
"resource",
")",
"->",
"options",
"(",
"$",
"reques... | Returns the available HTTP verbs and the resource URLs
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output | [
"Returns",
"the",
"available",
"HTTP",
"verbs",
"and",
"the",
"resource",
"URLs"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L98-L101 |
aimeos/aimeos-symfony | Controller/JsonapiController.php | JsonapiController.createClient | protected function createClient( ServerRequestInterface $request, $resource )
{
$args = $request->getAttributes();
$params = $request->getQueryParams();
$related = ( isset( $args['related'] ) ? $args['related'] : ( isset( $params['related'] ) ? $params['related'] : null ) );
$tmplPaths = $this->container->get( 'aimeos' )->get()->getCustomPaths( 'client/jsonapi/templates' );
$context = $this->container->get( 'aimeos.context' )->get();
$langid = $context->getLocale()->getLanguageId();
$view = $this->container->get( 'aimeos.view' )->create( $context, $tmplPaths, $langid );
$context->setView( $view );
return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related );
} | php | protected function createClient( ServerRequestInterface $request, $resource )
{
$args = $request->getAttributes();
$params = $request->getQueryParams();
$related = ( isset( $args['related'] ) ? $args['related'] : ( isset( $params['related'] ) ? $params['related'] : null ) );
$tmplPaths = $this->container->get( 'aimeos' )->get()->getCustomPaths( 'client/jsonapi/templates' );
$context = $this->container->get( 'aimeos.context' )->get();
$langid = $context->getLocale()->getLanguageId();
$view = $this->container->get( 'aimeos.view' )->create( $context, $tmplPaths, $langid );
$context->setView( $view );
return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related );
} | [
"protected",
"function",
"createClient",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"resource",
")",
"{",
"$",
"args",
"=",
"$",
"request",
"->",
"getAttributes",
"(",
")",
";",
"$",
"params",
"=",
"$",
"request",
"->",
"getQueryParams",
"(",
... | Returns the resource controller
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param string Resource location, e.g. "customer"
@return \Aimeos\Client\JsonApi\Iface JSON API client | [
"Returns",
"the",
"resource",
"controller"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/JsonapiController.php#L111-L125 |
aimeos/aimeos-symfony | Controller/AdminController.php | AdminController.indexAction | public function indexAction( Request $request )
{
if( $this->hasRole( ['ROLE_ADMIN', 'ROLE_SUPER_ADMIN'] ) )
{
$context = $this->get( 'aimeos.context' )->get( false );
$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
$user = $this->get( 'security.token_storage' )->getToken()->getUser();
$siteCode = ( $user->getSiteId() ? $siteManager->getItem( $user->getSiteId() )->getCode() : 'default' );
$locale = $user->getLanguageId() ?: $this->getParameter( 'locale' );
$params = array(
'resource' => 'dashboard',
'site' => $request->attributes->get( 'site', $request->query->get( 'site', $siteCode ) ),
'lang' => $request->attributes->get( 'lang', $request->query->get( 'lang', $locale ) ),
);
return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
}
$param = array( 'error' => '', 'username' => '' );
if( $this->has( 'security.authentication_utils' ) )
{
$auth = $this->get( 'security.authentication_utils' );
$param['error'] = $auth->getLastAuthenticationError();
$param['username'] = $auth->getLastUsername();
}
return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param );
} | php | public function indexAction( Request $request )
{
if( $this->hasRole( ['ROLE_ADMIN', 'ROLE_SUPER_ADMIN'] ) )
{
$context = $this->get( 'aimeos.context' )->get( false );
$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
$user = $this->get( 'security.token_storage' )->getToken()->getUser();
$siteCode = ( $user->getSiteId() ? $siteManager->getItem( $user->getSiteId() )->getCode() : 'default' );
$locale = $user->getLanguageId() ?: $this->getParameter( 'locale' );
$params = array(
'resource' => 'dashboard',
'site' => $request->attributes->get( 'site', $request->query->get( 'site', $siteCode ) ),
'lang' => $request->attributes->get( 'lang', $request->query->get( 'lang', $locale ) ),
);
return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
}
$param = array( 'error' => '', 'username' => '' );
if( $this->has( 'security.authentication_utils' ) )
{
$auth = $this->get( 'security.authentication_utils' );
$param['error'] = $auth->getLastAuthenticationError();
$param['username'] = $auth->getLastUsername();
}
return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param );
} | [
"public",
"function",
"indexAction",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasRole",
"(",
"[",
"'ROLE_ADMIN'",
",",
"'ROLE_SUPER_ADMIN'",
"]",
")",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"get",
"(",
"'aimeo... | Returns the initial HTML view for the admin interface.
@param Request $request Symfony request object
@return Response Generated HTML page for the admin interface | [
"Returns",
"the",
"initial",
"HTML",
"view",
"for",
"the",
"admin",
"interface",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/AdminController.php#L31-L61 |
aimeos/aimeos-symfony | Controller/AdminController.php | AdminController.hasRole | protected function hasRole( array $roles )
{
if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken() )
{
$checker = $this->get( 'security.authorization_checker' );
foreach( $roles as $role )
{
if( $checker->isGranted( $role ) ) {
return true;
}
}
}
return false;
} | php | protected function hasRole( array $roles )
{
if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken() )
{
$checker = $this->get( 'security.authorization_checker' );
foreach( $roles as $role )
{
if( $checker->isGranted( $role ) ) {
return true;
}
}
}
return false;
} | [
"protected",
"function",
"hasRole",
"(",
"array",
"$",
"roles",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"'security.authorization_checker'",
")",
"&&",
"$",
"this",
"->",
"get",
"(",
"'security.token_storage'",
")",
"->",
"getToken",
"(",
")",
"... | Checks if the used is authenticated and has the admin role
@param array $roles List of role names where at least one must match
@return boolean True if authenticated and is admin, false if not | [
"Checks",
"if",
"the",
"used",
"is",
"authenticated",
"and",
"has",
"the",
"admin",
"role"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/AdminController.php#L70-L85 |
aimeos/aimeos-symfony | Service/View.php | View.addAccess | protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context )
{
$container = $this->container;
$token = $this->container->get( 'security.token_storage' )->getToken();
if( is_object( $token ) && is_object( $token->getUser() )
&& in_array( 'ROLE_SUPER_ADMIN', (array) $token->getUser()->getRoles() ) )
{
$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
}
else
{
$fcn = function() use ( $container, $context ) {
return $container->get( 'aimeos.support' )->getGroups( $context );
};
$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
}
$view->addHelper( 'access', $helper );
return $view;
} | php | protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context )
{
$container = $this->container;
$token = $this->container->get( 'security.token_storage' )->getToken();
if( is_object( $token ) && is_object( $token->getUser() )
&& in_array( 'ROLE_SUPER_ADMIN', (array) $token->getUser()->getRoles() ) )
{
$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
}
else
{
$fcn = function() use ( $container, $context ) {
return $container->get( 'aimeos.support' )->getGroups( $context );
};
$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
}
$view->addHelper( 'access', $helper );
return $view;
} | [
"protected",
"function",
"addAccess",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"$",
"container",
"=",
"$",
"... | Adds the "access" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"access",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L83-L105 |
aimeos/aimeos-symfony | Service/View.php | View.addCsrf | protected function addCsrf( \Aimeos\MW\View\Iface $view )
{
$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
$view->addHelper( 'csrf', $helper );
return $view;
} | php | protected function addCsrf( \Aimeos\MW\View\Iface $view )
{
$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
$view->addHelper( 'csrf', $helper );
return $view;
} | [
"protected",
"function",
"addCsrf",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'security.csrf.token_manager'",
")",
"->",
"getToken",
"(",
"'_... | Adds the "access" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"access",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L131-L138 |
aimeos/aimeos-symfony | Service/View.php | View.addParam | protected function addParam( \Aimeos\MW\View\Iface $view )
{
$params = array();
$request = $this->requestStack->getMasterRequest();
if( $request !== null ) {
$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
}
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
return $view;
} | php | protected function addParam( \Aimeos\MW\View\Iface $view )
{
$params = array();
$request = $this->requestStack->getMasterRequest();
if( $request !== null ) {
$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
}
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
return $view;
} | [
"protected",
"function",
"addParam",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",... | Adds the "param" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"param",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L166-L179 |
aimeos/aimeos-symfony | Service/View.php | View.addRequest | protected function addRequest( \Aimeos\MW\View\Iface $view )
{
$request = $this->requestStack->getMasterRequest();
if( $request !== null )
{
$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
$view->addHelper( 'request', $helper );
}
return $view;
} | php | protected function addRequest( \Aimeos\MW\View\Iface $view )
{
$request = $this->requestStack->getMasterRequest();
if( $request !== null )
{
$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
$view->addHelper( 'request', $helper );
}
return $view;
} | [
"protected",
"function",
"addRequest",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"!==... | Adds the "request" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"request",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L188-L199 |
aimeos/aimeos-symfony | Service/View.php | View.addResponse | protected function addResponse( \Aimeos\MW\View\Iface $view )
{
$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
$view->addHelper( 'response', $helper );
return $view;
} | php | protected function addResponse( \Aimeos\MW\View\Iface $view )
{
$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
$view->addHelper( 'response', $helper );
return $view;
} | [
"protected",
"function",
"addResponse",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"$",
"helper",
"=",
"new",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Helper",
"\\",
"Response",
"\\",
"Symfony2",
"(",
... | Adds the "response" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"response",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L208-L214 |
aimeos/aimeos-symfony | Service/View.php | View.addTranslate | protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
{
if( $locale !== null )
{
$i18n = $this->container->get( 'aimeos.i18n' )->get( array( $locale ) );
$translation = $i18n[$locale];
}
else
{
$translation = new \Aimeos\MW\Translation\None( 'en' );
}
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
$view->addHelper( 'translate', $helper );
return $view;
} | php | protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
{
if( $locale !== null )
{
$i18n = $this->container->get( 'aimeos.i18n' )->get( array( $locale ) );
$translation = $i18n[$locale];
}
else
{
$translation = new \Aimeos\MW\Translation\None( 'en' );
}
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
$view->addHelper( 'translate', $helper );
return $view;
} | [
"protected",
"function",
"addTranslate",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"$",
"locale",
")",
"{",
"if",
"(",
"$",
"locale",
"!==",
"null",
")",
"{",
"$",
"i18n",
"=",
"$",
"this",
"->",
"container",
"... | Adds the "translate" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@param string|null $locale ISO language code, e.g. "de" or "de_CH"
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"translate",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L240-L256 |
aimeos/aimeos-symfony | Service/View.php | View.addUrl | protected function addUrl( \Aimeos\MW\View\Iface $view )
{
$fixed = array();
$request = $this->requestStack->getMasterRequest();
if( $request !== null )
{
$attr = $request->attributes;
if( ( $site = $attr->get( 'site' ) ) !== null ) {
$fixed['site'] = $site;
}
if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
$fixed['locale'] = $lang;
}
if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
$fixed['currency'] = $currency;
}
}
$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
$view->addHelper( 'url', $helper );
return $view;
} | php | protected function addUrl( \Aimeos\MW\View\Iface $view )
{
$fixed = array();
$request = $this->requestStack->getMasterRequest();
if( $request !== null )
{
$attr = $request->attributes;
if( ( $site = $attr->get( 'site' ) ) !== null ) {
$fixed['site'] = $site;
}
if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
$fixed['locale'] = $lang;
}
if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
$fixed['currency'] = $currency;
}
}
$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
$view->addHelper( 'url', $helper );
return $view;
} | [
"protected",
"function",
"addUrl",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"$",
"fixed",
"=",
"array",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",
... | Adds the "url" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"url",
"helper",
"to",
"the",
"view",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L265-L291 |
aimeos/aimeos-symfony | Service/View.php | View.initTwig | protected function initTwig( \Aimeos\MW\View\Iface $view, \Twig_Environment $twig )
{
$fcn = function( $key, $default = null ) use ( $view ) {
return $view->config( $key, $default );
};
$twig->addFunction( new \Twig_SimpleFunction( 'aiconfig', $fcn ) );
$fcn = function( $singular, array $values = array(), $domain = 'client' ) use ( $view ) {
return vsprintf( $view->translate( $domain, $singular ), $values );
};
$twig->addFunction( new \Twig_SimpleFunction( 'aitrans', $fcn ) );
$fcn = function( $singular, $plural, $number, array $values = array(), $domain = 'client' ) use ( $view ) {
return vsprintf( $view->translate( $domain, $singular, $plural, $number ), $values );
};
$twig->addFunction( new \Twig_SimpleFunction( 'aitransplural', $fcn ) );
} | php | protected function initTwig( \Aimeos\MW\View\Iface $view, \Twig_Environment $twig )
{
$fcn = function( $key, $default = null ) use ( $view ) {
return $view->config( $key, $default );
};
$twig->addFunction( new \Twig_SimpleFunction( 'aiconfig', $fcn ) );
$fcn = function( $singular, array $values = array(), $domain = 'client' ) use ( $view ) {
return vsprintf( $view->translate( $domain, $singular ), $values );
};
$twig->addFunction( new \Twig_SimpleFunction( 'aitrans', $fcn ) );
$fcn = function( $singular, $plural, $number, array $values = array(), $domain = 'client' ) use ( $view ) {
return vsprintf( $view->translate( $domain, $singular, $plural, $number ), $values );
};
$twig->addFunction( new \Twig_SimpleFunction( 'aitransplural', $fcn ) );
} | [
"protected",
"function",
"initTwig",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"\\",
"Twig_Environment",
"$",
"twig",
")",
"{",
"$",
"fcn",
"=",
"function",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",... | Adds the Aimeos template functions for Twig
@param \Aimeos\MW\View\Iface $view View object
@param \Twig_Environment $twig Twig environment object | [
"Adds",
"the",
"Aimeos",
"template",
"functions",
"for",
"Twig"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/View.php#L300-L316 |
aimeos/aimeos-symfony | Service/Context.php | Context.get | public function get( $locale = true, $type = 'frontend' )
{
$config = $this->container->get( 'aimeos.config' )->get( $type );
if( self::$context === null )
{
$context = new \Aimeos\MShop\Context\Item\Standard();
$context->setConfig( $config );
$this->addDataBaseManager( $context );
$this->addFilesystemManager( $context );
$this->addMessageQueueManager( $context );
$this->addLogger( $context );
$this->addCache( $context );
$this->addMailer( $context);
$this->addProcess( $context);
self::$context = $context;
}
$context = self::$context;
$context->setConfig( $config );
if( $locale === true )
{
$localeItem = $this->container->get('aimeos.locale')->get( $context );
$context->setI18n( $this->container->get('aimeos.i18n')->get( array( $localeItem->getLanguageId() ) ) );
$context->setLocale( $localeItem );
}
$this->addSession( $context );
$this->addUserGroups( $context);
return $context;
} | php | public function get( $locale = true, $type = 'frontend' )
{
$config = $this->container->get( 'aimeos.config' )->get( $type );
if( self::$context === null )
{
$context = new \Aimeos\MShop\Context\Item\Standard();
$context->setConfig( $config );
$this->addDataBaseManager( $context );
$this->addFilesystemManager( $context );
$this->addMessageQueueManager( $context );
$this->addLogger( $context );
$this->addCache( $context );
$this->addMailer( $context);
$this->addProcess( $context);
self::$context = $context;
}
$context = self::$context;
$context->setConfig( $config );
if( $locale === true )
{
$localeItem = $this->container->get('aimeos.locale')->get( $context );
$context->setI18n( $this->container->get('aimeos.i18n')->get( array( $localeItem->getLanguageId() ) ) );
$context->setLocale( $localeItem );
}
$this->addSession( $context );
$this->addUserGroups( $context);
return $context;
} | [
"public",
"function",
"get",
"(",
"$",
"locale",
"=",
"true",
",",
"$",
"type",
"=",
"'frontend'",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'aimeos.config'",
")",
"->",
"get",
"(",
"$",
"type",
")",
";",
"if"... | Returns the current context.
@param boolean $locale True to add locale object to context, false if not
@param string $type Configuration type ("frontend" or "backend")
@return \Aimeos\MShop\Context\Item\Iface Context object | [
"Returns",
"the",
"current",
"context",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Context.php#L47-L81 |
aimeos/aimeos-symfony | Service/Context.php | Context.addFilesystemManager | protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
{
$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );
return $context->setFilesystemManager( $fs );
} | php | protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
{
$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );
return $context->setFilesystemManager( $fs );
} | [
"protected",
"function",
"addFilesystemManager",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"$",
"fs",
"=",
"new",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"Filesystem",
"\\",
"Manager",
"\\",
"St... | Adds the filesystem manager object to the context
@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object | [
"Adds",
"the",
"filesystem",
"manager",
"object",
"to",
"the",
"context"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Context.php#L118-L123 |
aimeos/aimeos-symfony | Service/Context.php | Context.addMailer | protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
{
$container = $this->container;
$mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } );
return $context->setMail( $mail );
} | php | protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
{
$container = $this->container;
$mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } );
return $context->setMail( $mail );
} | [
"protected",
"function",
"addMailer",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"container",
";",
"$",
"mail",
"=",
"new",
"\\",
"Aimeos",
"\\",... | Adds the mailer object to the context
@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object | [
"Adds",
"the",
"mailer",
"object",
"to",
"the",
"context"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Context.php#L147-L153 |
aimeos/aimeos-symfony | Service/Context.php | Context.addSession | protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
{
$session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) );
return $context->setSession( $session );
} | php | protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
{
$session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) );
return $context->setSession( $session );
} | [
"protected",
"function",
"addSession",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"$",
"session",
"=",
"new",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"Session",
"\\",
"Symfony2",
"(",
"$",
"thi... | Adds the session object to the context
@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object | [
"Adds",
"the",
"session",
"object",
"to",
"the",
"context"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Context.php#L195-L200 |
aimeos/aimeos-symfony | Service/Context.php | Context.addUserGroups | protected function addUserGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
$username = '';
$token = $this->container->get( 'security.token_storage' )->getToken();
if( is_object( $token ) && is_object( $token->getUser() ) && method_exists( $token->getUser(), 'getId' ) )
{
$username = $token->getUser()->getUsername();
$userid = $token->getUser()->getId();
$context->setUserId( $userid );
$context->setGroupIds( function() use ( $context, $userid )
{
$manager = \Aimeos\MShop::create( $context, 'customer' );
return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
} );
}
if( $username === '' && $this->container->has( 'request_stack' )
&& ( $request = $this->container->get('request_stack')->getMasterRequest() ) !== null
) {
$username = $request->getClientIp();
}
return $context->setEditor( $username );
} | php | protected function addUserGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
$username = '';
$token = $this->container->get( 'security.token_storage' )->getToken();
if( is_object( $token ) && is_object( $token->getUser() ) && method_exists( $token->getUser(), 'getId' ) )
{
$username = $token->getUser()->getUsername();
$userid = $token->getUser()->getId();
$context->setUserId( $userid );
$context->setGroupIds( function() use ( $context, $userid )
{
$manager = \Aimeos\MShop::create( $context, 'customer' );
return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
} );
}
if( $username === '' && $this->container->has( 'request_stack' )
&& ( $request = $this->container->get('request_stack')->getMasterRequest() ) !== null
) {
$username = $request->getClientIp();
}
return $context->setEditor( $username );
} | [
"protected",
"function",
"addUserGroups",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"$",
"username",
"=",
"''",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
... | Adds the user ID and name if available
@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object | [
"Adds",
"the",
"user",
"ID",
"and",
"name",
"if",
"available"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Context.php#L209-L233 |
aimeos/aimeos-symfony | Service/Aimeos.php | Aimeos.get | public function get()
{
if( $this->object === null )
{
$extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' );
$this->object = new \Aimeos\Bootstrap( $extDirs, false );
}
return $this->object;
} | php | public function get()
{
if( $this->object === null )
{
$extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' );
$this->object = new \Aimeos\Bootstrap( $extDirs, false );
}
return $this->object;
} | [
"public",
"function",
"get",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"object",
"===",
"null",
")",
"{",
"$",
"extDirs",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"container",
"->",
"getParameter",
"(",
"'aimeos_shop.extdir'",
")",
";",
"$",
"th... | Returns the Aimeos object.
@return \Aimeos Aimeos object | [
"Returns",
"the",
"Aimeos",
"object",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Aimeos.php#L43-L52 |
aimeos/aimeos-symfony | Service/Aimeos.php | Aimeos.getVersion | public function getVersion()
{
$filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock';
if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false
&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
) {
foreach( (array) $content['packages'] as $item )
{
if( $item['name'] === 'aimeos/aimeos-symfony' ) {
return $item['version'];
}
}
}
return '';
} | php | public function getVersion()
{
$filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock';
if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false
&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
) {
foreach( (array) $content['packages'] as $item )
{
if( $item['name'] === 'aimeos/aimeos-symfony' ) {
return $item['version'];
}
}
}
return '';
} | [
"public",
"function",
"getVersion",
"(",
")",
"{",
"$",
"filename",
"=",
"dirname",
"(",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'kernel'",
")",
"->",
"getRootDir",
"(",
")",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'composer.lock'",
";",
"if",
... | Returns the version of the Aimeos package
@return string Version string | [
"Returns",
"the",
"version",
"of",
"the",
"Aimeos",
"package"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Aimeos.php#L60-L76 |
aimeos/aimeos-symfony | Service/Config.php | Config.get | public function get( $type = 'frontend' )
{
$configPaths = $this->container->get('aimeos')->get()->getConfigPaths();
$conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths );
$apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' );
$prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' );
if( function_exists( 'apcu_store' ) === true && $apc === true ) {
$conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix );
}
$local = array(
'admin' => $this->container->getParameter( 'aimeos_shop.admin' ),
'client' => $this->container->getParameter( 'aimeos_shop.client' ),
'controller' => $this->container->getParameter( 'aimeos_shop.controller' ),
'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ),
'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ),
'resource' => $this->container->getParameter( 'aimeos_shop.resource' ),
);
$config = new \Aimeos\MW\Config\Decorator\Memory( $conf, $local );
$settings = $this->container->getParameter( 'aimeos_shop.' . $type );
if( $settings !== array() ) {
$config = new \Aimeos\MW\Config\Decorator\Memory( $config, $settings );
}
return $config;
} | php | public function get( $type = 'frontend' )
{
$configPaths = $this->container->get('aimeos')->get()->getConfigPaths();
$conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths );
$apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' );
$prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' );
if( function_exists( 'apcu_store' ) === true && $apc === true ) {
$conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix );
}
$local = array(
'admin' => $this->container->getParameter( 'aimeos_shop.admin' ),
'client' => $this->container->getParameter( 'aimeos_shop.client' ),
'controller' => $this->container->getParameter( 'aimeos_shop.controller' ),
'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ),
'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ),
'resource' => $this->container->getParameter( 'aimeos_shop.resource' ),
);
$config = new \Aimeos\MW\Config\Decorator\Memory( $conf, $local );
$settings = $this->container->getParameter( 'aimeos_shop.' . $type );
if( $settings !== array() ) {
$config = new \Aimeos\MW\Config\Decorator\Memory( $config, $settings );
}
return $config;
} | [
"public",
"function",
"get",
"(",
"$",
"type",
"=",
"'frontend'",
")",
"{",
"$",
"configPaths",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'aimeos'",
")",
"->",
"get",
"(",
")",
"->",
"getConfigPaths",
"(",
")",
";",
"$",
"conf",
"=",
... | Returns the config object
@param string $type Configuration type ("frontend" or "backend")
@return \Aimeos\MW\Config\Iface Config object | [
"Returns",
"the",
"config",
"object"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Service/Config.php#L43-L73 |
aimeos/aimeos-symfony | Command/CacheCommand.php | CacheCommand.configure | protected function configure()
{
$this->setName( self::$defaultName );
$this->setDescription( 'Clears the content cache' );
$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' );
} | php | protected function configure()
{
$this->setName( self::$defaultName );
$this->setDescription( 'Clears the content cache' );
$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' );
} | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"setName",
"(",
"self",
"::",
"$",
"defaultName",
")",
";",
"$",
"this",
"->",
"setDescription",
"(",
"'Clears the content cache'",
")",
";",
"$",
"this",
"->",
"addArgument",
"(",
"'s... | Configures the command name and description. | [
"Configures",
"the",
"command",
"name",
"and",
"description",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Command/CacheCommand.php#L32-L37 |
aimeos/aimeos-symfony | Command/CacheCommand.php | CacheCommand.execute | protected function execute( InputInterface $input, OutputInterface $output )
{
$context = $this->getContainer()->get( 'aimeos.context' )->get( false, 'command' );
$context->setEditor( 'aimeos:cache' );
$localeManager = \Aimeos\MShop::create( $context, 'locale' );
foreach( $this->getSiteItems( $context, $input ) as $siteItem )
{
$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
$lcontext = clone $context;
$lcontext->setLocale( $localeItem );
$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
$lcontext->setCache( $cache );
$output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) );
\Aimeos\MAdmin::create( $lcontext, 'cache' )->getCache()->clear();
}
} | php | protected function execute( InputInterface $input, OutputInterface $output )
{
$context = $this->getContainer()->get( 'aimeos.context' )->get( false, 'command' );
$context->setEditor( 'aimeos:cache' );
$localeManager = \Aimeos\MShop::create( $context, 'locale' );
foreach( $this->getSiteItems( $context, $input ) as $siteItem )
{
$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
$lcontext = clone $context;
$lcontext->setLocale( $localeItem );
$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
$lcontext->setCache( $cache );
$output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) );
\Aimeos\MAdmin::create( $lcontext, 'cache' )->getCache()->clear();
}
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'aimeos.context'",
")",
"->",
"get",
"(",
"false"... | Executes the job controllers.
@param InputInterface $input Input object
@param OutputInterface $output Output object | [
"Executes",
"the",
"job",
"controllers",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Command/CacheCommand.php#L46-L67 |
aimeos/aimeos-symfony | Entity/FosUser.php | FosUser.getSalutation | public function getSalutation()
{
return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN );
} | php | public function getSalutation()
{
return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN );
} | [
"public",
"function",
"getSalutation",
"(",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"salutation",
")",
"?",
"(",
"string",
")",
"$",
"this",
"->",
"salutation",
":",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Common",
"\\",
"Item",
"\\",
... | Returns the salutation constant for the person described by the address.
@return string Saluatation constant defined in \Aimeos\MShop\Common\Item\Address\Base | [
"Returns",
"the",
"salutation",
"constant",
"for",
"the",
"person",
"described",
"by",
"the",
"address",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Entity/FosUser.php#L245-L248 |
aimeos/aimeos-symfony | Entity/FosUser.php | FosUser.setSalutation | public function setSalutation($salutation)
{
switch( $salutation )
{
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR:
break;
default:
throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) );
}
$this->salutation = (string) $salutation;
} | php | public function setSalutation($salutation)
{
switch( $salutation )
{
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS:
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR:
break;
default:
throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) );
}
$this->salutation = (string) $salutation;
} | [
"public",
"function",
"setSalutation",
"(",
"$",
"salutation",
")",
"{",
"switch",
"(",
"$",
"salutation",
")",
"{",
"case",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Common",
"\\",
"Item",
"\\",
"Address",
"\\",
"Base",
"::",
"SALUTATION_UNKNOWN",
":",
"case"... | Sets the new salutation for the person described by the address.
@param string $salutation Salutation constant defined in \Aimeos\MShop\Common\Item\Address\Base | [
"Sets",
"the",
"new",
"salutation",
"for",
"the",
"person",
"described",
"by",
"the",
"address",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Entity/FosUser.php#L256-L271 |
aimeos/aimeos-symfony | Entity/FosUser.php | FosUser.setWebsite | public function setWebsite($website)
{
$pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#';
if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) {
throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) );
}
$this->website = (string) $website;
} | php | public function setWebsite($website)
{
$pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#';
if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) {
throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) );
}
$this->website = (string) $website;
} | [
"public",
"function",
"setWebsite",
"(",
"$",
"website",
")",
"{",
"$",
"pattern",
"=",
"'#^([a-z]+://)?[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)+(:[0-9]+)?(/.*)?$#'",
";",
"if",
"(",
"$",
"website",
"!==",
"''",
"&&",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"websi... | Sets a new website URL.
@param string $website New website URL | [
"Sets",
"a",
"new",
"website",
"URL",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Entity/FosUser.php#L576-L585 |
aimeos/aimeos-symfony | Controller/BasketController.php | BasketController.miniComponentAction | public function miniComponentAction()
{
$client = $this->container->get( 'shop' )->get( 'basket/mini' );
$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() );
$response = new Response( (string) $client->getBody() );
$response->headers->set('Cache-Control', 'no-store');
return $response;
} | php | public function miniComponentAction()
{
$client = $this->container->get( 'shop' )->get( 'basket/mini' );
$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() );
$response = new Response( (string) $client->getBody() );
$response->headers->set('Cache-Control', 'no-store');
return $response;
} | [
"public",
"function",
"miniComponentAction",
"(",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'shop'",
")",
"->",
"get",
"(",
"'basket/mini'",
")",
";",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'twig'",
")... | Returns the output of the basket mini component
@return Response Response object containing the generated output | [
"Returns",
"the",
"output",
"of",
"the",
"basket",
"mini",
"component"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Controller/BasketController.php#L51-L59 |
aimeos/aimeos-symfony | Composer/ScriptHandler.php | ScriptHandler.setupDatabase | public static function setupDatabase( Event $event )
{
$options = $env = array();
if( $event->isDevMode() ) {
$options[] = '--option=setup/default/demo:1';
} else {
$env[] = '--env=prod';
}
self::executeCommand( $event, 'aimeos:setup', $options + $env );
self::executeCommand( $event, 'aimeos:cache', $env );
} | php | public static function setupDatabase( Event $event )
{
$options = $env = array();
if( $event->isDevMode() ) {
$options[] = '--option=setup/default/demo:1';
} else {
$env[] = '--env=prod';
}
self::executeCommand( $event, 'aimeos:setup', $options + $env );
self::executeCommand( $event, 'aimeos:cache', $env );
} | [
"public",
"static",
"function",
"setupDatabase",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"options",
"=",
"$",
"env",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"event",
"->",
"isDevMode",
"(",
")",
")",
"{",
"$",
"options",
"[",
"]",
"=",
"'... | Sets up the shop database.
@param Event $event Event instance
@throws \RuntimeException If an error occured | [
"Sets",
"up",
"the",
"shop",
"database",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Composer/ScriptHandler.php#L31-L43 |
aimeos/aimeos-symfony | Composer/ScriptHandler.php | ScriptHandler.updateConfig | public static function updateConfig( Event $event )
{
$event->getIO()->write( 'Ensure existing config and routing for the shop bundle' );
$options = self::getOptions( $event );
if( isset( $options['symfony-app-dir'] ) )
{
self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' );
self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' );
}
} | php | public static function updateConfig( Event $event )
{
$event->getIO()->write( 'Ensure existing config and routing for the shop bundle' );
$options = self::getOptions( $event );
if( isset( $options['symfony-app-dir'] ) )
{
self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' );
self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' );
}
} | [
"public",
"static",
"function",
"updateConfig",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"event",
"->",
"getIO",
"(",
")",
"->",
"write",
"(",
"'Ensure existing config and routing for the shop bundle'",
")",
";",
"$",
"options",
"=",
"self",
"::",
"getOptions"... | Ensure existing config and routing for the shop bundle.
@param Event $event Event instance
@throws \RuntimeException If an error occured | [
"Ensure",
"existing",
"config",
"and",
"routing",
"for",
"the",
"shop",
"bundle",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Composer/ScriptHandler.php#L52-L63 |
aimeos/aimeos-symfony | Composer/ScriptHandler.php | ScriptHandler.installBundle | public static function installBundle( Event $event )
{
$event->getIO()->write( 'Installing the Aimeos shop bundle' );
$options = self::getOptions( $event );
$securedir = 'var';
if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) {
$securedir = $options['symfony-app-dir'];
}
if( isset( $options['symfony-var-dir'] ) && is_dir( $options['symfony-var-dir'] ) ) {
$securedir = $options['symfony-var-dir'];
}
$webdir = ( isset( $options['symfony-web-dir'] ) ? $options['symfony-web-dir'] : 'public' );
self::createDirectory( $securedir . '/secure' );
self::createDirectory( $webdir . '/preview' );
self::createDirectory( $webdir . '/files' );
} | php | public static function installBundle( Event $event )
{
$event->getIO()->write( 'Installing the Aimeos shop bundle' );
$options = self::getOptions( $event );
$securedir = 'var';
if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) {
$securedir = $options['symfony-app-dir'];
}
if( isset( $options['symfony-var-dir'] ) && is_dir( $options['symfony-var-dir'] ) ) {
$securedir = $options['symfony-var-dir'];
}
$webdir = ( isset( $options['symfony-web-dir'] ) ? $options['symfony-web-dir'] : 'public' );
self::createDirectory( $securedir . '/secure' );
self::createDirectory( $webdir . '/preview' );
self::createDirectory( $webdir . '/files' );
} | [
"public",
"static",
"function",
"installBundle",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"event",
"->",
"getIO",
"(",
")",
"->",
"write",
"(",
"'Installing the Aimeos shop bundle'",
")",
";",
"$",
"options",
"=",
"self",
"::",
"getOptions",
"(",
"$",
"e... | Installs the shop bundle.
@param Event $event Event instance
@throws \RuntimeException If an error occured | [
"Installs",
"the",
"shop",
"bundle",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Composer/ScriptHandler.php#L72-L92 |
aimeos/aimeos-symfony | Composer/ScriptHandler.php | ScriptHandler.createDirectory | protected static function createDirectory( $dir )
{
$perm = 0755;
if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) )
{
$msg = 'Unable to create directory "%1$s" with permission "%2$s"';
throw new \RuntimeException( sprintf( $msg, $dir, $perm ) );
}
} | php | protected static function createDirectory( $dir )
{
$perm = 0755;
if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) )
{
$msg = 'Unable to create directory "%1$s" with permission "%2$s"';
throw new \RuntimeException( sprintf( $msg, $dir, $perm ) );
}
} | [
"protected",
"static",
"function",
"createDirectory",
"(",
"$",
"dir",
")",
"{",
"$",
"perm",
"=",
"0755",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
")",
"&&",
"!",
"mkdir",
"(",
"$",
"dir",
",",
"$",
"perm",
",",
"true",
")",
")",
"{",
"... | Creates a new directory if it doesn't exist yet
@param string $dir Absolute path of the new directory
@throws \RuntimeException If directory couldn't be created | [
"Creates",
"a",
"new",
"directory",
"if",
"it",
"doesn",
"t",
"exist",
"yet"
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Composer/ScriptHandler.php#L101-L110 |
aimeos/aimeos-symfony | Composer/ScriptHandler.php | ScriptHandler.executeCommand | protected static function executeCommand( Event $event, $cmd, array $options = array() )
{
$php = escapeshellarg( self::getPhp() );
$console = escapeshellarg( self::getConsoleDir( $event ) . '/console' );
$cmd = escapeshellarg( $cmd );
foreach( $options as $key => $option ) {
$options[$key] = escapeshellarg( $option );
}
if( $event->getIO()->isDecorated() ) {
$console .= ' --ansi';
}
$process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 );
$process->run( function( $type, $buffer ) use ( $event ) {
$event->getIO()->write( $buffer, false );
} );
if( !$process->isSuccessful() ) {
throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) );
}
} | php | protected static function executeCommand( Event $event, $cmd, array $options = array() )
{
$php = escapeshellarg( self::getPhp() );
$console = escapeshellarg( self::getConsoleDir( $event ) . '/console' );
$cmd = escapeshellarg( $cmd );
foreach( $options as $key => $option ) {
$options[$key] = escapeshellarg( $option );
}
if( $event->getIO()->isDecorated() ) {
$console .= ' --ansi';
}
$process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 );
$process->run( function( $type, $buffer ) use ( $event ) {
$event->getIO()->write( $buffer, false );
} );
if( !$process->isSuccessful() ) {
throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) );
}
} | [
"protected",
"static",
"function",
"executeCommand",
"(",
"Event",
"$",
"event",
",",
"$",
"cmd",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"php",
"=",
"escapeshellarg",
"(",
"self",
"::",
"getPhp",
"(",
")",
")",
";",
"$",... | Executes a Symphony command.
@param Event $event Command event object
@param string $cmd Command name to execute, e.g. "aimeos:update"
@param array List of configuration options for the given command
@throws \RuntimeException If the command couldn't be executed | [
"Executes",
"a",
"Symphony",
"command",
"."
] | train | https://github.com/aimeos/aimeos-symfony/blob/ed132ca3d5861043228d270e5c59c7cc4394e61e/Composer/ScriptHandler.php#L121-L144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.