repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
stanislav-web/PhalconSonar
src/Sonar/Services/AppService.php
AppService.run
public function run() { if (PHP_SAPI !== 'cli') { throw new AppServiceException('Warning: Script should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'); } try { $this->socketService->run(); } catch(SocketServiceException $e) { throw new AppServiceException($e->getMessage()); } }
php
public function run() { if (PHP_SAPI !== 'cli') { throw new AppServiceException('Warning: Script should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'); } try { $this->socketService->run(); } catch(SocketServiceException $e) { throw new AppServiceException($e->getMessage()); } }
[ "public", "function", "run", "(", ")", "{", "if", "(", "PHP_SAPI", "!==", "'cli'", ")", "{", "throw", "new", "AppServiceException", "(", "'Warning: Script should be invoked via the CLI version of PHP, not the '", ".", "PHP_SAPI", ".", "' SAPI'", ")", ";", "}", "try"...
Run socket server @throws \Sonar\Exceptions\AppServiceException
[ "Run", "socket", "server" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Services/AppService.php#L52-L66
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Admin/ManageUsersGroups.php
ManageUsersGroups.getRolesFromSite
protected function getRolesFromSite($site) { $newDataSet = new AnyDataset(); $it = $this->user->getRolesIterator($site); while ($it->hasNext()) { $sr = $it->moveNext(); $dataArray = $sr->getFieldArray($this->user->getRolesTable()->Role); if (sizeof($dataArray) > 0) { foreach ($dataArray as $roles) { $siteName = $sr->getField($this->user->getRolesTable()->Site); if ($siteName == "_all") { $siteName = $this->myWords->Value("TEXT_ALLSITES"); } $newDataSet->appendRow(); $newDataSet->addField($this->user->getRolesTable()->Site, $siteName); $newDataSet->addField($this->user->getRolesTable()->Role, $roles); } } } return $newDataSet; }
php
protected function getRolesFromSite($site) { $newDataSet = new AnyDataset(); $it = $this->user->getRolesIterator($site); while ($it->hasNext()) { $sr = $it->moveNext(); $dataArray = $sr->getFieldArray($this->user->getRolesTable()->Role); if (sizeof($dataArray) > 0) { foreach ($dataArray as $roles) { $siteName = $sr->getField($this->user->getRolesTable()->Site); if ($siteName == "_all") { $siteName = $this->myWords->Value("TEXT_ALLSITES"); } $newDataSet->appendRow(); $newDataSet->addField($this->user->getRolesTable()->Site, $siteName); $newDataSet->addField($this->user->getRolesTable()->Role, $roles); } } } return $newDataSet; }
[ "protected", "function", "getRolesFromSite", "(", "$", "site", ")", "{", "$", "newDataSet", "=", "new", "AnyDataset", "(", ")", ";", "$", "it", "=", "$", "this", "->", "user", "->", "getRolesIterator", "(", "$", "site", ")", ";", "while", "(", "$", "...
Get all rules from a site @param string $site @return AnyDataset
[ "Get", "all", "rules", "from", "a", "site" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Admin/ManageUsersGroups.php#L264-L284
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Admin/ManageUsersGroups.php
ManageUsersGroups.AddListLink
protected function AddListLink($block) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("action", ModuleAction::Listing); $link = new XmlAnchorCollection($this->url->getUrl(), ""); $link->addXmlnukeObject(new XmlnukeText($this->myWords->Value("LINK_LISTROLES"))); $para->addXmlnukeObject($link); }
php
protected function AddListLink($block) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("action", ModuleAction::Listing); $link = new XmlAnchorCollection($this->url->getUrl(), ""); $link->addXmlnukeObject(new XmlnukeText($this->myWords->Value("LINK_LISTROLES"))); $para->addXmlnukeObject($link); }
[ "protected", "function", "AddListLink", "(", "$", "block", ")", "{", "$", "para", "=", "new", "XmlParagraphCollection", "(", ")", ";", "$", "this", "->", "_mainBlock", "->", "addXmlnukeObject", "(", "$", "para", ")", ";", "$", "this", "->", "url", "->", ...
Add a go back link to list roles @param XmlBlockCollection $this->_mainBlock
[ "Add", "a", "go", "back", "link", "to", "list", "roles" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Admin/ManageUsersGroups.php#L290-L298
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Admin/ManageUsersGroups.php
ManageUsersGroups.AddEditListToSite
protected function AddEditListToSite($block, $site, $dataset) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("editsite", $site); $editList = new XmlEditList($this->_context, $this->myWords->Value("EDITLIST_TITLE", $site), $this->url->getUrl(), true, false, true, true); $editList->setDataSource($dataset->getIterator()); $listField = new EditListField(); $listField->editlistName = ""; $listField->fieldData = "role"; $editList->addEditListField($listField); $listField = new EditListField(); $listField->editlistName = $this->myWords->Value("EDITLIST_ROLES"); $listField->fieldData = $this->user->getRolesTable()->Role; $editList->addEditListField($listField); $listField = new EditListField(); $listField->editlistName = $this->myWords->Value("EDITLIST_SITES"); $listField->fieldData = $this->user->getRolesTable()->Site; $editList->addEditListField($listField); $para->addXmlnukeObject($editList); }
php
protected function AddEditListToSite($block, $site, $dataset) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("editsite", $site); $editList = new XmlEditList($this->_context, $this->myWords->Value("EDITLIST_TITLE", $site), $this->url->getUrl(), true, false, true, true); $editList->setDataSource($dataset->getIterator()); $listField = new EditListField(); $listField->editlistName = ""; $listField->fieldData = "role"; $editList->addEditListField($listField); $listField = new EditListField(); $listField->editlistName = $this->myWords->Value("EDITLIST_ROLES"); $listField->fieldData = $this->user->getRolesTable()->Role; $editList->addEditListField($listField); $listField = new EditListField(); $listField->editlistName = $this->myWords->Value("EDITLIST_SITES"); $listField->fieldData = $this->user->getRolesTable()->Site; $editList->addEditListField($listField); $para->addXmlnukeObject($editList); }
[ "protected", "function", "AddEditListToSite", "(", "$", "block", ",", "$", "site", ",", "$", "dataset", ")", "{", "$", "para", "=", "new", "XmlParagraphCollection", "(", ")", ";", "$", "this", "->", "_mainBlock", "->", "addXmlnukeObject", "(", "$", "para",...
Add EditList to site @param XmlBlockCollection $this->_mainBlock @param string $site @param AnyDataset $dataset
[ "Add", "EditList", "to", "site" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Admin/ManageUsersGroups.php#L306-L330
train
stanislav-web/PhalconSonar
src/Sonar/Models/Visitor.php
Visitor.setUa
public function setUa($ua) { $this->ua = $this->detector->setUserAgent($ua); // set browser & platform $this->setBrowser(); return $this; }
php
public function setUa($ua) { $this->ua = $this->detector->setUserAgent($ua); // set browser & platform $this->setBrowser(); return $this; }
[ "public", "function", "setUa", "(", "$", "ua", ")", "{", "$", "this", "->", "ua", "=", "$", "this", "->", "detector", "->", "setUserAgent", "(", "$", "ua", ")", ";", "// set browser & platform", "$", "this", "->", "setBrowser", "(", ")", ";", "return",...
Set user agent @param string $ua @return Visitor
[ "Set", "user", "agent" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Models/Visitor.php#L211-L219
train
stanislav-web/PhalconSonar
src/Sonar/Models/Visitor.php
Visitor.setBrowser
private function setBrowser() { $client = parse_user_agent($this->detector->getUserAgent()); $this->browser = $client['browser']; $this->setPlatform($client['platform']); return $this; }
php
private function setBrowser() { $client = parse_user_agent($this->detector->getUserAgent()); $this->browser = $client['browser']; $this->setPlatform($client['platform']); return $this; }
[ "private", "function", "setBrowser", "(", ")", "{", "$", "client", "=", "parse_user_agent", "(", "$", "this", "->", "detector", "->", "getUserAgent", "(", ")", ")", ";", "$", "this", "->", "browser", "=", "$", "client", "[", "'browser'", "]", ";", "$",...
Set user browser @return Visitor
[ "Set", "user", "browser" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Models/Visitor.php#L226-L233
train
stanislav-web/PhalconSonar
src/Sonar/Models/Visitor.php
Visitor.deviceDetect
private function deviceDetect() { $this->mobile = (int)$this->detector->isMobile(); $this->tablet = (int)$this->detector->isTablet(); if ($this->mobile === 0 && $this->tablet === 0) { $this->pc = 1; } return $this; }
php
private function deviceDetect() { $this->mobile = (int)$this->detector->isMobile(); $this->tablet = (int)$this->detector->isTablet(); if ($this->mobile === 0 && $this->tablet === 0) { $this->pc = 1; } return $this; }
[ "private", "function", "deviceDetect", "(", ")", "{", "$", "this", "->", "mobile", "=", "(", "int", ")", "$", "this", "->", "detector", "->", "isMobile", "(", ")", ";", "$", "this", "->", "tablet", "=", "(", "int", ")", "$", "this", "->", "detector...
Detect client device @return Visitor
[ "Detect", "client", "device" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Models/Visitor.php#L266-L276
train
stanislav-web/PhalconSonar
src/Sonar/Models/Visitor.php
Visitor.toArray
public function toArray() { $properties = get_object_vars($this); foreach($properties as $var => &$value) { if(gettype($value) === 'object') { unset($properties[$var]); } } return $properties; }
php
public function toArray() { $properties = get_object_vars($this); foreach($properties as $var => &$value) { if(gettype($value) === 'object') { unset($properties[$var]); } } return $properties; }
[ "public", "function", "toArray", "(", ")", "{", "$", "properties", "=", "get_object_vars", "(", "$", "this", ")", ";", "foreach", "(", "$", "properties", "as", "$", "var", "=>", "&", "$", "value", ")", "{", "if", "(", "gettype", "(", "$", "value", ...
Get properties as array view @return array
[ "Get", "properties", "as", "array", "view" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Models/Visitor.php#L283-L294
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerAccountChartTypeInterface
protected function registerAccountChartTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface', function() { return new \Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\EloquentAccountChartType( new AccountChartType() ); }); }
php
protected function registerAccountChartTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface', function() { return new \Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\EloquentAccountChartType( new AccountChartType() ); }); }
[ "protected", "function", "registerAccountChartTypeInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\System\\Repositories\\AccountChartType\\AccountChartTypeInterface'", ",", "function", "(", ")", "{", "return", "new", "\\...
Register an account chart type interface instance. @return void
[ "Register", "an", "account", "chart", "type", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L187-L193
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerSettingInterface
protected function registerSettingInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); //var_dump($AuthenticationManager->getCurrentUserOrganizationConnection());die(); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\EloquentSetting(new Setting(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerSettingInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); //var_dump($AuthenticationManager->getCurrentUserOrganizationConnection());die(); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\EloquentSetting(new Setting(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerSettingInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Setting\\SettingInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "AuthenticationManager",...
Register a setting interface instance. @return void
[ "Register", "a", "setting", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L226-L236
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerAccountTypeInterface
protected function registerAccountTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\EloquentAccountType(new AccountType(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerAccountTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\EloquentAccountType(new AccountType(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerAccountTypeInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\AccountType\\AccountTypeInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Authenticat...
Register an account type interface instance. @return void
[ "Register", "an", "account", "type", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L257-L265
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerPeriodInterface
protected function registerPeriodInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Period\EloquentPeriod(new Period(), $app['db'], $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerPeriodInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Period\EloquentPeriod(new Period(), $app['db'], $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerPeriodInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Period\\PeriodInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "AuthenticationManager", ...
Register a period interface instance. @return void
[ "Register", "a", "period", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L287-L295
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerFiscalYearInterface
protected function registerFiscalYearInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\EloquentFiscalYear(new FiscalYear(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerFiscalYearInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\EloquentFiscalYear(new FiscalYear(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerFiscalYearInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\FiscalYear\\FiscalYearInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Authentication...
Register a fiscal year interface instance. @return void
[ "Register", "a", "fiscal", "year", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L302-L310
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerAccountInterface
protected function registerAccountInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Account\EloquentAccount(new Account(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerAccountInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Account\EloquentAccount(new Account(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerAccountInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Account\\AccountInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "AuthenticationManager",...
Register an account interface instance. @return void
[ "Register", "an", "account", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L317-L325
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerSystemAccountInterface
protected function registerSystemAccountInterface() { $this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\Account\AccountInterface', function() { return new \Mgallegos\DecimaAccounting\System\Repositories\Account\EloquentAccount( new SystemAccount() ); }); }
php
protected function registerSystemAccountInterface() { $this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\Account\AccountInterface', function() { return new \Mgallegos\DecimaAccounting\System\Repositories\Account\EloquentAccount( new SystemAccount() ); }); }
[ "protected", "function", "registerSystemAccountInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\System\\Repositories\\Account\\AccountInterface'", ",", "function", "(", ")", "{", "return", "new", "\\", "Mgallegos", "...
Register a system account interface instance. @return void
[ "Register", "a", "system", "account", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L332-L338
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerCostCenterInterface
protected function registerCostCenterInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\CostCenterInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\EloquentCostCenter(new CostCenter(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerCostCenterInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\CostCenterInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\EloquentCostCenter(new CostCenter(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerCostCenterInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\CostCenter\\CostCenterInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Authentication...
Register a cost center interface instance. @return void
[ "Register", "a", "cost", "center", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L345-L353
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerDocumentTypeInterface
protected function registerDocumentTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\DocumentType\DocumentTypeInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\DocumentType\EloquentDocumentType(new DocumentType(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerDocumentTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\DocumentType\DocumentTypeInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\DocumentType\EloquentDocumentType(new DocumentType(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerDocumentTypeInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\DocumentType\\DocumentTypeInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Authenti...
Register a document type interface instance. @return void
[ "Register", "a", "document", "type", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L360-L368
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerClientInterface
protected function registerClientInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Client\ClientInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Client\EloquentClient(new Client(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerClientInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Client\ClientInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Client\EloquentClient(new Client(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerClientInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Client\\ClientInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "AuthenticationManager", ...
Register a client interface instance. @return void
[ "Register", "a", "client", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L375-L383
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerSupplierInterface
protected function registerSupplierInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Supplier\SupplierInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Supplier\EloquentSupplier(new Supplier(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerSupplierInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Supplier\SupplierInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Supplier\EloquentSupplier(new Supplier(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerSupplierInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Supplier\\SupplierInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "AuthenticationManage...
Register a supplier interface instance. @return void
[ "Register", "a", "supplier", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L390-L398
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerEmployeeInterface
protected function registerEmployeeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Employee\EmployeeInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Employee\EloquentEmployee(new Employee(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerEmployeeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Employee\EmployeeInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Employee\EloquentEmployee(new Employee(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerEmployeeInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Employee\\EmployeeInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "AuthenticationManage...
Register a employee interface instance. @return void
[ "Register", "a", "employee", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L405-L413
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerApportionmentInterface
protected function registerApportionmentInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Apportionment\ApportionmentInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Apportionment\EloquentApportionment(new Apportionment(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerApportionmentInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Apportionment\ApportionmentInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\Apportionment\EloquentApportionment(new Apportionment(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerApportionmentInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\Apportionment\\ApportionmentInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Authe...
Register a Apportionment interface instance. @return void
[ "Register", "a", "Apportionment", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L420-L428
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerApportionmentEntryInterface
protected function registerApportionmentEntryInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\ApportionmentEntry\ApportionmentEntryInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\ApportionmentEntry\EloquentApportionmentEntry(new ApportionmentEntry(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerApportionmentEntryInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\ApportionmentEntry\ApportionmentEntryInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\ApportionmentEntry\EloquentApportionmentEntry(new ApportionmentEntry(), $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerApportionmentEntryInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\ApportionmentEntry\\ApportionmentEntryInterface'", ",", "function", "(", "$", "app", ")", "{", ...
Register a ApportionmentEntry interface instance. @return void
[ "Register", "a", "ApportionmentEntry", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L435-L443
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerJournalVoucherInterface
protected function registerJournalVoucherInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\JournalVoucherInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\EloquentJournalVoucher(new JournalVoucher(), $app['db'], $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerJournalVoucherInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\JournalVoucherInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\EloquentJournalVoucher(new JournalVoucher(), $app['db'], $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerJournalVoucherInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\JournalVoucher\\JournalVoucherInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Au...
Register a journal voucher interface instance. @return void
[ "Register", "a", "journal", "voucher", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L450-L458
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerJournalEntryInterface
protected function registerJournalEntryInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\JournalEntryInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\EloquentJournalEntry(new JournalEntry(), $app['db'], $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
php
protected function registerJournalEntryInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\JournalEntryInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); return new \Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\EloquentJournalEntry(new JournalEntry(), $app['db'], $AuthenticationManager->getCurrentUserOrganizationConnection()); }); }
[ "protected", "function", "registerJournalEntryInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\JournalEntry\\JournalEntryInterface'", ",", "function", "(", "$", "app", ")", "{", "$", "Authenti...
Register a journal entry interface instance. @return void
[ "Register", "a", "journal", "entry", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L465-L473
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerSettingManagementInterface
protected function registerSettingManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\SettingManagement\SettingManagementInterface', function($app) { return new SettingManager( $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface'), $app->make('App\Kwaai\System\Repositories\Currency\CurrencyInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\AccountType\AccountTypeInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\Account\AccountInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\VoucherType\VoucherTypeInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\VoucherType\VoucherTypeInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\CostCenterInterface'), $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), $app['db'], $app['translator'], $app['config'] ); }); }
php
protected function registerSettingManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\SettingManagement\SettingManagementInterface', function($app) { return new SettingManager( $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface'), $app->make('App\Kwaai\System\Repositories\Currency\CurrencyInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\AccountType\AccountTypeInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\Account\AccountInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\VoucherType\VoucherTypeInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\VoucherType\VoucherTypeInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\CostCenterInterface'), $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), $app['db'], $app['translator'], $app['config'] ); }); }
[ "protected", "function", "registerSettingManagementInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Services\\SettingManagement\\SettingManagementInterface'", ",", "function", "(", "$", "app", ")", "{", "retu...
Register a setting management interface instance. @return void
[ "Register", "a", "setting", "management", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L480-L505
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerPeriodManagementInterface
protected function registerPeriodManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\PeriodManagement\PeriodManagementInterface', function($app) { return new PeriodManager( $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), new \Mgallegos\LaravelJqgrid\Encoders\JqGridJsonEncoder($app->make('excel')), new \Mgallegos\DecimaAccounting\Accounting\Repositories\Period\EloquentPeriodGridRepository( $app['db'], $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app['translator'] ), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\JournalVoucherInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface'), new Carbon(), $app['db'], $app['translator'], $app['config'] ); }); }
php
protected function registerPeriodManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\PeriodManagement\PeriodManagementInterface', function($app) { return new PeriodManager( $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), new \Mgallegos\LaravelJqgrid\Encoders\JqGridJsonEncoder($app->make('excel')), new \Mgallegos\DecimaAccounting\Accounting\Repositories\Period\EloquentPeriodGridRepository( $app['db'], $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app['translator'] ), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\JournalVoucherInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface'), new Carbon(), $app['db'], $app['translator'], $app['config'] ); }); }
[ "protected", "function", "registerPeriodManagementInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Services\\PeriodManagement\\PeriodManagementInterface'", ",", "function", "(", "$", "app", ")", "{", "return"...
Register a period management interface instance. @return void
[ "Register", "a", "period", "management", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L571-L595
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php
DecimaAccountingServiceProvider.registerFiscalYearManagementInterface
protected function registerFiscalYearManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\FiscalYearManagement\FiscalYearManagementInterface', function($app) { return new FiscalYearManager( $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), new \Mgallegos\LaravelJqgrid\Encoders\JqGridJsonEncoder($app->make('excel')), new \Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\EloquentFiscalYearGridRepository( $app['db'], $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app['translator'] ), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\JournalEntryInterface'), new Carbon(), $app['db'], $app['translator'], $app['config'] ); }); }
php
protected function registerFiscalYearManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\FiscalYearManagement\FiscalYearManagementInterface', function($app) { return new FiscalYearManager( $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), new \Mgallegos\LaravelJqgrid\Encoders\JqGridJsonEncoder($app->make('excel')), new \Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\EloquentFiscalYearGridRepository( $app['db'], $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app['translator'] ), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\JournalEntryInterface'), new Carbon(), $app['db'], $app['translator'], $app['config'] ); }); }
[ "protected", "function", "registerFiscalYearManagementInterface", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "'Mgallegos\\DecimaAccounting\\Accounting\\Services\\FiscalYearManagement\\FiscalYearManagementInterface'", ",", "function", "(", "$", "app", ")", "{"...
Register a Fiscal Year management interface instance. @return void
[ "Register", "a", "Fiscal", "Year", "management", "interface", "instance", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/DecimaAccountingServiceProvider.php#L713-L736
train
honeybee/trellis
src/Runtime/EntityType.php
EntityType.getRoot
public function getRoot() { $next_parent = $this->getParent(); $parent = null; while ($next_parent) { $parent = $next_parent; $next_parent = $parent->getParent(); } return $parent ? $parent : $this; }
php
public function getRoot() { $next_parent = $this->getParent(); $parent = null; while ($next_parent) { $parent = $next_parent; $next_parent = $parent->getParent(); } return $parent ? $parent : $this; }
[ "public", "function", "getRoot", "(", ")", "{", "$", "next_parent", "=", "$", "this", "->", "getParent", "(", ")", ";", "$", "parent", "=", "null", ";", "while", "(", "$", "next_parent", ")", "{", "$", "parent", "=", "$", "next_parent", ";", "$", "...
Returns the type's root-parent, if it has one. @return EntityTypeInterface
[ "Returns", "the", "type", "s", "root", "-", "parent", "if", "it", "has", "one", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/EntityType.php#L111-L121
train
honeybee/trellis
src/Runtime/EntityType.php
EntityType.getAttributes
public function getAttributes(array $attribute_names = [], array $types = []) { $attribute_map = []; if (empty($attribute_names)) { $attribute_map = $this->attribute_map->getItems(); } else { foreach ($attribute_names as $attribute_name) { $attribute_map[$attribute_name] = $this->getAttribute($attribute_name); } } if (!empty($types)) { $attribute_map = array_filter( $attribute_map, function ($attribute) use ($types) { return in_array(get_class($attribute), $types); } ); } return new AttributeMap($attribute_map); }
php
public function getAttributes(array $attribute_names = [], array $types = []) { $attribute_map = []; if (empty($attribute_names)) { $attribute_map = $this->attribute_map->getItems(); } else { foreach ($attribute_names as $attribute_name) { $attribute_map[$attribute_name] = $this->getAttribute($attribute_name); } } if (!empty($types)) { $attribute_map = array_filter( $attribute_map, function ($attribute) use ($types) { return in_array(get_class($attribute), $types); } ); } return new AttributeMap($attribute_map); }
[ "public", "function", "getAttributes", "(", "array", "$", "attribute_names", "=", "[", "]", ",", "array", "$", "types", "=", "[", "]", ")", "{", "$", "attribute_map", "=", "[", "]", ";", "if", "(", "empty", "(", "$", "attribute_names", ")", ")", "{",...
Returns the type's attribute collection. @param array $attribute_names A list of attribute_names to filter for. @return AttributeMap
[ "Returns", "the", "type", "s", "attribute", "collection", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/EntityType.php#L178-L200
train
honeybee/trellis
src/Runtime/EntityType.php
EntityType.getAttribute
public function getAttribute($name) { if (mb_strpos($name, '.')) { return $this->getAttributeByPath($name); } if ($this->attribute_map->hasKey($name)) { return $this->attribute_map->getItem($name); } else { throw new RuntimeException('Type has no attribute: ' . $name); } }
php
public function getAttribute($name) { if (mb_strpos($name, '.')) { return $this->getAttributeByPath($name); } if ($this->attribute_map->hasKey($name)) { return $this->attribute_map->getItem($name); } else { throw new RuntimeException('Type has no attribute: ' . $name); } }
[ "public", "function", "getAttribute", "(", "$", "name", ")", "{", "if", "(", "mb_strpos", "(", "$", "name", ",", "'.'", ")", ")", "{", "return", "$", "this", "->", "getAttributeByPath", "(", "$", "name", ")", ";", "}", "if", "(", "$", "this", "->",...
Returns a certain type attribute by name. @param string $name @return AttributeInterface @throws RuntimeException
[ "Returns", "a", "certain", "type", "attribute", "by", "name", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/EntityType.php#L224-L235
train
honeybee/trellis
src/Runtime/EntityType.php
EntityType.createEntity
public function createEntity(array $data = [], EntityInterface $parent_entity = null, $apply_default_values = false) { $implementor = $this->getEntityImplementor(); if (!class_exists($implementor, true)) { throw new InvalidTypeException( "Unable to resolve the given entity implementor '$implementor' upon entity creation request." ); } return new $implementor($this, $data, $parent_entity, $apply_default_values); }
php
public function createEntity(array $data = [], EntityInterface $parent_entity = null, $apply_default_values = false) { $implementor = $this->getEntityImplementor(); if (!class_exists($implementor, true)) { throw new InvalidTypeException( "Unable to resolve the given entity implementor '$implementor' upon entity creation request." ); } return new $implementor($this, $data, $parent_entity, $apply_default_values); }
[ "public", "function", "createEntity", "(", "array", "$", "data", "=", "[", "]", ",", "EntityInterface", "$", "parent_entity", "=", "null", ",", "$", "apply_default_values", "=", "false", ")", "{", "$", "implementor", "=", "$", "this", "->", "getEntityImpleme...
Creates a new EntityInterface instance. @param array $data Optional data for initial hydration. @param EntityInterface $parent_entity @param boolean $apply_default_values @return EntityInterface @throws InvalidTypeException
[ "Creates", "a", "new", "EntityInterface", "instance", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/EntityType.php#L292-L303
train
anklimsk/cakephp-theme
Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/RedisHandler.php
RedisHandler.writeCapped
protected function writeCapped(array $record) { if ($this->redisClient instanceof \Redis) { $this->redisClient->multi() ->rpush($this->redisKey, $record["formatted"]) ->ltrim($this->redisKey, -$this->capSize, -1) ->exec(); } else { $redisKey = $this->redisKey; $capSize = $this->capSize; $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { $tx->rpush($redisKey, $record["formatted"]); $tx->ltrim($redisKey, -$capSize, -1); }); } }
php
protected function writeCapped(array $record) { if ($this->redisClient instanceof \Redis) { $this->redisClient->multi() ->rpush($this->redisKey, $record["formatted"]) ->ltrim($this->redisKey, -$this->capSize, -1) ->exec(); } else { $redisKey = $this->redisKey; $capSize = $this->capSize; $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { $tx->rpush($redisKey, $record["formatted"]); $tx->ltrim($redisKey, -$capSize, -1); }); } }
[ "protected", "function", "writeCapped", "(", "array", "$", "record", ")", "{", "if", "(", "$", "this", "->", "redisClient", "instanceof", "\\", "Redis", ")", "{", "$", "this", "->", "redisClient", "->", "multi", "(", ")", "->", "rpush", "(", "$", "this...
Write and cap the collection Writes the record to the redis list and caps its @param array $record associative record array @return void
[ "Write", "and", "cap", "the", "collection", "Writes", "the", "record", "to", "the", "redis", "list", "and", "caps", "its" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/RedisHandler.php#L73-L88
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Services/GameCurrencyService.php
GameCurrencyService.sendBill
public function sendBill($bill, callable $onSuccess, callable $onFailure) { // return if the bill is not defined by creating one. if ($bill === false) { return; } $currencyEntry = new CurrencyEntry(); $currencyEntry->setBill($bill); $currencyEntry->setSuccessCallback($onSuccess); $currencyEntry->setFailureCallback($onFailure); $this->currencyPlugin->sendBill($currencyEntry); }
php
public function sendBill($bill, callable $onSuccess, callable $onFailure) { // return if the bill is not defined by creating one. if ($bill === false) { return; } $currencyEntry = new CurrencyEntry(); $currencyEntry->setBill($bill); $currencyEntry->setSuccessCallback($onSuccess); $currencyEntry->setFailureCallback($onFailure); $this->currencyPlugin->sendBill($currencyEntry); }
[ "public", "function", "sendBill", "(", "$", "bill", ",", "callable", "$", "onSuccess", ",", "callable", "$", "onFailure", ")", "{", "// return if the bill is not defined by creating one.", "if", "(", "$", "bill", "===", "false", ")", "{", "return", ";", "}", "...
Send bill to login Server needs to have in-game currency for sending a bill. @param mixed $bill @param callable $onSuccess @param callable $onFailure @return void
[ "Send", "bill", "to", "login", "Server", "needs", "to", "have", "in", "-", "game", "currency", "for", "sending", "a", "bill", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Services/GameCurrencyService.php#L68-L81
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Services/GameCurrencyService.php
GameCurrencyService.createBill
public function createBill($login, $amount, $receiver, $message) { $currencyEntry = new Gamecurrency(); $currencyEntry->setAmount($amount); $currencyEntry->setSenderlogin($login); $currencyEntry->setReceiverlogin($receiver); $currencyEntry->setMessage($message); $currencyEntry->setDatetime(new \DateTime()); try { $currencyEntry->save(); return $currencyEntry; } catch (\Exception $e) { $this->logger->error("Error while creating bill", ["exception" => $e]); $this->console->write('$f00 Fail.', true); return false; } }
php
public function createBill($login, $amount, $receiver, $message) { $currencyEntry = new Gamecurrency(); $currencyEntry->setAmount($amount); $currencyEntry->setSenderlogin($login); $currencyEntry->setReceiverlogin($receiver); $currencyEntry->setMessage($message); $currencyEntry->setDatetime(new \DateTime()); try { $currencyEntry->save(); return $currencyEntry; } catch (\Exception $e) { $this->logger->error("Error while creating bill", ["exception" => $e]); $this->console->write('$f00 Fail.', true); return false; } }
[ "public", "function", "createBill", "(", "$", "login", ",", "$", "amount", ",", "$", "receiver", ",", "$", "message", ")", "{", "$", "currencyEntry", "=", "new", "Gamecurrency", "(", ")", ";", "$", "currencyEntry", "->", "setAmount", "(", "$", "amount", ...
Create a bill for sending it forward @param $login @param $amount @param $receiver @param $message @return Gamecurrency|bool
[ "Create", "a", "bill", "for", "sending", "it", "forward" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Services/GameCurrencyService.php#L92-L111
train
TheBnl/event-tickets
code/forms/ReservationForm.php
ReservationForm.goToNextStep
public function goToNextStep(array $data, ReservationForm $form) { $reservation = $form->getReservation(); foreach ($data['Attendee'] as $attendeeID => $attendeeData) { /** @var Attendee $attendee */ $attendee = Attendee::get()->byID($attendeeID); // populate the attendees foreach ($attendeeData as $field => $value) { if (is_int($field)) { $attendee->Fields()->add($field, array('Value' => $value)); } else { $attendee->setField($field, $value); } } $attendee->write(); // Set the main contact if (isset($attendeeData['Main']) && (bool)$attendeeData['Main']) { $reservation->setMainContact($attendeeID); } } // add the tax modifier $reservation->PriceModifiers()->add(TaxModifier::findOrMake($reservation)); $reservation->calculateTotal(); $reservation->write(); $this->extend('beforeNextStep', $data, $form); return $this->nextStep(); }
php
public function goToNextStep(array $data, ReservationForm $form) { $reservation = $form->getReservation(); foreach ($data['Attendee'] as $attendeeID => $attendeeData) { /** @var Attendee $attendee */ $attendee = Attendee::get()->byID($attendeeID); // populate the attendees foreach ($attendeeData as $field => $value) { if (is_int($field)) { $attendee->Fields()->add($field, array('Value' => $value)); } else { $attendee->setField($field, $value); } } $attendee->write(); // Set the main contact if (isset($attendeeData['Main']) && (bool)$attendeeData['Main']) { $reservation->setMainContact($attendeeID); } } // add the tax modifier $reservation->PriceModifiers()->add(TaxModifier::findOrMake($reservation)); $reservation->calculateTotal(); $reservation->write(); $this->extend('beforeNextStep', $data, $form); return $this->nextStep(); }
[ "public", "function", "goToNextStep", "(", "array", "$", "data", ",", "ReservationForm", "$", "form", ")", "{", "$", "reservation", "=", "$", "form", "->", "getReservation", "(", ")", ";", "foreach", "(", "$", "data", "[", "'Attendee'", "]", "as", "$", ...
Finish the registration and continue to checkout @param array $data @param ReservationForm $form @return \SS_HTTPResponse
[ "Finish", "the", "registration", "and", "continue", "to", "checkout" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/forms/ReservationForm.php#L81-L112
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/OAuthClient/v20/BaseOAuth20.php
BaseOAuth20.validateRequest
function validateRequest($result) { $statusCodes = array( "200" => "", "304" => "Not Modified", "400" => "Bad Request", "401" => "Unauthorized: Authentication credentials were missing or incorrect", "403" => "Forbidden: The request is understood, but it has been refused", "404" => "Not Found", "406" => "Not Acceptable", "420" => "Enhance Your Calm", "500" => "Internal Server Error", "502" => "Bad Gateway", "503" => "Service Unavailable" ); if (array_key_exists($this->lastStatusCode(), $statusCodes)) return $this->lastStatusCode() . " " . $statusCodes[$this->lastStatusCode()]; else { return $this->lastStatusCode() . " Unknow"; } }
php
function validateRequest($result) { $statusCodes = array( "200" => "", "304" => "Not Modified", "400" => "Bad Request", "401" => "Unauthorized: Authentication credentials were missing or incorrect", "403" => "Forbidden: The request is understood, but it has been refused", "404" => "Not Found", "406" => "Not Acceptable", "420" => "Enhance Your Calm", "500" => "Internal Server Error", "502" => "Bad Gateway", "503" => "Service Unavailable" ); if (array_key_exists($this->lastStatusCode(), $statusCodes)) return $this->lastStatusCode() . " " . $statusCodes[$this->lastStatusCode()]; else { return $this->lastStatusCode() . " Unknow"; } }
[ "function", "validateRequest", "(", "$", "result", ")", "{", "$", "statusCodes", "=", "array", "(", "\"200\"", "=>", "\"\"", ",", "\"304\"", "=>", "\"Not Modified\"", ",", "\"400\"", "=>", "\"Bad Request\"", ",", "\"401\"", "=>", "\"Unauthorized: Authentication cr...
It is a good idea to implement this also
[ "It", "is", "a", "good", "idea", "to", "implement", "this", "also" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/OAuthClient/v20/BaseOAuth20.php#L41-L62
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Menu/Model/Menu/ParentItem.php
ParentItem.addChild
public function addChild($class, $id, $label, $permission, $options =[]) { if (is_string($id)) { $id = explode('/', $id); } if (count($id) == 1) { if (isset($this->childItems[$id[0]])) { return $this->childItems[$id[0]]; } $item = $this->itemBuilder->create( $class, $id[0], $this->getPath() . '/' . $id[0], $label, $permission, $options ); $this->childItems[$id[0]] = $item; return $item; } $parent = array_splice($id, 0, count($id) - 1); return $this->getChild($parent)->addChild($class, $id, $label, $permission, $options); }
php
public function addChild($class, $id, $label, $permission, $options =[]) { if (is_string($id)) { $id = explode('/', $id); } if (count($id) == 1) { if (isset($this->childItems[$id[0]])) { return $this->childItems[$id[0]]; } $item = $this->itemBuilder->create( $class, $id[0], $this->getPath() . '/' . $id[0], $label, $permission, $options ); $this->childItems[$id[0]] = $item; return $item; } $parent = array_splice($id, 0, count($id) - 1); return $this->getChild($parent)->addChild($class, $id, $label, $permission, $options); }
[ "public", "function", "addChild", "(", "$", "class", ",", "$", "id", ",", "$", "label", ",", "$", "permission", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_string", "(", "$", "id", ")", ")", "{", "$", "id", "=", "explode", "(",...
Add a new child element to the parent node. @param string $class Class of the item. @param string $id Id of the item @param string $label @param string $permission @param array $options @return ItemInterface
[ "Add", "a", "new", "child", "element", "to", "the", "parent", "node", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Menu/Model/Menu/ParentItem.php#L73-L98
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Menu/Model/Menu/ParentItem.php
ParentItem.getChild
public function getChild($path) { if (is_string($path)) { $path = explode('/', $path); } $remaining = array_splice($path, 1, count($path) - 1); foreach ($this->childItems as $childItem) { if ($childItem->getId() == $path[0]) { if (empty($remaining)) { return $childItem; } elseif ($childItem instanceof ParentItem) { return $childItem->getChild($remaining); } else { return null; } } } return null; }
php
public function getChild($path) { if (is_string($path)) { $path = explode('/', $path); } $remaining = array_splice($path, 1, count($path) - 1); foreach ($this->childItems as $childItem) { if ($childItem->getId() == $path[0]) { if (empty($remaining)) { return $childItem; } elseif ($childItem instanceof ParentItem) { return $childItem->getChild($remaining); } else { return null; } } } return null; }
[ "public", "function", "getChild", "(", "$", "path", ")", "{", "if", "(", "is_string", "(", "$", "path", ")", ")", "{", "$", "path", "=", "explode", "(", "'/'", ",", "$", "path", ")", ";", "}", "$", "remaining", "=", "array_splice", "(", "$", "pat...
Get child element from path py searching recursiveley. @param $path @return ItemInterface|null
[ "Get", "child", "element", "from", "path", "py", "searching", "recursiveley", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Menu/Model/Menu/ParentItem.php#L107-L127
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Menu/Model/Menu/ParentItem.php
ParentItem.isVisibleFor
public function isVisibleFor($login) { $personalVisibility = parent::isVisibleFor($login); if (!$personalVisibility) { return $personalVisibility; } foreach ($this->getChilds() as $childItem) { if ($childItem->isVisibleFor($login)) { return true; } } return false; }
php
public function isVisibleFor($login) { $personalVisibility = parent::isVisibleFor($login); if (!$personalVisibility) { return $personalVisibility; } foreach ($this->getChilds() as $childItem) { if ($childItem->isVisibleFor($login)) { return true; } } return false; }
[ "public", "function", "isVisibleFor", "(", "$", "login", ")", "{", "$", "personalVisibility", "=", "parent", "::", "isVisibleFor", "(", "$", "login", ")", ";", "if", "(", "!", "$", "personalVisibility", ")", "{", "return", "$", "personalVisibility", ";", "...
Check if menu is visible and at least one children is visible. @param string $login @return bool|mixed
[ "Check", "if", "menu", "is", "visible", "and", "at", "least", "one", "children", "is", "visible", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Menu/Model/Menu/ParentItem.php#L146-L161
train
ansas/php-component
src/Component/Convert/Ean.php
Ean.hasValidLength
public static function hasValidLength($value) { // Sanitize $value = (int) $value; $length = strlen($value); // Validate return !($length < 9 || $length > 13); }
php
public static function hasValidLength($value) { // Sanitize $value = (int) $value; $length = strlen($value); // Validate return !($length < 9 || $length > 13); }
[ "public", "static", "function", "hasValidLength", "(", "$", "value", ")", "{", "// Sanitize", "$", "value", "=", "(", "int", ")", "$", "value", ";", "$", "length", "=", "strlen", "(", "$", "value", ")", ";", "// Validate", "return", "!", "(", "$", "l...
Check if length of given ean makes sense. @param string|int $value ean, upc or isbn13 @return bool
[ "Check", "if", "length", "of", "given", "ean", "makes", "sense", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Convert/Ean.php#L158-L166
train
ansas/php-component
src/Component/Convert/Ean.php
Ean.toIsbn10
public static function toIsbn10($ean, $onError = null) { // Sanitize $ean = preg_replace('/[^0-9]/', '', $ean); // Validate if (!preg_match('/^978(\d{9})\d?$/', $ean, $found)) { return $onError; } // Convert $isbn = $found[1]; $isbn = static::withCheckDigitForIsbn10($isbn); return $isbn ?: $onError; }
php
public static function toIsbn10($ean, $onError = null) { // Sanitize $ean = preg_replace('/[^0-9]/', '', $ean); // Validate if (!preg_match('/^978(\d{9})\d?$/', $ean, $found)) { return $onError; } // Convert $isbn = $found[1]; $isbn = static::withCheckDigitForIsbn10($isbn); return $isbn ?: $onError; }
[ "public", "static", "function", "toIsbn10", "(", "$", "ean", ",", "$", "onError", "=", "null", ")", "{", "// Sanitize", "$", "ean", "=", "preg_replace", "(", "'/[^0-9]/'", ",", "''", ",", "$", "ean", ")", ";", "// Validate", "if", "(", "!", "preg_match...
Convert isbn13 to isbn10. @param string $ean isbn13 @param mixed $onError [optional] string to return if value is not specified type. @return mixed
[ "Convert", "isbn13", "to", "isbn10", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Convert/Ean.php#L176-L191
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/Bricks/Convertor.php
Convertor.prepareRules
public function prepareRules() { switch (self::baseClassName($this->input)) { case 'FakturaVydana': case 'Banka': switch (self::baseClassName($this->output)) { case 'FakturaVydana': // Banka['typPohybuK' => 'typPohybu.prijem'] -> FakturaVydana['typDokl' => 'ZDD'] // $this->output->setDataValue('firma', \FlexiPeeHP\FlexiBeeRO::code( $this->input->getDataValue('firma'))); $this->rules = array_combine($this->commonItems(), $this->commonItems()); unset($this->rules['stavUhrK']); unset($this->rules['datUcto']); unset($this->rules['datUcto']); foreach (array_keys($this->output->getData()) as $colname) { unset($this->rules[$colname]); } if ($this->input->getDataValue('typDokl') != $this->output->getDataValue('typDokl')) { unset($this->rules['rada']); } foreach ($this->rules as $rule) { if (preg_match('/^sum/', $rule)) { unset($this->rules[$rule]); } } $polozkyDokladu = new \FlexiPeeHP\FakturaVydanaPolozka(); $itemColnames = array_keys($polozkyDokladu->getColumnsInfo()); $this->rules['polozkyFaktury'] = self::removeRoColumns(array_combine($itemColnames, $itemColnames), $polozkyDokladu); break; default : throw new \Ease\Exception(sprintf(_('Unsupported Source document type %s'), get_class($this->output))); break; } break; default: throw new \Ease\Exception(sprintf(_('Unsupported Source document type %s'), get_class($this->input))); break; } }
php
public function prepareRules() { switch (self::baseClassName($this->input)) { case 'FakturaVydana': case 'Banka': switch (self::baseClassName($this->output)) { case 'FakturaVydana': // Banka['typPohybuK' => 'typPohybu.prijem'] -> FakturaVydana['typDokl' => 'ZDD'] // $this->output->setDataValue('firma', \FlexiPeeHP\FlexiBeeRO::code( $this->input->getDataValue('firma'))); $this->rules = array_combine($this->commonItems(), $this->commonItems()); unset($this->rules['stavUhrK']); unset($this->rules['datUcto']); unset($this->rules['datUcto']); foreach (array_keys($this->output->getData()) as $colname) { unset($this->rules[$colname]); } if ($this->input->getDataValue('typDokl') != $this->output->getDataValue('typDokl')) { unset($this->rules['rada']); } foreach ($this->rules as $rule) { if (preg_match('/^sum/', $rule)) { unset($this->rules[$rule]); } } $polozkyDokladu = new \FlexiPeeHP\FakturaVydanaPolozka(); $itemColnames = array_keys($polozkyDokladu->getColumnsInfo()); $this->rules['polozkyFaktury'] = self::removeRoColumns(array_combine($itemColnames, $itemColnames), $polozkyDokladu); break; default : throw new \Ease\Exception(sprintf(_('Unsupported Source document type %s'), get_class($this->output))); break; } break; default: throw new \Ease\Exception(sprintf(_('Unsupported Source document type %s'), get_class($this->input))); break; } }
[ "public", "function", "prepareRules", "(", ")", "{", "switch", "(", "self", "::", "baseClassName", "(", "$", "this", "->", "input", ")", ")", "{", "case", "'FakturaVydana'", ":", "case", "'Banka'", ":", "switch", "(", "self", "::", "baseClassName", "(", ...
Prepare conversion rules @throws \Ease\Exception
[ "Prepare", "conversion", "rules" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/Convertor.php#L109-L156
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/Bricks/Convertor.php
Convertor.convertDocument
public function convertDocument($keepId = false, $addExtId = false, $keepCode = false, $handleAccountig = false) { if ($handleAccountig === false) { unset($this->rules['ucetni']); } $this->convertItems($keepId, $addExtId, $keepCode, $handleAccountig); }
php
public function convertDocument($keepId = false, $addExtId = false, $keepCode = false, $handleAccountig = false) { if ($handleAccountig === false) { unset($this->rules['ucetni']); } $this->convertItems($keepId, $addExtId, $keepCode, $handleAccountig); }
[ "public", "function", "convertDocument", "(", "$", "keepId", "=", "false", ",", "$", "addExtId", "=", "false", ",", "$", "keepCode", "=", "false", ",", "$", "handleAccountig", "=", "false", ")", "{", "if", "(", "$", "handleAccountig", "===", "false", ")"...
Convert FlexiBee document @param boolean $keepId keep item IDs @param boolean $addExtId add ext:originalEvidence:originalId @param boolean $keepCode keep items code @param boolean $handleAccounting set item's "ucetni" like target
[ "Convert", "FlexiBee", "document" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/Convertor.php#L166-L173
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/Bricks/Convertor.php
Convertor.convertSubitems
public function convertSubitems($columnToTake, $keepId = false, $keepCode = false, $keepAccountig = false) { $subitemRules = $this->rules[$columnToTake]; if (self::isAssoc($this->input->data[$columnToTake])) { $sourceData = [$this->input->data[$columnToTake]]; } else { $sourceData = $this->input->getDataValue($columnToTake); } $typUcOp = $this->input->getDataValue('typUcOp'); foreach ($sourceData as $subItemData) { foreach (array_keys($subItemData) as $subitemColumn) { if (!array_key_exists($subitemColumn, $subitemRules)) { unset($subItemData[$subitemColumn]); } } if ($keepAccountig && array_key_exists('ucetni', $subItemData) && array_key_exists('ucetni', $this->output->getData())) { $subItemData['ucetni'] = $this->output->getDataValue('ucetni'); } else { unset($subItemData['ucetni']); } if ($typUcOp) { $subItemData['typUcOp'] = $typUcOp; } else { unset($subItemData['typUcOp']); } if ($keepCode === false) { unset($subItemData['kod']); } if ($keepId === false) { unset($subItemData['id']); unset($subItemData['external-ids']); } $this->output->addArrayToBranch($subItemData); } }
php
public function convertSubitems($columnToTake, $keepId = false, $keepCode = false, $keepAccountig = false) { $subitemRules = $this->rules[$columnToTake]; if (self::isAssoc($this->input->data[$columnToTake])) { $sourceData = [$this->input->data[$columnToTake]]; } else { $sourceData = $this->input->getDataValue($columnToTake); } $typUcOp = $this->input->getDataValue('typUcOp'); foreach ($sourceData as $subItemData) { foreach (array_keys($subItemData) as $subitemColumn) { if (!array_key_exists($subitemColumn, $subitemRules)) { unset($subItemData[$subitemColumn]); } } if ($keepAccountig && array_key_exists('ucetni', $subItemData) && array_key_exists('ucetni', $this->output->getData())) { $subItemData['ucetni'] = $this->output->getDataValue('ucetni'); } else { unset($subItemData['ucetni']); } if ($typUcOp) { $subItemData['typUcOp'] = $typUcOp; } else { unset($subItemData['typUcOp']); } if ($keepCode === false) { unset($subItemData['kod']); } if ($keepId === false) { unset($subItemData['id']); unset($subItemData['external-ids']); } $this->output->addArrayToBranch($subItemData); } }
[ "public", "function", "convertSubitems", "(", "$", "columnToTake", ",", "$", "keepId", "=", "false", ",", "$", "keepCode", "=", "false", ",", "$", "keepAccountig", "=", "false", ")", "{", "$", "subitemRules", "=", "$", "this", "->", "rules", "[", "$", ...
Convert FlexiBee documnet's subitems @param string $columnToTake usually "polozkyDokladu" @param boolean $keepId keep item IDs @param boolean $keepCode keep items code @param boolean $keepAccounting set item's "ucetni" like target
[ "Convert", "FlexiBee", "documnet", "s", "subitems" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/Convertor.php#L183-L224
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/Bricks/Convertor.php
Convertor.convertItems
public function convertItems($keepId = false, $addExtId = true, $keepCode = false, $handleAccounting = false) { if ($keepCode === false) { unset($this->rules['kod']); } if ($keepId === false) { unset($this->rules['id']); } foreach (self::removeRoColumns($this->rules, $this->output) as $columnToTake => $subitemColumns) { if (is_array($subitemColumns)) { if (!empty($this->input->getSubItems())) { $this->convertSubitems($columnToTake, $keepId, $keepCode,$handleAccounting); } } else { $this->output->setDataValue($columnToTake, $this->input->getDataValue($columnToTake)); } } if ($addExtId) { $this->output->setDataValue('id', 'ext:src:'.$this->input->getEvidence().':'.$this->input->getMyKey()); } }
php
public function convertItems($keepId = false, $addExtId = true, $keepCode = false, $handleAccounting = false) { if ($keepCode === false) { unset($this->rules['kod']); } if ($keepId === false) { unset($this->rules['id']); } foreach (self::removeRoColumns($this->rules, $this->output) as $columnToTake => $subitemColumns) { if (is_array($subitemColumns)) { if (!empty($this->input->getSubItems())) { $this->convertSubitems($columnToTake, $keepId, $keepCode,$handleAccounting); } } else { $this->output->setDataValue($columnToTake, $this->input->getDataValue($columnToTake)); } } if ($addExtId) { $this->output->setDataValue('id', 'ext:src:'.$this->input->getEvidence().':'.$this->input->getMyKey()); } }
[ "public", "function", "convertItems", "(", "$", "keepId", "=", "false", ",", "$", "addExtId", "=", "true", ",", "$", "keepCode", "=", "false", ",", "$", "handleAccounting", "=", "false", ")", "{", "if", "(", "$", "keepCode", "===", "false", ")", "{", ...
Convert document items @param boolean $keepId Keep original document ID @param boolean $addExtId Add ExtID pointer to original document @param boolean $keepCode Keep original document Code @param boolean $handleAccounting set item's "ucetni" like target
[ "Convert", "document", "items" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/Convertor.php#L234-L257
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/Bricks/Convertor.php
Convertor.removeRoColumns
public static function removeRoColumns(array $rules, $engine) { foreach ($rules as $index => $subrules) { if (is_array($subrules)) { $eback = $engine->getEvidence(); $engine->setEvidence($engine->getEvidence().'-polozka'); $rules[$index] = self::removeRoColumns($subrules, $engine); $engine->setEvidence($eback); } else { $columnInfo = $engine->getColumnInfo($subrules); if ($columnInfo['isWritable'] == 'false') { unset($rules[$index]); } } } return $rules; }
php
public static function removeRoColumns(array $rules, $engine) { foreach ($rules as $index => $subrules) { if (is_array($subrules)) { $eback = $engine->getEvidence(); $engine->setEvidence($engine->getEvidence().'-polozka'); $rules[$index] = self::removeRoColumns($subrules, $engine); $engine->setEvidence($eback); } else { $columnInfo = $engine->getColumnInfo($subrules); if ($columnInfo['isWritable'] == 'false') { unset($rules[$index]); } } } return $rules; }
[ "public", "static", "function", "removeRoColumns", "(", "array", "$", "rules", ",", "$", "engine", ")", "{", "foreach", "(", "$", "rules", "as", "$", "index", "=>", "$", "subrules", ")", "{", "if", "(", "is_array", "(", "$", "subrules", ")", ")", "{"...
Returns only writable columns @param array $rules all Columns @param \FlexiPeeHP\FlexiBeeRW $engine saver class
[ "Returns", "only", "writable", "columns" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/Convertor.php#L265-L281
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/Bricks/Convertor.php
Convertor.commonItems
public function commonItems() { return array_intersect(array_keys($this->input->getColumnsInfo()), array_keys($this->output->getColumnsInfo())); }
php
public function commonItems() { return array_intersect(array_keys($this->input->getColumnsInfo()), array_keys($this->output->getColumnsInfo())); }
[ "public", "function", "commonItems", "(", ")", "{", "return", "array_intersect", "(", "array_keys", "(", "$", "this", "->", "input", "->", "getColumnsInfo", "(", ")", ")", ",", "array_keys", "(", "$", "this", "->", "output", "->", "getColumnsInfo", "(", ")...
Return itemes that same on both sides @return array
[ "Return", "itemes", "that", "same", "on", "both", "sides" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/Convertor.php#L288-L292
train
BenGorUser/UserBundle
src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/CommandBuilder.php
CommandBuilder.doBuild
protected function doBuild($user, $isApi = false) { $this->register($user, $isApi); $this->container->setAlias( $this->alias($user, $isApi), $this->definition($user, $isApi) ); return $this->container; }
php
protected function doBuild($user, $isApi = false) { $this->register($user, $isApi); $this->container->setAlias( $this->alias($user, $isApi), $this->definition($user, $isApi) ); return $this->container; }
[ "protected", "function", "doBuild", "(", "$", "user", ",", "$", "isApi", "=", "false", ")", "{", "$", "this", "->", "register", "(", "$", "user", ",", "$", "isApi", ")", ";", "$", "this", "->", "container", "->", "setAlias", "(", "$", "this", "->",...
Wraps the service registration and the alias addtion. @param string $user The user name @param bool $isApi Flag that tells if it is api version or not @return ContainerBuilder
[ "Wraps", "the", "service", "registration", "and", "the", "alias", "addtion", "." ]
a6d0173496c269a6c80e1319d42eaed4b3bbbd4a
https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/CommandBuilder.php#L125-L135
train
byrokrat/autogiro
src/Visitor/VisitorFactory.php
VisitorFactory.createVisitors
final public function createVisitors(int $flags = 0): VisitorInterface { $flag = function (int $needle) use ($flags) { return ($needle & $flags) == $needle; }; $errorObj = new ErrorObject; $container = new VisitorContainer($errorObj); if (!$flag(self::VISITOR_IGNORE_BASIC_VALIDATION)) { $container->addVisitor(new NumberVisitor($errorObj)); $container->addVisitor(new TextVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_MESSAGES)) { $container->addVisitor(new MessageVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_DATES)) { $container->addVisitor(new DateVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_ACCOUNTS)) { $container->addVisitor( new AccountVisitor( $errorObj, new DelegatingFactory(new AccountFactory, new BankgiroFactory), new BankgiroFactory ) ); } if (!$flag(self::VISITOR_IGNORE_AMOUNTS)) { $container->addVisitor(new AmountVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_IDS)) { $container->addVisitor( new StateIdVisitor( $errorObj, new OrganizationIdFactory, new PersonalIdFactory(new CoordinationIdFactory(new NullIdFactory)) ) ); } if (!$flag(self::VISITOR_IGNORE_STRICT_VALIDATION)) { $container->addVisitor(new PaymentVisitor($errorObj)); $container->addVisitor(new PayeeVisitor($errorObj)); $container->addVisitor(new CountingVisitor($errorObj)); $container->addVisitor(new SummaryVisitor($errorObj)); } return $container; }
php
final public function createVisitors(int $flags = 0): VisitorInterface { $flag = function (int $needle) use ($flags) { return ($needle & $flags) == $needle; }; $errorObj = new ErrorObject; $container = new VisitorContainer($errorObj); if (!$flag(self::VISITOR_IGNORE_BASIC_VALIDATION)) { $container->addVisitor(new NumberVisitor($errorObj)); $container->addVisitor(new TextVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_MESSAGES)) { $container->addVisitor(new MessageVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_DATES)) { $container->addVisitor(new DateVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_ACCOUNTS)) { $container->addVisitor( new AccountVisitor( $errorObj, new DelegatingFactory(new AccountFactory, new BankgiroFactory), new BankgiroFactory ) ); } if (!$flag(self::VISITOR_IGNORE_AMOUNTS)) { $container->addVisitor(new AmountVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_IDS)) { $container->addVisitor( new StateIdVisitor( $errorObj, new OrganizationIdFactory, new PersonalIdFactory(new CoordinationIdFactory(new NullIdFactory)) ) ); } if (!$flag(self::VISITOR_IGNORE_STRICT_VALIDATION)) { $container->addVisitor(new PaymentVisitor($errorObj)); $container->addVisitor(new PayeeVisitor($errorObj)); $container->addVisitor(new CountingVisitor($errorObj)); $container->addVisitor(new SummaryVisitor($errorObj)); } return $container; }
[ "final", "public", "function", "createVisitors", "(", "int", "$", "flags", "=", "0", ")", ":", "VisitorInterface", "{", "$", "flag", "=", "function", "(", "int", "$", "needle", ")", "use", "(", "$", "flags", ")", "{", "return", "(", "$", "needle", "&...
Create the standard set of visitors used when processing a parse tree
[ "Create", "the", "standard", "set", "of", "visitors", "used", "when", "processing", "a", "parse", "tree" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Visitor/VisitorFactory.php#L92-L146
train
melisplatform/melis-installer
etc/MelisDemoCms/src/MelisDemoCms/Controller/NewsController.php
NewsController.listAction
public function listAction() { // Getting the Site config "MelisDemoCms.config.php" $siteConfig = $this->getServiceLocator()->get('config'); $siteConfig = $siteConfig['site']['MelisDemoCms']; $siteDatas = $siteConfig['datas']; /** * Listing News using MelisCmsNewsListNewsPlugin */ $listNewsPluginView = $this->MelisCmsNewsListNewsPlugin(); $listNewsParameters = array( 'template_path' => 'MelisDemoCms/plugin/news-list', 'pageId' => $this->idPage, 'pageIdNews' => $siteDatas['news_details_page_id'], 'pagination' => array( 'nbPerPage' => 6 ), 'filter' => array( 'column' => 'cnews_publish_date', 'order' => 'DESC', 'unpublish_filter' => true, 'site_id' => $siteDatas['site_id'], ) ); // add generated view to children views for displaying it in the contact view $this->view->addChild($listNewsPluginView->render($listNewsParameters), 'listNews'); $this->view->setVariable('renderMode', $this->renderMode); $this->view->setVariable('idPage', $this->idPage); return $this->view; }
php
public function listAction() { // Getting the Site config "MelisDemoCms.config.php" $siteConfig = $this->getServiceLocator()->get('config'); $siteConfig = $siteConfig['site']['MelisDemoCms']; $siteDatas = $siteConfig['datas']; /** * Listing News using MelisCmsNewsListNewsPlugin */ $listNewsPluginView = $this->MelisCmsNewsListNewsPlugin(); $listNewsParameters = array( 'template_path' => 'MelisDemoCms/plugin/news-list', 'pageId' => $this->idPage, 'pageIdNews' => $siteDatas['news_details_page_id'], 'pagination' => array( 'nbPerPage' => 6 ), 'filter' => array( 'column' => 'cnews_publish_date', 'order' => 'DESC', 'unpublish_filter' => true, 'site_id' => $siteDatas['site_id'], ) ); // add generated view to children views for displaying it in the contact view $this->view->addChild($listNewsPluginView->render($listNewsParameters), 'listNews'); $this->view->setVariable('renderMode', $this->renderMode); $this->view->setVariable('idPage', $this->idPage); return $this->view; }
[ "public", "function", "listAction", "(", ")", "{", "// Getting the Site config \"MelisDemoCms.config.php\"", "$", "siteConfig", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get", "(", "'config'", ")", ";", "$", "siteConfig", "=", "$", "siteConfig"...
This method will render the list of news @return \Zend\View\Model\ViewModel
[ "This", "method", "will", "render", "the", "list", "of", "news" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/etc/MelisDemoCms/src/MelisDemoCms/Controller/NewsController.php#L21-L53
train
melisplatform/melis-installer
etc/MelisDemoCms/src/MelisDemoCms/Controller/NewsController.php
NewsController.detailsAction
public function detailsAction() { // Getting the Site config "MelisDemoCms.config.php" $siteConfig = $this->getServiceLocator()->get('config'); $siteConfig = $siteConfig['site']['MelisDemoCms']; $siteDatas = $siteConfig['datas']; $dateMax = date("Y-m-d H:i:s", strtotime("now")); $listNewsPluginView = $this->MelisCmsNewsShowNewsPlugin(); $listNewsParameters = array( 'id' => 'newsDetails', 'template_path' => 'MelisDemoCms/plugin/news-details', ); // add generated view to children views for displaying it in the contact view $this->view->addChild($listNewsPluginView->render($listNewsParameters), 'newsDetails'); /** * Generating Homepage Latest News slider using MelisCmsNewsLatestNewsPlugin Plugin */ $latestNewsPluginView = $this->MelisCmsNewsLatestNewsPlugin(); $latestNewsParameters = array( 'template_path' => 'MelisDemoCms/plugin/latest-news', 'pageIdNews' => $siteDatas['news_details_page_id'], 'filter' => array( 'column' => 'cnews_publish_date', 'order' => 'DESC', 'limit' => 10, 'unpublish_filter' => true, 'date_max' => null, 'site_id' => $siteDatas['site_id'], ) ); // add generated view to children views for displaying it in the contact view $this->view->addChild($latestNewsPluginView->render($latestNewsParameters), 'latestNews'); $this->view->setVariable('renderMode', $this->renderMode); $this->view->setVariable('idPage', $this->idPage); return $this->view; }
php
public function detailsAction() { // Getting the Site config "MelisDemoCms.config.php" $siteConfig = $this->getServiceLocator()->get('config'); $siteConfig = $siteConfig['site']['MelisDemoCms']; $siteDatas = $siteConfig['datas']; $dateMax = date("Y-m-d H:i:s", strtotime("now")); $listNewsPluginView = $this->MelisCmsNewsShowNewsPlugin(); $listNewsParameters = array( 'id' => 'newsDetails', 'template_path' => 'MelisDemoCms/plugin/news-details', ); // add generated view to children views for displaying it in the contact view $this->view->addChild($listNewsPluginView->render($listNewsParameters), 'newsDetails'); /** * Generating Homepage Latest News slider using MelisCmsNewsLatestNewsPlugin Plugin */ $latestNewsPluginView = $this->MelisCmsNewsLatestNewsPlugin(); $latestNewsParameters = array( 'template_path' => 'MelisDemoCms/plugin/latest-news', 'pageIdNews' => $siteDatas['news_details_page_id'], 'filter' => array( 'column' => 'cnews_publish_date', 'order' => 'DESC', 'limit' => 10, 'unpublish_filter' => true, 'date_max' => null, 'site_id' => $siteDatas['site_id'], ) ); // add generated view to children views for displaying it in the contact view $this->view->addChild($latestNewsPluginView->render($latestNewsParameters), 'latestNews'); $this->view->setVariable('renderMode', $this->renderMode); $this->view->setVariable('idPage', $this->idPage); return $this->view; }
[ "public", "function", "detailsAction", "(", ")", "{", "// Getting the Site config \"MelisDemoCms.config.php\"", "$", "siteConfig", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get", "(", "'config'", ")", ";", "$", "siteConfig", "=", "$", "siteConf...
This methos will render the Details of a single News @return \Zend\View\Model\ViewModel
[ "This", "methos", "will", "render", "the", "Details", "of", "a", "single", "News" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/etc/MelisDemoCms/src/MelisDemoCms/Controller/NewsController.php#L60-L99
train
pauci/cqrs
src/Plugin/Doctrine/Domain/RemoveDeletedAggregatesListener.php
RemoveDeletedAggregatesListener.preFlush
public function preFlush(PreFlushEventArgs $event) { $entityManager = $event->getEntityManager(); $uow = $entityManager->getUnitOfWork(); foreach ($uow->getIdentityMap() as $class => $entities) { foreach ($entities as $entity) { if ($entity instanceof DeletableInterface) { if ($entity->isDeleted()) { $entityManager->remove($entity); } } } } }
php
public function preFlush(PreFlushEventArgs $event) { $entityManager = $event->getEntityManager(); $uow = $entityManager->getUnitOfWork(); foreach ($uow->getIdentityMap() as $class => $entities) { foreach ($entities as $entity) { if ($entity instanceof DeletableInterface) { if ($entity->isDeleted()) { $entityManager->remove($entity); } } } } }
[ "public", "function", "preFlush", "(", "PreFlushEventArgs", "$", "event", ")", "{", "$", "entityManager", "=", "$", "event", "->", "getEntityManager", "(", ")", ";", "$", "uow", "=", "$", "entityManager", "->", "getUnitOfWork", "(", ")", ";", "foreach", "(...
Remove entities marked as deleted @param PreFlushEventArgs $event
[ "Remove", "entities", "marked", "as", "deleted" ]
951f2a3118b5f7d93b1e173952490f4a15b8f3fb
https://github.com/pauci/cqrs/blob/951f2a3118b5f7d93b1e173952490f4a15b8f3fb/src/Plugin/Doctrine/Domain/RemoveDeletedAggregatesListener.php#L30-L44
train
orkestra/OrkestraPdfBundle
OrkestraPdfBundle.php
OrkestraPdfBundle.initializeTcpdf
private function initializeTcpdf() { if (defined('K_TCPDF_EXTERNAL_CONFIG')) { return; } define('K_TCPDF_EXTERNAL_CONFIG', true); /** * Installation path (/var/www/tcpdf/). */ define('K_PATH_MAIN', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.root_dir'))); /** * URL path to tcpdf installation folder (http://localhost/tcpdf/). * * TODO: This should probably be some public path */ define('K_PATH_URL', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.root_dir'))); /** * path for PDF fonts * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts */ define('K_PATH_FONTS', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.fonts_dir'))); /** * cache directory for temporary files (full path) */ define('K_PATH_CACHE', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.cache_dir'))); /** * cache directory for temporary files (url path) */ define('K_PATH_URL_CACHE', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.cache_dir'))); /** *images directory */ define('K_PATH_IMAGES', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.image_dir'))); /** * blank image */ define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png'); /** * height of cell respect font height */ define('K_CELL_HEIGHT_RATIO', 1.25); /** * reduction factor for small font */ define('K_SMALL_RATIO', 2/3); /** * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language */ define('K_THAI_TOPCHARS', true); /** * if true allows to call TCPDF methods using HTML syntax * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. */ define('K_TCPDF_CALLS_IN_HTML', false); }
php
private function initializeTcpdf() { if (defined('K_TCPDF_EXTERNAL_CONFIG')) { return; } define('K_TCPDF_EXTERNAL_CONFIG', true); /** * Installation path (/var/www/tcpdf/). */ define('K_PATH_MAIN', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.root_dir'))); /** * URL path to tcpdf installation folder (http://localhost/tcpdf/). * * TODO: This should probably be some public path */ define('K_PATH_URL', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.root_dir'))); /** * path for PDF fonts * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts */ define('K_PATH_FONTS', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.fonts_dir'))); /** * cache directory for temporary files (full path) */ define('K_PATH_CACHE', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.cache_dir'))); /** * cache directory for temporary files (url path) */ define('K_PATH_URL_CACHE', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.cache_dir'))); /** *images directory */ define('K_PATH_IMAGES', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.image_dir'))); /** * blank image */ define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png'); /** * height of cell respect font height */ define('K_CELL_HEIGHT_RATIO', 1.25); /** * reduction factor for small font */ define('K_SMALL_RATIO', 2/3); /** * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language */ define('K_THAI_TOPCHARS', true); /** * if true allows to call TCPDF methods using HTML syntax * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. */ define('K_TCPDF_CALLS_IN_HTML', false); }
[ "private", "function", "initializeTcpdf", "(", ")", "{", "if", "(", "defined", "(", "'K_TCPDF_EXTERNAL_CONFIG'", ")", ")", "{", "return", ";", "}", "define", "(", "'K_TCPDF_EXTERNAL_CONFIG'", ",", "true", ")", ";", "/**\n * Installation path (/var/www/tcpdf/)....
Replicates the tcpdf_config.php file
[ "Replicates", "the", "tcpdf_config", ".", "php", "file" ]
45979a93b662e81787116f26b53362911878c685
https://github.com/orkestra/OrkestraPdfBundle/blob/45979a93b662e81787116f26b53362911878c685/OrkestraPdfBundle.php#L29-L94
train
Celarius/spin-framework
src/Database/Drivers/Pdo/Mysql.php
MySql.getDsn
public function getDsn(): string { /* MYSQL: $connection = new \PDO('mysql:host=localhost;port=3306;dbname=test', $user, $pass, array( \PDO::ATTR_PERSISTENT => true \PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, \PDO::ATTR_AUTOCOMMIT => FALSE, \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" // Set UTF8 as charset ) ); */ # Build the DSN $_dsn = $this->getDriver().':'. 'host='.$this->getHost().($this->getPort()!=0 ? ';port='.$this->getPort() : '' ). ';dbname='.$this->getSchema(). ';charset='.$this->getCharset(); # Set it $this->setDsn($_dsn); return $_dsn; }
php
public function getDsn(): string { /* MYSQL: $connection = new \PDO('mysql:host=localhost;port=3306;dbname=test', $user, $pass, array( \PDO::ATTR_PERSISTENT => true \PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, \PDO::ATTR_AUTOCOMMIT => FALSE, \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" // Set UTF8 as charset ) ); */ # Build the DSN $_dsn = $this->getDriver().':'. 'host='.$this->getHost().($this->getPort()!=0 ? ';port='.$this->getPort() : '' ). ';dbname='.$this->getSchema(). ';charset='.$this->getCharset(); # Set it $this->setDsn($_dsn); return $_dsn; }
[ "public", "function", "getDsn", "(", ")", ":", "string", "{", "/*\nMYSQL:\n $connection = new \\PDO('mysql:host=localhost;port=3306;dbname=test', $user, $pass,\n array(\n \\PDO::ATTR_PERSISTENT => true\n \\PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,\n \\PDO::ATTR_AUTOCOMMIT => FA...
Get DSN - MySql formatting @return string [description]
[ "Get", "DSN", "-", "MySql", "formatting" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Database/Drivers/Pdo/Mysql.php#L46-L69
train
mridang/pearify
src/Pearify/Utils/ClassFinder.php
ClassFinder.isAfterOpeningBracket
private function isAfterOpeningBracket(FoundClass $c) { for ($k = $c->from; $k >= 0; $k--) { if (is_string($this->file->tokens[$k]) && $this->file->tokens[$k] === '{' ) { return true; } } return false; }
php
private function isAfterOpeningBracket(FoundClass $c) { for ($k = $c->from; $k >= 0; $k--) { if (is_string($this->file->tokens[$k]) && $this->file->tokens[$k] === '{' ) { return true; } } return false; }
[ "private", "function", "isAfterOpeningBracket", "(", "FoundClass", "$", "c", ")", "{", "for", "(", "$", "k", "=", "$", "c", "->", "from", ";", "$", "k", ">=", "0", ";", "$", "k", "--", ")", "{", "if", "(", "is_string", "(", "$", "this", "->", "...
Returns if given token is after a opening bracket @param FoundClass $c @return bool
[ "Returns", "if", "given", "token", "is", "after", "a", "opening", "bracket" ]
7bc0710beb4165164e07f88b456de47cad8b3002
https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/Utils/ClassFinder.php#L122-L132
train
ElijahGM/October-jwt
src/JWT.php
JWT.checkProvider
public function checkProvider($provider) { if (($prv = $this->payload()->get('prv')) === null) { return true; } return $this->hashProvider($provider) === $prv; }
php
public function checkProvider($provider) { if (($prv = $this->payload()->get('prv')) === null) { return true; } return $this->hashProvider($provider) === $prv; }
[ "public", "function", "checkProvider", "(", "$", "provider", ")", "{", "if", "(", "(", "$", "prv", "=", "$", "this", "->", "payload", "(", ")", "->", "get", "(", "'prv'", ")", ")", "===", "null", ")", "{", "return", "true", ";", "}", "return", "$...
Check if the provider matches the one saved in the token. @param string|object $provider @return bool
[ "Check", "if", "the", "provider", "matches", "the", "one", "saved", "in", "the", "token", "." ]
ab1c0749ae3d6953fe4dab278baf4ea7d874b36f
https://github.com/ElijahGM/October-jwt/blob/ab1c0749ae3d6953fe4dab278baf4ea7d874b36f/src/JWT.php#L280-L287
train
ansas/php-component
src/Twig/Extension/AntiSpam.php
AntiSpam._encodeEntities
public function _encodeEntities($string) { $string = mb_convert_encoding($string, 'UTF-32', 'UTF-8'); $t = unpack("N*", $string); $t = array_map(function ($n) { return "&#$n;"; }, $t); return implode("", $t); }
php
public function _encodeEntities($string) { $string = mb_convert_encoding($string, 'UTF-32', 'UTF-8'); $t = unpack("N*", $string); $t = array_map(function ($n) { return "&#$n;"; }, $t); return implode("", $t); }
[ "public", "function", "_encodeEntities", "(", "$", "string", ")", "{", "$", "string", "=", "mb_convert_encoding", "(", "$", "string", ",", "'UTF-32'", ",", "'UTF-8'", ")", ";", "$", "t", "=", "unpack", "(", "\"N*\"", ",", "$", "string", ")", ";", "$", ...
Returns a string converted to html entities. @see http://goo.gl/LPhtJ @param string $string Value to be encoded @return string
[ "Returns", "a", "string", "converted", "to", "html", "entities", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Twig/Extension/AntiSpam.php#L45-L55
train
smartboxgroup/core-bundle
Hydrator/GroupVersionHydrator.php
GroupVersionHydrator.hydrateArray
private function hydrateArray($array, $group, $version) { foreach ($array as $key => $value) { $this->hydrate($value, $group, $version); } return $array; }
php
private function hydrateArray($array, $group, $version) { foreach ($array as $key => $value) { $this->hydrate($value, $group, $version); } return $array; }
[ "private", "function", "hydrateArray", "(", "$", "array", ",", "$", "group", ",", "$", "version", ")", "{", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "hydrate", "(", "$", "value", ",", "$", "...
Hydrate an array. @param array $array @param string $group @param string $version @return array
[ "Hydrate", "an", "array", "." ]
88ffc0af6631efbea90425454ce0bce0c753504e
https://github.com/smartboxgroup/core-bundle/blob/88ffc0af6631efbea90425454ce0bce0c753504e/Hydrator/GroupVersionHydrator.php#L61-L68
train
smartboxgroup/core-bundle
Hydrator/GroupVersionHydrator.php
GroupVersionHydrator.hydrateEntity
private function hydrateEntity(EntityInterface $entity, $group, $version) { $entity->setEntityGroup($group); $entity->setAPIVersion($version); // hydrate all the sub-fields recursively using JMS to extract them and identify their type $metadata = $this->metadataFactory->getMetadataForClass(\get_class($entity)); /** @var PropertyMetadata $property */ foreach ($metadata->propertyMetadata as $property) { if ('array' === $property->type['name']) { $array = $property->getValue($entity); if (\is_array($array) && \count($array) > 0) { $first = \array_values($array)[0]; if ((\is_object($first) || \is_array($first))) { $this->hydrateArray($array, $group, $version); } } } elseif (($object = $property->getValue($entity)) instanceof EntityInterface) { $this->hydrateEntity($object, $group, $version); } } return $entity; }
php
private function hydrateEntity(EntityInterface $entity, $group, $version) { $entity->setEntityGroup($group); $entity->setAPIVersion($version); // hydrate all the sub-fields recursively using JMS to extract them and identify their type $metadata = $this->metadataFactory->getMetadataForClass(\get_class($entity)); /** @var PropertyMetadata $property */ foreach ($metadata->propertyMetadata as $property) { if ('array' === $property->type['name']) { $array = $property->getValue($entity); if (\is_array($array) && \count($array) > 0) { $first = \array_values($array)[0]; if ((\is_object($first) || \is_array($first))) { $this->hydrateArray($array, $group, $version); } } } elseif (($object = $property->getValue($entity)) instanceof EntityInterface) { $this->hydrateEntity($object, $group, $version); } } return $entity; }
[ "private", "function", "hydrateEntity", "(", "EntityInterface", "$", "entity", ",", "$", "group", ",", "$", "version", ")", "{", "$", "entity", "->", "setEntityGroup", "(", "$", "group", ")", ";", "$", "entity", "->", "setAPIVersion", "(", "$", "version", ...
Hydrate an entity. @param EntityInterface $entity @param string $group @param string $version @return EntityInterface
[ "Hydrate", "an", "entity", "." ]
88ffc0af6631efbea90425454ce0bce0c753504e
https://github.com/smartboxgroup/core-bundle/blob/88ffc0af6631efbea90425454ce0bce0c753504e/Hydrator/GroupVersionHydrator.php#L79-L103
train
Due/php-ecom-sdk
lib/APIRequests.php
APIRequests.request
public static function request( $arg_endpoint, $arg_method, array $arg_data = array(), array $arg_headers = array() ) { $return = array(); $headers = array( 'Accept: application/json', 'DUE-API-KEY: '.Due::getApiKey(), 'DUE-PLATFORM-ID: '.Due::getPlatformId(), ); if($arg_method == APIRequests::METHOD_PUT){ $headers[]= 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'; } $headers = array_merge($headers, $arg_headers); $full_url = Due::getRootPath().$arg_endpoint; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $full_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $arg_method); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); if(!empty($arg_data)){ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arg_data)); } $response = curl_exec($ch); $err = curl_error($ch); if (!$err) { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $headers = substr($response, 0, $header_size); $body = substr($response, $header_size); $return['headers'] = self::headersToArray($headers); $return['body'] = json_decode($body, true); if(!empty($return['body']['errors'][0])){ $api_error = $return['body']['errors'][0]; $message = (empty($api_error['message']) ? '' : $api_error['message']); $code = (empty($api_error['code']) ? 0 : $api_error['code']); throw new \Exception($message,$code); } }else{ throw new \Exception($err); } return $return; }
php
public static function request( $arg_endpoint, $arg_method, array $arg_data = array(), array $arg_headers = array() ) { $return = array(); $headers = array( 'Accept: application/json', 'DUE-API-KEY: '.Due::getApiKey(), 'DUE-PLATFORM-ID: '.Due::getPlatformId(), ); if($arg_method == APIRequests::METHOD_PUT){ $headers[]= 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'; } $headers = array_merge($headers, $arg_headers); $full_url = Due::getRootPath().$arg_endpoint; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $full_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $arg_method); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); if(!empty($arg_data)){ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arg_data)); } $response = curl_exec($ch); $err = curl_error($ch); if (!$err) { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $headers = substr($response, 0, $header_size); $body = substr($response, $header_size); $return['headers'] = self::headersToArray($headers); $return['body'] = json_decode($body, true); if(!empty($return['body']['errors'][0])){ $api_error = $return['body']['errors'][0]; $message = (empty($api_error['message']) ? '' : $api_error['message']); $code = (empty($api_error['code']) ? 0 : $api_error['code']); throw new \Exception($message,$code); } }else{ throw new \Exception($err); } return $return; }
[ "public", "static", "function", "request", "(", "$", "arg_endpoint", ",", "$", "arg_method", ",", "array", "$", "arg_data", "=", "array", "(", ")", ",", "array", "$", "arg_headers", "=", "array", "(", ")", ")", "{", "$", "return", "=", "array", "(", ...
Due API Request @param string $arg_endpoint @param string $arg_method @param array $arg_data @param array $arg_headers @return array @throws \Exception
[ "Due", "API", "Request" ]
4c2e4040469bb159e62461363ec133b6faf0a7ae
https://github.com/Due/php-ecom-sdk/blob/4c2e4040469bb159e62461363ec133b6faf0a7ae/lib/APIRequests.php#L29-L76
train
Due/php-ecom-sdk
lib/APIRequests.php
APIRequests.headersToArray
public static function headersToArray($header_text) { $headers = array(); foreach (explode("\r\n", $header_text) as $i => $line) if ($i === 0) $headers['http_code'] = $line; else { if(!empty($line) && strpos($line, ':') !== false){ list ($key, $value) = explode(': ', $line); $headers['headers'][] = array( 'key' => $key, 'value' => $value, ); } } return $headers; }
php
public static function headersToArray($header_text) { $headers = array(); foreach (explode("\r\n", $header_text) as $i => $line) if ($i === 0) $headers['http_code'] = $line; else { if(!empty($line) && strpos($line, ':') !== false){ list ($key, $value) = explode(': ', $line); $headers['headers'][] = array( 'key' => $key, 'value' => $value, ); } } return $headers; }
[ "public", "static", "function", "headersToArray", "(", "$", "header_text", ")", "{", "$", "headers", "=", "array", "(", ")", ";", "foreach", "(", "explode", "(", "\"\\r\\n\"", ",", "$", "header_text", ")", "as", "$", "i", "=>", "$", "line", ")", "if", ...
Convert Header data to array @param string $header_text @return array
[ "Convert", "Header", "data", "to", "array" ]
4c2e4040469bb159e62461363ec133b6faf0a7ae
https://github.com/Due/php-ecom-sdk/blob/4c2e4040469bb159e62461363ec133b6faf0a7ae/lib/APIRequests.php#L84-L105
train
Celarius/spin-framework
src/Application.php
Application.loadFactory
protected function loadFactory(?array $params=[]) { if (\is_array($params) && !empty($params['class']) && \class_exists($params['class'])) { $factory = new $params['class']($params['options'] ?? []); $this->getLogger()->debug('Factory created',[ 'factory'=>$factory ]); return $factory; } else { $this->getLogger()->error('Factory not found',[ 'params'=>$params ]); } return null; }
php
protected function loadFactory(?array $params=[]) { if (\is_array($params) && !empty($params['class']) && \class_exists($params['class'])) { $factory = new $params['class']($params['options'] ?? []); $this->getLogger()->debug('Factory created',[ 'factory'=>$factory ]); return $factory; } else { $this->getLogger()->error('Factory not found',[ 'params'=>$params ]); } return null; }
[ "protected", "function", "loadFactory", "(", "?", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "\\", "is_array", "(", "$", "params", ")", "&&", "!", "empty", "(", "$", "params", "[", "'class'", "]", ")", "&&", "\\", "class_exists", "...
Loads a Factory class @param string $params The params found in the config file under the factory @throws Exception @return object | null
[ "Loads", "a", "Factory", "class" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Application.php#L556-L573
train
Celarius/spin-framework
src/Application.php
Application.setCookie
public function setCookie(string $name, string $value=null, int $expire=0, string $path='', string $domain='', bool $secure=false, bool $httpOnly=false) { if ( \array_key_exists($name,$this->cookies) && \is_null($value) ) { # Remove the Cookie $this->cookies = \array_diff_key($this->cookies,[$name=>'']); } else { # Set the Cookie $this->cookies[$name] = [ 'name' => $name, 'value' => $value, 'expire' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httpOnly' => $httpOnly ]; } return true; }
php
public function setCookie(string $name, string $value=null, int $expire=0, string $path='', string $domain='', bool $secure=false, bool $httpOnly=false) { if ( \array_key_exists($name,$this->cookies) && \is_null($value) ) { # Remove the Cookie $this->cookies = \array_diff_key($this->cookies,[$name=>'']); } else { # Set the Cookie $this->cookies[$name] = [ 'name' => $name, 'value' => $value, 'expire' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httpOnly' => $httpOnly ]; } return true; }
[ "public", "function", "setCookie", "(", "string", "$", "name", ",", "string", "$", "value", "=", "null", ",", "int", "$", "expire", "=", "0", ",", "string", "$", "path", "=", "''", ",", "string", "$", "domain", "=", "''", ",", "bool", "$", "secure"...
Set a cookie for the next response @param string $name [description] @param string|null $value [description] @param int|integer $expire [description] @param string $path [description] @param string $domain [description] @param bool|boolean $secure [description] @param bool|boolean $httpOnly [description] @return mixed
[ "Set", "a", "cookie", "for", "the", "next", "response" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Application.php#L709-L728
train
Celarius/spin-framework
src/Application.php
Application.sendResponse
public function sendResponse() { # Set HTTP Response Code \http_response_code($this->getResponse()->getStatusCode()); # Set All HTTP headers from Response Object foreach ($this->getResponse()->getHeaders() as $header => $value) { if (\is_array($value)) { $values = \implode(';',$value); } else { $values = $value; } \header($header.': '.$values); } # Remove the "x-powered-by" header set by PHP if (\function_exists('header_remove')) \header_remove('x-powered-by'); # Set Cookies foreach ($this->cookies as $cookie) { \setCookie( $cookie['name'], $cookie['value'], $cookie['expire'] ?? 0, $cookie['path'] ?? '', $cookie['domain'] ?? '', $cookie['secure'] ?? false, $cookie['httponly'] ?? false ); } ## ## Send a file or a body? ## if ( !empty($this->responseFile) ) { if (\file_exists($this->responseFile)) { # Debug log $this->getLogger()->debug('Sending file',[ 'code'=>$this->getResponse()->getStatusCode(), 'headers'=>$this->getResponse()->getHeaders(), 'file'=>$this->responseFile ]); # Send the file \readfile($this->responseFile); } else { # Log warning $this->getLogger()->warning('File not found',['file'=>$this->responseFile]); # Fake a response \response('',404); # Set HTTP Response Code \http_response_code(404); } } else { # Get body $body = (string)$this->response->getBody(); # Debug log $this->getLogger()->debug('Sending body',[ 'code' => $this->getResponse()->getStatusCode(), 'headers' => $this->getResponse()->getHeaders(), 'size' => \strlen($body) ]); # Send the Body echo $body; } return $this; }
php
public function sendResponse() { # Set HTTP Response Code \http_response_code($this->getResponse()->getStatusCode()); # Set All HTTP headers from Response Object foreach ($this->getResponse()->getHeaders() as $header => $value) { if (\is_array($value)) { $values = \implode(';',$value); } else { $values = $value; } \header($header.': '.$values); } # Remove the "x-powered-by" header set by PHP if (\function_exists('header_remove')) \header_remove('x-powered-by'); # Set Cookies foreach ($this->cookies as $cookie) { \setCookie( $cookie['name'], $cookie['value'], $cookie['expire'] ?? 0, $cookie['path'] ?? '', $cookie['domain'] ?? '', $cookie['secure'] ?? false, $cookie['httponly'] ?? false ); } ## ## Send a file or a body? ## if ( !empty($this->responseFile) ) { if (\file_exists($this->responseFile)) { # Debug log $this->getLogger()->debug('Sending file',[ 'code'=>$this->getResponse()->getStatusCode(), 'headers'=>$this->getResponse()->getHeaders(), 'file'=>$this->responseFile ]); # Send the file \readfile($this->responseFile); } else { # Log warning $this->getLogger()->warning('File not found',['file'=>$this->responseFile]); # Fake a response \response('',404); # Set HTTP Response Code \http_response_code(404); } } else { # Get body $body = (string)$this->response->getBody(); # Debug log $this->getLogger()->debug('Sending body',[ 'code' => $this->getResponse()->getStatusCode(), 'headers' => $this->getResponse()->getHeaders(), 'size' => \strlen($body) ]); # Send the Body echo $body; } return $this; }
[ "public", "function", "sendResponse", "(", ")", "{", "# Set HTTP Response Code", "\\", "http_response_code", "(", "$", "this", "->", "getResponse", "(", ")", "->", "getStatusCode", "(", ")", ")", ";", "# Set All HTTP headers from Response Object", "foreach", "(", "$...
Send Response back to client @return bool
[ "Send", "Response", "back", "to", "client" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Application.php#L1008-L1083
train
TheBnl/event-tickets
code/model/TaxModifier.php
TaxModifier.updateTotal
public function updateTotal(&$total) { $rate = (float)self::config()->get('tax_rate') / 100; $tax = $total * $rate; $this->setPriceModification($tax); if (!(bool)self::config()->get('inclusive')) { $total += $tax; } }
php
public function updateTotal(&$total) { $rate = (float)self::config()->get('tax_rate') / 100; $tax = $total * $rate; $this->setPriceModification($tax); if (!(bool)self::config()->get('inclusive')) { $total += $tax; } }
[ "public", "function", "updateTotal", "(", "&", "$", "total", ")", "{", "$", "rate", "=", "(", "float", ")", "self", "::", "config", "(", ")", "->", "get", "(", "'tax_rate'", ")", "/", "100", ";", "$", "tax", "=", "$", "total", "*", "$", "rate", ...
Update the total, if the tax is not inclusive the total gets altered @param float $total
[ "Update", "the", "total", "if", "the", "tax", "is", "not", "inclusive", "the", "total", "gets", "altered" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/TaxModifier.php#L49-L56
train
TheBnl/event-tickets
code/model/TaxModifier.php
TaxModifier.getTableTitle
public function getTableTitle() { $rate = _t( 'TaxModifier.TABLE_TITLE', '{rate}% BTW', null, array( 'rate' => (float)self::config()->get('tax_rate') ) ); if ((bool)self::config()->get('inclusive')) { $inc = _t('TaxModifier.INCLUSIVE', '(Incl.)'); $rate .= " $inc"; } return $rate; }
php
public function getTableTitle() { $rate = _t( 'TaxModifier.TABLE_TITLE', '{rate}% BTW', null, array( 'rate' => (float)self::config()->get('tax_rate') ) ); if ((bool)self::config()->get('inclusive')) { $inc = _t('TaxModifier.INCLUSIVE', '(Incl.)'); $rate .= " $inc"; } return $rate; }
[ "public", "function", "getTableTitle", "(", ")", "{", "$", "rate", "=", "_t", "(", "'TaxModifier.TABLE_TITLE'", ",", "'{rate}% BTW'", ",", "null", ",", "array", "(", "'rate'", "=>", "(", "float", ")", "self", "::", "config", "(", ")", "->", "get", "(", ...
Show the used tax rate in the table title @return string
[ "Show", "the", "used", "tax", "rate", "in", "the", "table", "title" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/TaxModifier.php#L63-L80
train
TheBnl/event-tickets
code/model/TaxModifier.php
TaxModifier.findOrMake
public static function findOrMake(Reservation $reservation) { if (!$modifier = $reservation->PriceModifiers()->find('ClassName', self::class)) { $modifier = self::create(); $modifier->write(); } return $modifier; }
php
public static function findOrMake(Reservation $reservation) { if (!$modifier = $reservation->PriceModifiers()->find('ClassName', self::class)) { $modifier = self::create(); $modifier->write(); } return $modifier; }
[ "public", "static", "function", "findOrMake", "(", "Reservation", "$", "reservation", ")", "{", "if", "(", "!", "$", "modifier", "=", "$", "reservation", "->", "PriceModifiers", "(", ")", "->", "find", "(", "'ClassName'", ",", "self", "::", "class", ")", ...
Create a tax modifier if it does not already exists @param Reservation $reservation @return TaxModifier|\DataObject|null|static
[ "Create", "a", "tax", "modifier", "if", "it", "does", "not", "already", "exists" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/TaxModifier.php#L99-L107
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Map/MapTableMap.php
MapTableMap.doDelete
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(MapTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \eXpansion\Bundle\Maps\Model\Map) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(MapTableMap::DATABASE_NAME); $criteria->add(MapTableMap::COL_ID, (array) $values, Criteria::IN); } $query = MapQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { MapTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { MapTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); }
php
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(MapTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \eXpansion\Bundle\Maps\Model\Map) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(MapTableMap::DATABASE_NAME); $criteria->add(MapTableMap::COL_ID, (array) $values, Criteria::IN); } $query = MapQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { MapTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { MapTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); }
[ "public", "static", "function", "doDelete", "(", "$", "values", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getW...
Performs a DELETE on the database, given a Map or Criteria object OR a primary key value. @param mixed $values Criteria or Map object or primary key or array of primary keys which is used to create the DELETE statement @param ConnectionInterface $con the connection to use @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows if supported by native driver or if emulated using Propel. @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Performs", "a", "DELETE", "on", "the", "database", "given", "a", "Map", "or", "Criteria", "object", "OR", "a", "primary", "key", "value", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Map/MapTableMap.php#L484-L512
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/FileSystem.php
FileSystem.getUserData
public function getUserData() : FilesystemInterface { if ($this->connectionType == self::CONNECTION_TYPE_LOCAL) { return $this->getLocalAdapter(); } else { return $this->remoteAdapter; } }
php
public function getUserData() : FilesystemInterface { if ($this->connectionType == self::CONNECTION_TYPE_LOCAL) { return $this->getLocalAdapter(); } else { return $this->remoteAdapter; } }
[ "public", "function", "getUserData", "(", ")", ":", "FilesystemInterface", "{", "if", "(", "$", "this", "->", "connectionType", "==", "self", "::", "CONNECTION_TYPE_LOCAL", ")", "{", "return", "$", "this", "->", "getLocalAdapter", "(", ")", ";", "}", "else",...
Get Filesystem adapter for the user data directory of the dedicated server. @return FilesystemInterface
[ "Get", "Filesystem", "adapter", "for", "the", "user", "data", "directory", "of", "the", "dedicated", "server", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/FileSystem.php#L55-L62
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/FileSystem.php
FileSystem.getLocalAdapter
protected function getLocalAdapter() : FilesystemInterface { if (is_null($this->localAdapter)) { $dir = $this->factory->getConnection()->getMapsDirectory(); $this->localAdapter = new \League\Flysystem\Filesystem(new Local($dir.'/../')); } return $this->localAdapter; }
php
protected function getLocalAdapter() : FilesystemInterface { if (is_null($this->localAdapter)) { $dir = $this->factory->getConnection()->getMapsDirectory(); $this->localAdapter = new \League\Flysystem\Filesystem(new Local($dir.'/../')); } return $this->localAdapter; }
[ "protected", "function", "getLocalAdapter", "(", ")", ":", "FilesystemInterface", "{", "if", "(", "is_null", "(", "$", "this", "->", "localAdapter", ")", ")", "{", "$", "dir", "=", "$", "this", "->", "factory", "->", "getConnection", "(", ")", "->", "get...
Get local adapter if dedicated is installed on same host. @return FilesystemInterface
[ "Get", "local", "adapter", "if", "dedicated", "is", "installed", "on", "same", "host", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/FileSystem.php#L69-L77
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Services/PluginManager.php
PluginManager.isPluginCompatible
protected function isPluginCompatible(PluginDescription $plugin, $enabledPlugins, $title, $mode, $script, Map $map) { // first check for other plugins. foreach ($plugin->getParents() as $parentPluginId) { if (!isset($enabledPlugins[$parentPluginId])) { // A parent plugin is missing. Can't enable plugin. return false; } } // Now check for data providers. foreach ($plugin->getDataProviders() as $dataProvider) { $dataProviders = explode("|", $dataProvider); $foundOne = false; foreach ($dataProviders as $provider) { $providerId = $this->dataProviderManager->getCompatibleProviderId($provider, $title, $mode, $script, $map); if (!is_null($providerId) && isset($enabledPlugins[$providerId])) { // Either there are no data providers compatible or the only one compatible $foundOne = true; break; } } if (!$foundOne) { return false; } } // If data provider need to check if it was "the chosen one". if ($plugin->isIsDataProvider()) { $selectedProvider = $this->dataProviderManager->getCompatibleProviderId( $plugin->getDataProviderName(), $title, $mode, $script, $map ); if ($plugin->getPluginId() != $selectedProvider) { // This data provider wasn't the one selected and therefore the plugin isn't compatible. return false; } } return true; }
php
protected function isPluginCompatible(PluginDescription $plugin, $enabledPlugins, $title, $mode, $script, Map $map) { // first check for other plugins. foreach ($plugin->getParents() as $parentPluginId) { if (!isset($enabledPlugins[$parentPluginId])) { // A parent plugin is missing. Can't enable plugin. return false; } } // Now check for data providers. foreach ($plugin->getDataProviders() as $dataProvider) { $dataProviders = explode("|", $dataProvider); $foundOne = false; foreach ($dataProviders as $provider) { $providerId = $this->dataProviderManager->getCompatibleProviderId($provider, $title, $mode, $script, $map); if (!is_null($providerId) && isset($enabledPlugins[$providerId])) { // Either there are no data providers compatible or the only one compatible $foundOne = true; break; } } if (!$foundOne) { return false; } } // If data provider need to check if it was "the chosen one". if ($plugin->isIsDataProvider()) { $selectedProvider = $this->dataProviderManager->getCompatibleProviderId( $plugin->getDataProviderName(), $title, $mode, $script, $map ); if ($plugin->getPluginId() != $selectedProvider) { // This data provider wasn't the one selected and therefore the plugin isn't compatible. return false; } } return true; }
[ "protected", "function", "isPluginCompatible", "(", "PluginDescription", "$", "plugin", ",", "$", "enabledPlugins", ",", "$", "title", ",", "$", "mode", ",", "$", "script", ",", "Map", "$", "map", ")", "{", "// first check for other plugins.", "foreach", "(", ...
Check if a plugin is compatible or not. @param PluginDescription $plugin @param $enabledPlugins @param $title @param $mode @param $script @param $map @return bool
[ "Check", "if", "a", "plugin", "is", "compatible", "or", "not", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/PluginManager.php#L159-L206
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Services/PluginManager.php
PluginManager.enablePlugin
protected function enablePlugin(PluginDescription $plugin, $title, $mode, $script, Map $map) { $notify = false; $plugin->setIsEnabled(true); $pluginService = $this->container->get($plugin->getPluginId()); if (!isset($this->enabledPlugins[$plugin->getPluginId()])) { $notify = true; } foreach ($plugin->getDataProviders() as $provider) { $dataProviders = explode("|", $provider); foreach ($dataProviders as $dataProvider) { $this->dataProviderManager->registerPlugin($dataProvider, $plugin->getPluginId(), $title, $mode, $script, $map); } } $this->enabledPlugins[$plugin->getPluginId()] = $plugin; return $notify ? $pluginService : null; }
php
protected function enablePlugin(PluginDescription $plugin, $title, $mode, $script, Map $map) { $notify = false; $plugin->setIsEnabled(true); $pluginService = $this->container->get($plugin->getPluginId()); if (!isset($this->enabledPlugins[$plugin->getPluginId()])) { $notify = true; } foreach ($plugin->getDataProviders() as $provider) { $dataProviders = explode("|", $provider); foreach ($dataProviders as $dataProvider) { $this->dataProviderManager->registerPlugin($dataProvider, $plugin->getPluginId(), $title, $mode, $script, $map); } } $this->enabledPlugins[$plugin->getPluginId()] = $plugin; return $notify ? $pluginService : null; }
[ "protected", "function", "enablePlugin", "(", "PluginDescription", "$", "plugin", ",", "$", "title", ",", "$", "mode", ",", "$", "script", ",", "Map", "$", "map", ")", "{", "$", "notify", "=", "false", ";", "$", "plugin", "->", "setIsEnabled", "(", "tr...
Enable a certain plugin. @param PluginDescription $plugin @param $title @param $mode @param $script @param Map $map @return mixed @throws \eXpansion\Framework\Core\Exceptions\DataProvider\UncompatibleException
[ "Enable", "a", "certain", "plugin", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/PluginManager.php#L221-L241
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.getDomain
public function getDomain() { $uri = $this->getServiceLocator()->get('Application')->getMvcEvent()->getRequest()->getUri(); return sprintf('%s://%s', $uri->getScheme(), $uri->getHost()); }
php
public function getDomain() { $uri = $this->getServiceLocator()->get('Application')->getMvcEvent()->getRequest()->getUri(); return sprintf('%s://%s', $uri->getScheme(), $uri->getHost()); }
[ "public", "function", "getDomain", "(", ")", "{", "$", "uri", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get", "(", "'Application'", ")", "->", "getMvcEvent", "(", ")", "->", "getRequest", "(", ")", "->", "getUri", "(", ")", ";", "...
Returns the current URL of the page @return string
[ "Returns", "the", "current", "URL", "of", "the", "page" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L111-L115
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.checkMysqlConnection
public function checkMysqlConnection($host, $db, $user, $pass) { $results = array(); $isConnected = 0; $isDatabaseExists = 0; $isDatabaseCollationNameValid = 0; $isPassCorrect = 1; if($this->isDomainExists($host)) { $isConnected = 1; try { $dbAdapter = new DbAdapter(array( 'driver' => 'Pdo', 'dsn' => 'mysql:dbname=INFORMATION_SCHEMA;host='.$host, 'username' => $user, 'password' => $pass, 'driver_options' => array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" ), )); $sql = new Sql($dbAdapter); $select = $sql->select(); $select->from('SCHEMATA'); $select->where(array('SCHEMA_NAME' => $db)); $statement = $sql->prepareStatementForSqlObject($select); $result = $statement->execute(); $schema = $result->current(); if(!empty($schema)) { $isDatabaseExists = 1; if (!empty($schema['DEFAULT_COLLATION_NAME']) && $schema['DEFAULT_COLLATION_NAME'] === 'utf8_general_ci') { $isDatabaseCollationNameValid = 1; } } }catch(\Exception $e) { $isPassCorrect = 0; } } $results = array( 'isConnected' => $isConnected, 'isDatabaseExists' => $isDatabaseExists, 'isMysqlPasswordCorrect' => $isPassCorrect, 'isDatabaseCollationNameValid' => $isDatabaseCollationNameValid, ); return $results; }
php
public function checkMysqlConnection($host, $db, $user, $pass) { $results = array(); $isConnected = 0; $isDatabaseExists = 0; $isDatabaseCollationNameValid = 0; $isPassCorrect = 1; if($this->isDomainExists($host)) { $isConnected = 1; try { $dbAdapter = new DbAdapter(array( 'driver' => 'Pdo', 'dsn' => 'mysql:dbname=INFORMATION_SCHEMA;host='.$host, 'username' => $user, 'password' => $pass, 'driver_options' => array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" ), )); $sql = new Sql($dbAdapter); $select = $sql->select(); $select->from('SCHEMATA'); $select->where(array('SCHEMA_NAME' => $db)); $statement = $sql->prepareStatementForSqlObject($select); $result = $statement->execute(); $schema = $result->current(); if(!empty($schema)) { $isDatabaseExists = 1; if (!empty($schema['DEFAULT_COLLATION_NAME']) && $schema['DEFAULT_COLLATION_NAME'] === 'utf8_general_ci') { $isDatabaseCollationNameValid = 1; } } }catch(\Exception $e) { $isPassCorrect = 0; } } $results = array( 'isConnected' => $isConnected, 'isDatabaseExists' => $isDatabaseExists, 'isMysqlPasswordCorrect' => $isPassCorrect, 'isDatabaseCollationNameValid' => $isDatabaseCollationNameValid, ); return $results; }
[ "public", "function", "checkMysqlConnection", "(", "$", "host", ",", "$", "db", ",", "$", "user", ",", "$", "pass", ")", "{", "$", "results", "=", "array", "(", ")", ";", "$", "isConnected", "=", "0", ";", "$", "isDatabaseExists", "=", "0", ";", "$...
Checks if your MySql is working and if your database is existing @param string $host @param string $db @param string $user @param string $pass @return Json
[ "Checks", "if", "your", "MySql", "is", "working", "and", "if", "your", "database", "is", "existing" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L126-L179
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.setDbAdapter
public function setDbAdapter($config) { if(is_array($config)) { $this->odbAdapter = new DbAdapter(array_merge(array( 'driver' => 'Pdo_Mysql', 'driver_options' => array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" ) ), $config)); $config = new \Zend\Config\Config($config, true); $writer = new \Zend\Config\Writer\PhpArray(); $conf = $writer->toString($config); } }
php
public function setDbAdapter($config) { if(is_array($config)) { $this->odbAdapter = new DbAdapter(array_merge(array( 'driver' => 'Pdo_Mysql', 'driver_options' => array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" ) ), $config)); $config = new \Zend\Config\Config($config, true); $writer = new \Zend\Config\Writer\PhpArray(); $conf = $writer->toString($config); } }
[ "public", "function", "setDbAdapter", "(", "$", "config", ")", "{", "if", "(", "is_array", "(", "$", "config", ")", ")", "{", "$", "this", "->", "odbAdapter", "=", "new", "DbAdapter", "(", "array_merge", "(", "array", "(", "'driver'", "=>", "'Pdo_Mysql'"...
Set's the DB Adapter @param String $config
[ "Set", "s", "the", "DB", "Adapter" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L185-L199
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.executeRawQuery
public function executeRawQuery($query) { $resultSet = null; if($this->odbAdapter) { if(!empty($query)) { $resultSet = $this->getDbAdapter()->query($query, DbAdapter::QUERY_MODE_EXECUTE); } } return $resultSet; }
php
public function executeRawQuery($query) { $resultSet = null; if($this->odbAdapter) { if(!empty($query)) { $resultSet = $this->getDbAdapter()->query($query, DbAdapter::QUERY_MODE_EXECUTE); } } return $resultSet; }
[ "public", "function", "executeRawQuery", "(", "$", "query", ")", "{", "$", "resultSet", "=", "null", ";", "if", "(", "$", "this", "->", "odbAdapter", ")", "{", "if", "(", "!", "empty", "(", "$", "query", ")", ")", "{", "$", "resultSet", "=", "$", ...
Executes a raw SQL query @param String $query @return NULL|\Zend\Db\Adapter\Driver\StatementInterface|\Zend\Db\ResultSet\Zend\Db\ResultSet
[ "Executes", "a", "raw", "SQL", "query" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L214-L226
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.isDbTableExists
public function isDbTableExists($tableName) { $status = false; $resultSet = array(); $query = $this->executeRawQuery("SHOW TABLES LIKE '".trim($tableName)."';"); if($resultSet) $resultSet = $query->toArray(); if(!empty($resultSet)) { $status = true; } return $status; }
php
public function isDbTableExists($tableName) { $status = false; $resultSet = array(); $query = $this->executeRawQuery("SHOW TABLES LIKE '".trim($tableName)."';"); if($resultSet) $resultSet = $query->toArray(); if(!empty($resultSet)) { $status = true; } return $status; }
[ "public", "function", "isDbTableExists", "(", "$", "tableName", ")", "{", "$", "status", "=", "false", ";", "$", "resultSet", "=", "array", "(", ")", ";", "$", "query", "=", "$", "this", "->", "executeRawQuery", "(", "\"SHOW TABLES LIKE '\"", ".", "trim", ...
Checks if the table exists or not @param String $tableName @return boolean
[ "Checks", "if", "the", "table", "exists", "or", "not" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L233-L250
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.importSql
public function importSql($path, $files = array('setup_structure.sql')) { $status = false; $fImport = null; if(file_exists($path)) { foreach($files as $file) { if(file_exists($path.$file)) { $fImport = file_get_contents($path.$file); $this->executeRawQuery($fImport); $this->importTableName = array_merge($this->importTableName, $this->getSqlFileTables($path.$file)); } } } return $status; }
php
public function importSql($path, $files = array('setup_structure.sql')) { $status = false; $fImport = null; if(file_exists($path)) { foreach($files as $file) { if(file_exists($path.$file)) { $fImport = file_get_contents($path.$file); $this->executeRawQuery($fImport); $this->importTableName = array_merge($this->importTableName, $this->getSqlFileTables($path.$file)); } } } return $status; }
[ "public", "function", "importSql", "(", "$", "path", ",", "$", "files", "=", "array", "(", "'setup_structure.sql'", ")", ")", "{", "$", "status", "=", "false", ";", "$", "fImport", "=", "null", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")...
Imports the specified file in the MySql server @param String $path @param array $files (optional) @return boolean
[ "Imports", "the", "specified", "file", "in", "the", "MySql", "server" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L269-L284
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.getSqlFileTables
public function getSqlFileTables($path) { $tables = array(); if(file_exists($path)) { $file = fopen($path, 'r'); $textToFind = 'CREATE TABLE IF NOT EXISTS '; $found = array(); $tables = array(); while(!feof($file)) { $output = fgets($file); $pos = strrpos($output, $textToFind); if(is_int($pos)) { $found[] = $output; } } foreach($found as $table) { $startPos = strpos($table, '`'); $lastPos = strrpos($table, '`'); $tableName = substr($table, $startPos, $lastPos); $tableName = preg_replace('/\(|\)/', '', $tableName); $tables[] = trim(str_replace('`', '', $tableName)); } } return $tables; }
php
public function getSqlFileTables($path) { $tables = array(); if(file_exists($path)) { $file = fopen($path, 'r'); $textToFind = 'CREATE TABLE IF NOT EXISTS '; $found = array(); $tables = array(); while(!feof($file)) { $output = fgets($file); $pos = strrpos($output, $textToFind); if(is_int($pos)) { $found[] = $output; } } foreach($found as $table) { $startPos = strpos($table, '`'); $lastPos = strrpos($table, '`'); $tableName = substr($table, $startPos, $lastPos); $tableName = preg_replace('/\(|\)/', '', $tableName); $tables[] = trim(str_replace('`', '', $tableName)); } } return $tables; }
[ "public", "function", "getSqlFileTables", "(", "$", "path", ")", "{", "$", "tables", "=", "array", "(", ")", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "$", "file", "=", "fopen", "(", "$", "path", ",", "'r'", ")", ";", "$", ...
Returns all the table names that will be imported @param String $path @return array
[ "Returns", "all", "the", "table", "names", "that", "will", "be", "imported" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L291-L318
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.checkEnvironmentVariables
public function checkEnvironmentVariables() { $settingsValues = array(); $iniSettings = array( 'memory_limit', 'max_execution_time', 'upload_max_filesize' ); foreach($iniSettings as $setting) { $settingsValues[$setting] = ini_get($setting); } return $settingsValues; }
php
public function checkEnvironmentVariables() { $settingsValues = array(); $iniSettings = array( 'memory_limit', 'max_execution_time', 'upload_max_filesize' ); foreach($iniSettings as $setting) { $settingsValues[$setting] = ini_get($setting); } return $settingsValues; }
[ "public", "function", "checkEnvironmentVariables", "(", ")", "{", "$", "settingsValues", "=", "array", "(", ")", ";", "$", "iniSettings", "=", "array", "(", "'memory_limit'", ",", "'max_execution_time'", ",", "'upload_max_filesize'", ")", ";", "foreach", "(", "$...
REturns memory limit, execution time, and maximum upload size variables @return array
[ "REturns", "memory", "limit", "execution", "time", "and", "maximum", "upload", "size", "variables" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L354-L366
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.filePermission
public function filePermission($path, $mode = self::CHMOD_775) { $results = array(); $success = 0; if(file_exists($path)) { if(!is_writable($path)) chmod($path, $mode); if(!is_readable($path)) chmod($path, $mode); if(is_readable($path) && is_writable($path)) $status = 1; } $results = array( 'path' => $path, 'mode' => $mode, 'success' => $success ); return Json::encode($results); }
php
public function filePermission($path, $mode = self::CHMOD_775) { $results = array(); $success = 0; if(file_exists($path)) { if(!is_writable($path)) chmod($path, $mode); if(!is_readable($path)) chmod($path, $mode); if(is_readable($path) && is_writable($path)) $status = 1; } $results = array( 'path' => $path, 'mode' => $mode, 'success' => $success ); return Json::encode($results); }
[ "public", "function", "filePermission", "(", "$", "path", ",", "$", "mode", "=", "self", "::", "CHMOD_775", ")", "{", "$", "results", "=", "array", "(", ")", ";", "$", "success", "=", "0", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", ...
Changes the file permission @param String $path @param int $mode @return Json
[ "Changes", "the", "file", "permission" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L424-L446
train
melisplatform/melis-installer
src/Service/InstallHelperService.php
InstallHelperService.replaceFile
public function replaceFile($old, $new, array $content) { $oldFileContent = file_get_contents($old); file_put_contents($new, vsprintf($oldFileContent, $content)); unlink($old); }
php
public function replaceFile($old, $new, array $content) { $oldFileContent = file_get_contents($old); file_put_contents($new, vsprintf($oldFileContent, $content)); unlink($old); }
[ "public", "function", "replaceFile", "(", "$", "old", ",", "$", "new", ",", "array", "$", "content", ")", "{", "$", "oldFileContent", "=", "file_get_contents", "(", "$", "old", ")", ";", "file_put_contents", "(", "$", "new", ",", "vsprintf", "(", "$", ...
Replaces the old file from the specified path @param string $old @param string $new @param Array $content (vsprintf content)
[ "Replaces", "the", "old", "file", "from", "the", "specified", "path" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/InstallHelperService.php#L563-L568
train
narrowspark/mimetypes
src/MimeTypeFileExtensionGuesser.php
MimeTypeFileExtensionGuesser.guess
public static function guess(string $guess): ?string { if (! \is_file($guess)) { throw new FileNotFoundException($guess); } if (! \is_readable($guess)) { throw new AccessDeniedException($guess); } return parent::guess(\pathinfo($guess, \PATHINFO_EXTENSION)); }
php
public static function guess(string $guess): ?string { if (! \is_file($guess)) { throw new FileNotFoundException($guess); } if (! \is_readable($guess)) { throw new AccessDeniedException($guess); } return parent::guess(\pathinfo($guess, \PATHINFO_EXTENSION)); }
[ "public", "static", "function", "guess", "(", "string", "$", "guess", ")", ":", "?", "string", "{", "if", "(", "!", "\\", "is_file", "(", "$", "guess", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "$", "guess", ")", ";", "}", "if", ...
Guesses the mime type using the file extension. @param string $guess The path to the file @throws \Narrowspark\MimeType\Exception\FileNotFoundException If the file does not exist @throws \Narrowspark\MimeType\Exception\AccessDeniedException If the file could not be read @return null|string
[ "Guesses", "the", "mime", "type", "using", "the", "file", "extension", "." ]
3ce9277e7e93edb04b269bc3e37181e2e51ce0ac
https://github.com/narrowspark/mimetypes/blob/3ce9277e7e93edb04b269bc3e37181e2e51ce0ac/src/MimeTypeFileExtensionGuesser.php#L28-L39
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Config/Services/ConfigManager.php
ConfigManager.registerConfig
public function registerConfig(ConfigInterface $config, $id) { $this->configurationDefinitions[spl_object_hash($config)] = $config; $this->configurationIds[spl_object_hash($config)] = $id; $this->configTree->set($config->getPath(), $config); $config->setConfigManager($this); }
php
public function registerConfig(ConfigInterface $config, $id) { $this->configurationDefinitions[spl_object_hash($config)] = $config; $this->configurationIds[spl_object_hash($config)] = $id; $this->configTree->set($config->getPath(), $config); $config->setConfigManager($this); }
[ "public", "function", "registerConfig", "(", "ConfigInterface", "$", "config", ",", "$", "id", ")", "{", "$", "this", "->", "configurationDefinitions", "[", "spl_object_hash", "(", "$", "config", ")", "]", "=", "$", "config", ";", "$", "this", "->", "confi...
Register a config to be handled by the config manager. @param ConfigInterface $config @param $id
[ "Register", "a", "config", "to", "be", "handled", "by", "the", "config", "manager", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Config/Services/ConfigManager.php#L177-L183
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.run
public function run(&$query, $model, $request) { $this->query = $query; $this->getAttributes($model); $this->parseRequest($request); return $this->query(); }
php
public function run(&$query, $model, $request) { $this->query = $query; $this->getAttributes($model); $this->parseRequest($request); return $this->query(); }
[ "public", "function", "run", "(", "&", "$", "query", ",", "$", "model", ",", "$", "request", ")", "{", "$", "this", "->", "query", "=", "$", "query", ";", "$", "this", "->", "getAttributes", "(", "$", "model", ")", ";", "$", "this", "->", "parseR...
Process the search. @return void
[ "Process", "the", "search", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L179-L186
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.query
private function query() { foreach ($this->search_models as $model_name => $filters) { // Apply search against the original model. if ($model_name === 'self') { self::applySearch($this->query, $filters); continue; } // Apply search against the related model. $this->query->whereHas($model_name, function ($query) use ($filters) { self::applySearch($query, $filters); }); } return $this->query; }
php
private function query() { foreach ($this->search_models as $model_name => $filters) { // Apply search against the original model. if ($model_name === 'self') { self::applySearch($this->query, $filters); continue; } // Apply search against the related model. $this->query->whereHas($model_name, function ($query) use ($filters) { self::applySearch($query, $filters); }); } return $this->query; }
[ "private", "function", "query", "(", ")", "{", "foreach", "(", "$", "this", "->", "search_models", "as", "$", "model_name", "=>", "$", "filters", ")", "{", "// Apply search against the original model.", "if", "(", "$", "model_name", "===", "'self'", ")", "{", ...
Run the query. @return builder
[ "Run", "the", "query", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L193-L209
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.getAttributes
public function getAttributes($model) { $this->model = $model; $this->attributes = self::buildRelationshipAttributes($this->model); $this->attributes = $this->attributes + self::buildAttributes($this->model); return $this->attributes; }
php
public function getAttributes($model) { $this->model = $model; $this->attributes = self::buildRelationshipAttributes($this->model); $this->attributes = $this->attributes + self::buildAttributes($this->model); return $this->attributes; }
[ "public", "function", "getAttributes", "(", "$", "model", ")", "{", "$", "this", "->", "model", "=", "$", "model", ";", "$", "this", "->", "attributes", "=", "self", "::", "buildRelationshipAttributes", "(", "$", "this", "->", "model", ")", ";", "$", "...
Check the given model and build attribute list. @return void
[ "Check", "the", "given", "model", "and", "build", "attribute", "list", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L216-L223
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.buildRelationshipAttributes
private function buildRelationshipAttributes($model) { $result = []; foreach ($model->getSearchRelationships() as $method) { if (!method_exists($model, $method)) { continue; } $relation = self::getRelation($model->$method()); $this->relationships[$method] = $relation; self::buildCastedAttributes($relation['model'], $result, $method); self::buildSearchAttributes($relation['model'], $result, $method); } return $result; }
php
private function buildRelationshipAttributes($model) { $result = []; foreach ($model->getSearchRelationships() as $method) { if (!method_exists($model, $method)) { continue; } $relation = self::getRelation($model->$method()); $this->relationships[$method] = $relation; self::buildCastedAttributes($relation['model'], $result, $method); self::buildSearchAttributes($relation['model'], $result, $method); } return $result; }
[ "private", "function", "buildRelationshipAttributes", "(", "$", "model", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "model", "->", "getSearchRelationships", "(", ")", "as", "$", "method", ")", "{", "if", "(", "!", "method_exists", ...
Build a list of attributes from the relationships. @return void
[ "Build", "a", "list", "of", "attributes", "from", "the", "relationships", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L230-L247
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.buildAttributes
public static function buildAttributes($model) { $result = []; self::buildCastedAttributes($model, $result); self::buildSearchAttributes($model, $result); return $result; }
php
public static function buildAttributes($model) { $result = []; self::buildCastedAttributes($model, $result); self::buildSearchAttributes($model, $result); return $result; }
[ "public", "static", "function", "buildAttributes", "(", "$", "model", ")", "{", "$", "result", "=", "[", "]", ";", "self", "::", "buildCastedAttributes", "(", "$", "model", ",", "$", "result", ")", ";", "self", "::", "buildSearchAttributes", "(", "$", "m...
Build a list of all possible attributes. @return void
[ "Build", "a", "list", "of", "all", "possible", "attributes", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L302-L310
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.buildCastedAttributes
private static function buildCastedAttributes($model, &$result, $method = null) { $model_name = 'self'; $name_append = ''; if (!is_null($method)) { $model_name = $method; $name_append = $method.'.'; } // ModelSchema implementation gives us better data. if (class_exists('HnhDigital\ModelSchema\Model') && $model instanceof \HnhDigital\ModelSchema\Model) { // Build attributes off the schema. foreach ($model->getSchema() as $name => $config) { $result[$name_append.$name] = [ 'name' => $name, 'title' => Arr::get($config, 'title', $name), 'attributes' => [sprintf('%s.%s', $model->getTable(), $name)], 'filter' => self::convertCast(Arr::get($config, 'cast')), 'model' => &$model, 'model_name' => $model_name, 'source_model' => Arr::get($config, 'model'), 'source_model_key' => Arr::get($config, 'model_key', null), 'source_model_name' => Arr::get($config, 'model_name', 'display_name'), ]; } return; } // Build attributes off the specified casts. foreach ($model->getCasts() as $name => $cast) { $result[$name_append.$name] = [ 'name' => $name, 'title' => $name, 'attributes' => [sprintf('%s.%s', $model->getTable(), $name)], 'filter' => self::convertCast($cast), 'model' => &$model, 'model_name' => $model_name, ]; } }
php
private static function buildCastedAttributes($model, &$result, $method = null) { $model_name = 'self'; $name_append = ''; if (!is_null($method)) { $model_name = $method; $name_append = $method.'.'; } // ModelSchema implementation gives us better data. if (class_exists('HnhDigital\ModelSchema\Model') && $model instanceof \HnhDigital\ModelSchema\Model) { // Build attributes off the schema. foreach ($model->getSchema() as $name => $config) { $result[$name_append.$name] = [ 'name' => $name, 'title' => Arr::get($config, 'title', $name), 'attributes' => [sprintf('%s.%s', $model->getTable(), $name)], 'filter' => self::convertCast(Arr::get($config, 'cast')), 'model' => &$model, 'model_name' => $model_name, 'source_model' => Arr::get($config, 'model'), 'source_model_key' => Arr::get($config, 'model_key', null), 'source_model_name' => Arr::get($config, 'model_name', 'display_name'), ]; } return; } // Build attributes off the specified casts. foreach ($model->getCasts() as $name => $cast) { $result[$name_append.$name] = [ 'name' => $name, 'title' => $name, 'attributes' => [sprintf('%s.%s', $model->getTable(), $name)], 'filter' => self::convertCast($cast), 'model' => &$model, 'model_name' => $model_name, ]; } }
[ "private", "static", "function", "buildCastedAttributes", "(", "$", "model", ",", "&", "$", "result", ",", "$", "method", "=", "null", ")", "{", "$", "model_name", "=", "'self'", ";", "$", "name_append", "=", "''", ";", "if", "(", "!", "is_null", "(", ...
Build attributes based on the casts array on the model. @param Model $model @param array &$result @param nullable|string $method @return void
[ "Build", "attributes", "based", "on", "the", "casts", "array", "on", "the", "model", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L321-L364
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.validateAttributes
private static function validateAttributes($model, $name, &$attributes) { // Should be an array. if (!is_array($attributes)) { $attributes = [$attributes]; } // Is empty, use the name of the table + name. if (empty($attributes)) { $attributes = [sprintf('%s.%s', $model->getTable(), $name)]; } // Check each of the attribute values. // Convert any prepended with a curly to an expression. foreach ($attributes as &$value) { if (substr($value, 0, 1) === '#' || substr($value, 0, 1) === '{') { $value = new Expression(substr($value, 1)); } } }
php
private static function validateAttributes($model, $name, &$attributes) { // Should be an array. if (!is_array($attributes)) { $attributes = [$attributes]; } // Is empty, use the name of the table + name. if (empty($attributes)) { $attributes = [sprintf('%s.%s', $model->getTable(), $name)]; } // Check each of the attribute values. // Convert any prepended with a curly to an expression. foreach ($attributes as &$value) { if (substr($value, 0, 1) === '#' || substr($value, 0, 1) === '{') { $value = new Expression(substr($value, 1)); } } }
[ "private", "static", "function", "validateAttributes", "(", "$", "model", ",", "$", "name", ",", "&", "$", "attributes", ")", "{", "// Should be an array.", "if", "(", "!", "is_array", "(", "$", "attributes", ")", ")", "{", "$", "attributes", "=", "[", "...
Validate the attributes list. @return void
[ "Validate", "the", "attributes", "list", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L439-L458
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.parseRequest
private function parseRequest($request) { if (empty($request)) { return; } $this->request = $request; // Models used in this request. $models_used = []; // Review each request. foreach ($this->request as $name => $filters) { // This name is not present in available attributes. if (!Arr::has($this->attributes, $name)) { continue; } // Get the settings for the given attribute. $settings = Arr::get($this->attributes, $name); // Settings is empty. if (empty($settings)) { continue; } // Check and validate each of the filters. $filters = self::validateFilters($filters, $settings); // Search against current model. if (($model_name = Arr::get($settings, 'model_name')) === 'self') { $this->search_models['self'][$name] = $filters; continue; } // Search against an model via relationship. $models_used[$model_name] = true; $this->search_models[$model_name][$name] = $filters; } // Join the models to this query. if (count($models_used)) { $this->modelJoin($models_used); } }
php
private function parseRequest($request) { if (empty($request)) { return; } $this->request = $request; // Models used in this request. $models_used = []; // Review each request. foreach ($this->request as $name => $filters) { // This name is not present in available attributes. if (!Arr::has($this->attributes, $name)) { continue; } // Get the settings for the given attribute. $settings = Arr::get($this->attributes, $name); // Settings is empty. if (empty($settings)) { continue; } // Check and validate each of the filters. $filters = self::validateFilters($filters, $settings); // Search against current model. if (($model_name = Arr::get($settings, 'model_name')) === 'self') { $this->search_models['self'][$name] = $filters; continue; } // Search against an model via relationship. $models_used[$model_name] = true; $this->search_models[$model_name][$name] = $filters; } // Join the models to this query. if (count($models_used)) { $this->modelJoin($models_used); } }
[ "private", "function", "parseRequest", "(", "$", "request", ")", "{", "if", "(", "empty", "(", "$", "request", ")", ")", "{", "return", ";", "}", "$", "this", "->", "request", "=", "$", "request", ";", "// Models used in this request.", "$", "models_used",...
Process the provided request. @return void
[ "Process", "the", "provided", "request", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L465-L509
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.validateFilters
private static function validateFilters($filters, $settings) { if (!is_array($filters)) { $filters = [$filters]; } // Each fitler. foreach ($filters as $index => &$filter) { // Check this item. $filter = self::validateFilterItem($filter, $settings); // Remove if invalid. if (empty($filter)) { unset($filters[$index]); } } return $filters; }
php
private static function validateFilters($filters, $settings) { if (!is_array($filters)) { $filters = [$filters]; } // Each fitler. foreach ($filters as $index => &$filter) { // Check this item. $filter = self::validateFilterItem($filter, $settings); // Remove if invalid. if (empty($filter)) { unset($filters[$index]); } } return $filters; }
[ "private", "static", "function", "validateFilters", "(", "$", "filters", ",", "$", "settings", ")", "{", "if", "(", "!", "is_array", "(", "$", "filters", ")", ")", "{", "$", "filters", "=", "[", "$", "filters", "]", ";", "}", "// Each fitler.", "foreac...
Validate the given filter. @return array
[ "Validate", "the", "given", "filter", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L516-L535
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.validateFilterItem
private static function validateFilterItem($filter, $settings) { // Convert string to filter array. if (!is_array($filter)) { $filter = ['', $filter]; } // Convert string to filter array. if (Arr::get($settings, 'filter') !== 'boolean' && count($filter) == 1) { array_unshift($filter, ''); } // Split the filter array into operator, value1, value2 $operator = Arr::get($filter, 0, ''); $value_one = Arr::get($filter, 1, false); $value_two = Arr::get($filter, 2, false); // The wild-all setting was enabled. // Update value with all characters wildcarded. if (Arr::has($settings, 'enable.wild-all')) { self::applyWildAll($operator, $value_one); } self::checkInlineOperator($operator, $value_one, $settings); self::checkNullOperator($operator, $value_one); self::checkEmptyOperator($operator, $value_one); // Defaullt operator. if (empty($operator)) { $operator = self::getDefaultOperator(Arr::get($settings, 'filter'), $operator); } // Return filter as an associative array. $filter = [ 'operator' => $operator, 'method' => 'where', 'arguments' => [], 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => true, ]; // Update filter based on the filter being used. $validation_method = 'filterBy'.Str::studly(Arr::get($settings, 'filter')); if (method_exists(__CLASS__, $validation_method)) { $filter = self::{$validation_method}($filter); } if ($filter === false) { return $filter; } // Update based on operator. $filter['positive'] = !(stripos($operator, '!') !== false || stripos($operator, 'NOT') !== false); return $filter; }
php
private static function validateFilterItem($filter, $settings) { // Convert string to filter array. if (!is_array($filter)) { $filter = ['', $filter]; } // Convert string to filter array. if (Arr::get($settings, 'filter') !== 'boolean' && count($filter) == 1) { array_unshift($filter, ''); } // Split the filter array into operator, value1, value2 $operator = Arr::get($filter, 0, ''); $value_one = Arr::get($filter, 1, false); $value_two = Arr::get($filter, 2, false); // The wild-all setting was enabled. // Update value with all characters wildcarded. if (Arr::has($settings, 'enable.wild-all')) { self::applyWildAll($operator, $value_one); } self::checkInlineOperator($operator, $value_one, $settings); self::checkNullOperator($operator, $value_one); self::checkEmptyOperator($operator, $value_one); // Defaullt operator. if (empty($operator)) { $operator = self::getDefaultOperator(Arr::get($settings, 'filter'), $operator); } // Return filter as an associative array. $filter = [ 'operator' => $operator, 'method' => 'where', 'arguments' => [], 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => true, ]; // Update filter based on the filter being used. $validation_method = 'filterBy'.Str::studly(Arr::get($settings, 'filter')); if (method_exists(__CLASS__, $validation_method)) { $filter = self::{$validation_method}($filter); } if ($filter === false) { return $filter; } // Update based on operator. $filter['positive'] = !(stripos($operator, '!') !== false || stripos($operator, 'NOT') !== false); return $filter; }
[ "private", "static", "function", "validateFilterItem", "(", "$", "filter", ",", "$", "settings", ")", "{", "// Convert string to filter array.", "if", "(", "!", "is_array", "(", "$", "filter", ")", ")", "{", "$", "filter", "=", "[", "''", ",", "$", "filter...
Validate each entry. @param array|string $filter @param array $settings @return array|null
[ "Validate", "each", "entry", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L545-L603
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.applyWildAll
private static function applyWildAll(&$operator, &$value) { $positive = !(stripos($operator, '!') !== false || stripos($operator, 'NOT') !== false); $operator = $positive ? '*=*' : '*!=*'; $value_array = str_split(str_replace(' ', '', $value)); $value = implode('%', $value_array); }
php
private static function applyWildAll(&$operator, &$value) { $positive = !(stripos($operator, '!') !== false || stripos($operator, 'NOT') !== false); $operator = $positive ? '*=*' : '*!=*'; $value_array = str_split(str_replace(' ', '', $value)); $value = implode('%', $value_array); }
[ "private", "static", "function", "applyWildAll", "(", "&", "$", "operator", ",", "&", "$", "value", ")", "{", "$", "positive", "=", "!", "(", "stripos", "(", "$", "operator", ",", "'!'", ")", "!==", "false", "||", "stripos", "(", "$", "operator", ","...
Applies a wildcard for between every character. @param string &$value @return void
[ "Applies", "a", "wildcard", "for", "between", "every", "character", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L635-L641
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.parseInlineOperator
public static function parseInlineOperator($text) { $operator_name = 'contains'; $operator = Arr::get($text, 0, ''); $value = Arr::get($text, 1, false); self::checkInlineOperator($operator, $value); if (!empty($operator)) { $operator_name = Arr::get(self::getOperator('string', $operator), 'inline', 'contains'); } return [ $operator_name, $operator, $value, ]; }
php
public static function parseInlineOperator($text) { $operator_name = 'contains'; $operator = Arr::get($text, 0, ''); $value = Arr::get($text, 1, false); self::checkInlineOperator($operator, $value); if (!empty($operator)) { $operator_name = Arr::get(self::getOperator('string', $operator), 'inline', 'contains'); } return [ $operator_name, $operator, $value, ]; }
[ "public", "static", "function", "parseInlineOperator", "(", "$", "text", ")", "{", "$", "operator_name", "=", "'contains'", ";", "$", "operator", "=", "Arr", "::", "get", "(", "$", "text", ",", "0", ",", "''", ")", ";", "$", "value", "=", "Arr", "::"...
Parse any inline operator. @return array
[ "Parse", "any", "inline", "operator", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L648-L665
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.checkInlineOperator
private static function checkInlineOperator(&$operator, &$value, $settings = []) { if (is_array($value)) { return; } // Boolean does not provide inline operations. if (Arr::get($settings, 'filter') === 'boolean') { return; } $value_array = explode(' ', trim($value), 2); if (count($value_array) == 1) { return; } $check_operator = array_shift($value_array); if (self::checkOperator(Arr::get($settings, 'filter', 'string'), $check_operator)) { $operator = $check_operator; $value = array_shift($value_array); } }
php
private static function checkInlineOperator(&$operator, &$value, $settings = []) { if (is_array($value)) { return; } // Boolean does not provide inline operations. if (Arr::get($settings, 'filter') === 'boolean') { return; } $value_array = explode(' ', trim($value), 2); if (count($value_array) == 1) { return; } $check_operator = array_shift($value_array); if (self::checkOperator(Arr::get($settings, 'filter', 'string'), $check_operator)) { $operator = $check_operator; $value = array_shift($value_array); } }
[ "private", "static", "function", "checkInlineOperator", "(", "&", "$", "operator", ",", "&", "$", "value", ",", "$", "settings", "=", "[", "]", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", ";", "}", "// Boolean does not ...
Check the value for inline operator. @param string &$operator @param string &$value @return void
[ "Check", "the", "value", "for", "inline", "operator", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L675-L698
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.filterByUuid
public static function filterByUuid($filter) { $operator = Arr::get($filter, 'operator'); $method = Arr::get($filter, 'method'); $arguments = Arr::get($filter, 'arguments'); $value_one = Arr::get($filter, 'value_one'); $value_two = Arr::get($filter, 'value_two'); $settings = Arr::get($filter, 'settings'); $positive = Arr::get($filter, 'positive'); switch ($operator) { case 'IN': $method = 'whereIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NOT_IN': $method = 'whereNotIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NULL': $method = 'whereNull'; break; case 'NOT_NULL': $method = 'whereNotNull'; break; } return [ 'operator' => $operator, 'method' => $method, 'arguments' => $arguments, 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => $positive, ]; }
php
public static function filterByUuid($filter) { $operator = Arr::get($filter, 'operator'); $method = Arr::get($filter, 'method'); $arguments = Arr::get($filter, 'arguments'); $value_one = Arr::get($filter, 'value_one'); $value_two = Arr::get($filter, 'value_two'); $settings = Arr::get($filter, 'settings'); $positive = Arr::get($filter, 'positive'); switch ($operator) { case 'IN': $method = 'whereIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NOT_IN': $method = 'whereNotIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NULL': $method = 'whereNull'; break; case 'NOT_NULL': $method = 'whereNotNull'; break; } return [ 'operator' => $operator, 'method' => $method, 'arguments' => $arguments, 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => $positive, ]; }
[ "public", "static", "function", "filterByUuid", "(", "$", "filter", ")", "{", "$", "operator", "=", "Arr", "::", "get", "(", "$", "filter", ",", "'operator'", ")", ";", "$", "method", "=", "Arr", "::", "get", "(", "$", "filter", ",", "'method'", ")",...
Filter by UUID. @return void @SuppressWarnings(PHPMD.UnusedLocalVariable) @SuppressWarnings(PHPMD.CyclomaticComplexity)
[ "Filter", "by", "UUID", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L740-L776
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.filterByString
public static function filterByString($filter) { $operator = Arr::get($filter, 'operator'); $method = Arr::get($filter, 'method'); $arguments = Arr::get($filter, 'arguments'); $value_one = Arr::get($filter, 'value_one'); $value_two = Arr::get($filter, 'value_two'); $settings = Arr::get($filter, 'settings'); $positive = Arr::get($filter, 'positive'); switch ($operator) { case '=': case '!=': $arguments = [$operator, $value_one]; break; case '*=*': case '*!=*': $operator = (stripos($operator, '!') !== false) ? 'not ' : ''; $operator .= 'like'; $arguments = [$operator, '%'.$value_one.'%']; break; case '*=': case '*!=': $operator = (stripos($operator, '!') !== false) ? 'not ' : ''; $operator .= 'like'; $arguments = [$operator, '%'.$value_one]; break; case '=*': case '!=*': $operator = (stripos($operator, '!') !== false) ? 'not ' : ''; $operator .= 'like'; $arguments = [$operator, $value_one.'%']; break; case 'EMPTY': $method = 'whereRaw'; $arguments = "%s = ''"; break; case 'NOT_EMPTY': $method = 'whereRaw'; $arguments = "%s != ''"; break; case 'IN': $method = 'whereIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NOT_IN': $method = 'whereNotIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NULL': $method = 'whereNull'; break; case 'NOT_NULL': $method = 'whereNotNull'; break; } return [ 'operator' => $operator, 'method' => $method, 'arguments' => $arguments, 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => $positive, ]; }
php
public static function filterByString($filter) { $operator = Arr::get($filter, 'operator'); $method = Arr::get($filter, 'method'); $arguments = Arr::get($filter, 'arguments'); $value_one = Arr::get($filter, 'value_one'); $value_two = Arr::get($filter, 'value_two'); $settings = Arr::get($filter, 'settings'); $positive = Arr::get($filter, 'positive'); switch ($operator) { case '=': case '!=': $arguments = [$operator, $value_one]; break; case '*=*': case '*!=*': $operator = (stripos($operator, '!') !== false) ? 'not ' : ''; $operator .= 'like'; $arguments = [$operator, '%'.$value_one.'%']; break; case '*=': case '*!=': $operator = (stripos($operator, '!') !== false) ? 'not ' : ''; $operator .= 'like'; $arguments = [$operator, '%'.$value_one]; break; case '=*': case '!=*': $operator = (stripos($operator, '!') !== false) ? 'not ' : ''; $operator .= 'like'; $arguments = [$operator, $value_one.'%']; break; case 'EMPTY': $method = 'whereRaw'; $arguments = "%s = ''"; break; case 'NOT_EMPTY': $method = 'whereRaw'; $arguments = "%s != ''"; break; case 'IN': $method = 'whereIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NOT_IN': $method = 'whereNotIn'; $arguments = [static::getListFromString($value_one)]; break; case 'NULL': $method = 'whereNull'; break; case 'NOT_NULL': $method = 'whereNotNull'; break; } return [ 'operator' => $operator, 'method' => $method, 'arguments' => $arguments, 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => $positive, ]; }
[ "public", "static", "function", "filterByString", "(", "$", "filter", ")", "{", "$", "operator", "=", "Arr", "::", "get", "(", "$", "filter", ",", "'operator'", ")", ";", "$", "method", "=", "Arr", "::", "get", "(", "$", "filter", ",", "'method'", ")...
Filter by string. @return void @SuppressWarnings(PHPMD.UnusedLocalVariable) @SuppressWarnings(PHPMD.CyclomaticComplexity)
[ "Filter", "by", "string", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L786-L852
train
hnhdigital-os/laravel-model-search
src/ModelSearch.php
ModelSearch.filterByScope
public static function filterByScope($filter) { $operator = Arr::get($filter, 'operator'); $method = Arr::get($filter, 'method'); $source = Arr::get($filter, 'settings.source'); $arguments = Arr::get($filter, 'arguments'); $value_one = Arr::get($filter, 'value_one'); $value_two = Arr::get($filter, 'value_two'); $settings = Arr::get($filter, 'settings'); $positive = Arr::get($filter, 'positive'); if (Arr::has($filter, 'settings.source')) { $model = Arr::get($filter, 'settings.model'); $method_transform = 'transform'.Str::studly($source).'Value'; if (method_exists($model, $method_transform)) { $value_one = $model->$method_transform($value_one); } $method_lookup = 'scope'.Str::studly($source); if (!method_exists($model, $method_lookup)) { return false; } $method = Str::camel($source); $arguments = [$value_one]; } return [ 'operator' => $operator, 'method' => $method, 'arguments' => $arguments, 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => $positive, ]; }
php
public static function filterByScope($filter) { $operator = Arr::get($filter, 'operator'); $method = Arr::get($filter, 'method'); $source = Arr::get($filter, 'settings.source'); $arguments = Arr::get($filter, 'arguments'); $value_one = Arr::get($filter, 'value_one'); $value_two = Arr::get($filter, 'value_two'); $settings = Arr::get($filter, 'settings'); $positive = Arr::get($filter, 'positive'); if (Arr::has($filter, 'settings.source')) { $model = Arr::get($filter, 'settings.model'); $method_transform = 'transform'.Str::studly($source).'Value'; if (method_exists($model, $method_transform)) { $value_one = $model->$method_transform($value_one); } $method_lookup = 'scope'.Str::studly($source); if (!method_exists($model, $method_lookup)) { return false; } $method = Str::camel($source); $arguments = [$value_one]; } return [ 'operator' => $operator, 'method' => $method, 'arguments' => $arguments, 'value_one' => $value_one, 'value_two' => $value_two, 'settings' => $settings, 'positive' => $positive, ]; }
[ "public", "static", "function", "filterByScope", "(", "$", "filter", ")", "{", "$", "operator", "=", "Arr", "::", "get", "(", "$", "filter", ",", "'operator'", ")", ";", "$", "method", "=", "Arr", "::", "get", "(", "$", "filter", ",", "'method'", ")"...
Filter by scope. @return void @SuppressWarnings(PHPMD.UnusedLocalVariable) @SuppressWarnings(PHPMD.CyclomaticComplexity)
[ "Filter", "by", "scope", "." ]
4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d
https://github.com/hnhdigital-os/laravel-model-search/blob/4e1b319b561eb2dfa4267a6a7cd4341ca51a1c0d/src/ModelSearch.php#L964-L1003
train