repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
superv/platform
src/Domains/Auth/Access/HasActions.php
HasActions.getAssignedActions
public function getAssignedActions() { $assigned = $this->roles->map( function (Role $role) { return $role->actions; } )->flatten(1)->merge($this->actions()->get()); return $assigned; }
php
public function getAssignedActions() { $assigned = $this->roles->map( function (Role $role) { return $role->actions; } )->flatten(1)->merge($this->actions()->get()); return $assigned; }
[ "public", "function", "getAssignedActions", "(", ")", "{", "$", "assigned", "=", "$", "this", "->", "roles", "->", "map", "(", "function", "(", "Role", "$", "role", ")", "{", "return", "$", "role", "->", "actions", ";", "}", ")", "->", "flatten", "("...
Get all assigned actions @return \Illuminate\Support\Collection
[ "Get", "all", "assigned", "actions" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/Access/HasActions.php#L184-L193
superv/platform
src/Domains/Auth/Access/HasActions.php
HasActions.getForbiddenActions
protected function getForbiddenActions() { $forbidden = $this->getAssignedActions()->filter(function (Action $action) { return $action->pivot->provision === 'fail'; })->pluck('slug')->all(); return $forbidden; }
php
protected function getForbiddenActions() { $forbidden = $this->getAssignedActions()->filter(function (Action $action) { return $action->pivot->provision === 'fail'; })->pluck('slug')->all(); return $forbidden; }
[ "protected", "function", "getForbiddenActions", "(", ")", "{", "$", "forbidden", "=", "$", "this", "->", "getAssignedActions", "(", ")", "->", "filter", "(", "function", "(", "Action", "$", "action", ")", "{", "return", "$", "action", "->", "pivot", "->", ...
Get only assigned actions that are forbidden @return array
[ "Get", "only", "assigned", "actions", "that", "are", "forbidden" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/Access/HasActions.php#L200-L207
superv/platform
src/Domains/Auth/Access/HasActions.php
HasActions.getAllowedActions
protected function getAllowedActions() { $allowed = $this->getAssignedActions()->filter(function (Action $action) { return $action->pivot->provision === 'pass'; })->pluck('slug')->all(); return $allowed; }
php
protected function getAllowedActions() { $allowed = $this->getAssignedActions()->filter(function (Action $action) { return $action->pivot->provision === 'pass'; })->pluck('slug')->all(); return $allowed; }
[ "protected", "function", "getAllowedActions", "(", ")", "{", "$", "allowed", "=", "$", "this", "->", "getAssignedActions", "(", ")", "->", "filter", "(", "function", "(", "Action", "$", "action", ")", "{", "return", "$", "action", "->", "pivot", "->", "p...
Get only assigned actions that are allowed @return array
[ "Get", "only", "assigned", "actions", "that", "are", "allowed" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/Access/HasActions.php#L214-L221
superv/platform
src/Domains/Database/Model/QueryBuilder.php
QueryBuilder.insert
public function insert(array $values) { // Since every insert gets treated like a batch insert, we will make sure the // bindings are structured in a way that is convenient when building these // inserts statements by verifying these elements are actually an array. if (empty($values)...
php
public function insert(array $values) { // Since every insert gets treated like a batch insert, we will make sure the // bindings are structured in a way that is convenient when building these // inserts statements by verifying these elements are actually an array. if (empty($values)...
[ "public", "function", "insert", "(", "array", "$", "values", ")", "{", "// Since every insert gets treated like a batch insert, we will make sure the", "// bindings are structured in a way that is convenient when building these", "// inserts statements by verifying these elements are actually ...
Insert a new record into the database. @param array $values @return bool
[ "Insert", "a", "new", "record", "into", "the", "database", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Database/Model/QueryBuilder.php#L16-L49
superv/platform
src/Exceptions/PlatformExceptionHandler.php
PlatformExceptionHandler.render
public function render($request, Exception $exception) { if ($exception instanceof PlatformException) { return $exception->toResponse(); } if ($exception instanceof ValidationException) { return $exception->toResponse(); } if ($request->isJson() && $...
php
public function render($request, Exception $exception) { if ($exception instanceof PlatformException) { return $exception->toResponse(); } if ($exception instanceof ValidationException) { return $exception->toResponse(); } if ($request->isJson() && $...
[ "public", "function", "render", "(", "$", "request", ",", "Exception", "$", "exception", ")", "{", "if", "(", "$", "exception", "instanceof", "PlatformException", ")", "{", "return", "$", "exception", "->", "toResponse", "(", ")", ";", "}", "if", "(", "$...
Render an exception into an HTTP response. @param \Illuminate\Http\Request $request @param \Exception $exception @return \Illuminate\Http\Response
[ "Render", "an", "exception", "into", "an", "HTTP", "response", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Exceptions/PlatformExceptionHandler.php#L40-L60
superv/platform
src/Exceptions/PlatformExceptionHandler.php
PlatformExceptionHandler.unauthenticated
protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); } abort(401); return redirect()->guest(route(\Platform::port()->slug().'::login')); }
php
protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); } abort(401); return redirect()->guest(route(\Platform::port()->slug().'::login')); }
[ "protected", "function", "unauthenticated", "(", "$", "request", ",", "AuthenticationException", "$", "exception", ")", "{", "if", "(", "$", "request", "->", "expectsJson", "(", ")", ")", "{", "return", "response", "(", ")", "->", "json", "(", "[", "'error...
Convert an authentication exception into an unauthenticated response. @param \Illuminate\Http\Request $request @param \Illuminate\Auth\AuthenticationException $exception @return \Illuminate\Http\Response
[ "Convert", "an", "authentication", "exception", "into", "an", "unauthenticated", "response", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Exceptions/PlatformExceptionHandler.php#L69-L78
superv/platform
src/Support/Current.php
Current.user
public function user() { if (! $this->user) { $this->user = app(Users::class)->find(auth()->guard()->id()); } return $this->user; }
php
public function user() { if (! $this->user) { $this->user = app(Users::class)->find(auth()->guard()->id()); } return $this->user; }
[ "public", "function", "user", "(", ")", "{", "if", "(", "!", "$", "this", "->", "user", ")", "{", "$", "this", "->", "user", "=", "app", "(", "Users", "::", "class", ")", "->", "find", "(", "auth", "(", ")", "->", "guard", "(", ")", "->", "id...
Return the current logged in user @return \SuperV\Platform\Domains\Auth\Contracts\User
[ "Return", "the", "current", "logged", "in", "user" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Support/Current.php#L35-L42
superv/platform
src/Support/Current.php
Current.url
public function url(string $path = null): string { return $path ? sv_url($path) : sv_url()->current(); }
php
public function url(string $path = null): string { return $path ? sv_url($path) : sv_url()->current(); }
[ "public", "function", "url", "(", "string", "$", "path", "=", "null", ")", ":", "string", "{", "return", "$", "path", "?", "sv_url", "(", "$", "path", ")", ":", "sv_url", "(", ")", "->", "current", "(", ")", ";", "}" ]
Return the current url of the active port
[ "Return", "the", "current", "url", "of", "the", "active", "port" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Support/Current.php#L55-L58
superv/platform
src/Domains/Auth/AuthServiceProvider.php
AuthServiceProvider.aliasMiddleware
protected function aliasMiddleware() { $router = $this->app['router']; $method = method_exists($router, 'aliasMiddleware') ? 'aliasMiddleware' : 'middleware'; $router->$method('sv.auth', PlatformAuthenticate::class); }
php
protected function aliasMiddleware() { $router = $this->app['router']; $method = method_exists($router, 'aliasMiddleware') ? 'aliasMiddleware' : 'middleware'; $router->$method('sv.auth', PlatformAuthenticate::class); }
[ "protected", "function", "aliasMiddleware", "(", ")", "{", "$", "router", "=", "$", "this", "->", "app", "[", "'router'", "]", ";", "$", "method", "=", "method_exists", "(", "$", "router", ",", "'aliasMiddleware'", ")", "?", "'aliasMiddleware'", ":", "'mid...
Alias the middleware. @return void
[ "Alias", "the", "middleware", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/AuthServiceProvider.php#L79-L86
superv/platform
src/Platform.php
Platform.boot
public function boot() { $entries = AddonModel::query() ->where('enabled', true) ->get(); /** @var AddonModel $entry */ foreach ($entries as $entry) { if ($addon = $entry->resolveAddon()) { $addon->boot();...
php
public function boot() { $entries = AddonModel::query() ->where('enabled', true) ->get(); /** @var AddonModel $entry */ foreach ($entries as $entry) { if ($addon = $entry->resolveAddon()) { $addon->boot();...
[ "public", "function", "boot", "(", ")", "{", "$", "entries", "=", "AddonModel", "::", "query", "(", ")", "->", "where", "(", "'enabled'", ",", "true", ")", "->", "get", "(", ")", ";", "/** @var AddonModel $entry */", "foreach", "(", "$", "entries", "as",...
Boot enabled addons
[ "Boot", "enabled", "addons" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Platform.php#L28-L42
illuminate/support
Env.php
Env.get
public static function get($key, $default = null) { static $variables; if ($variables === null) { $variables = (new DotenvFactory([new EnvConstAdapter, new PutenvAdapter, new ServerConstAdapter]))->createImmutable(); } return Option::fromValue($variables->get($key)) ...
php
public static function get($key, $default = null) { static $variables; if ($variables === null) { $variables = (new DotenvFactory([new EnvConstAdapter, new PutenvAdapter, new ServerConstAdapter]))->createImmutable(); } return Option::fromValue($variables->get($key)) ...
[ "public", "static", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "static", "$", "variables", ";", "if", "(", "$", "variables", "===", "null", ")", "{", "$", "variables", "=", "(", "new", "DotenvFactory", "(", "[", ...
Gets the value of an environment variable. @param string $key @param mixed $default @return mixed
[ "Gets", "the", "value", "of", "an", "environment", "variable", "." ]
train
https://github.com/illuminate/support/blob/fe658b6365fdd2d9cfe50c207f262d93bf3cfd3d/Env.php#L20-L54
SnowdogApps/magento2-menu
Controller/Adminhtml/Menu/Delete.php
Delete.execute
public function execute() { $id = $this->getRequest()->getParam('id'); try { $menu = $this->menuRepository->getById($id); $this->menuRepository->deleteById($id); $filterBuilder = $this->filterBuilderFactory->create(); $filter = $filterBuilder->setFie...
php
public function execute() { $id = $this->getRequest()->getParam('id'); try { $menu = $this->menuRepository->getById($id); $this->menuRepository->deleteById($id); $filterBuilder = $this->filterBuilderFactory->create(); $filter = $filterBuilder->setFie...
[ "public", "function", "execute", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParam", "(", "'id'", ")", ";", "try", "{", "$", "menu", "=", "$", "this", "->", "menuRepository", "->", "getById", "(", "$", "id", ...
Dispatch request @return \Magento\Framework\Controller\ResultInterface|ResponseInterface @throws \Magento\Framework\Exception\NotFoundException
[ "Dispatch", "request" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Controller/Adminhtml/Menu/Delete.php#L60-L89
SnowdogApps/magento2-menu
Block/Menu.php
Menu.buildAttrFromArray
public function buildAttrFromArray(array $array) { $attributes = []; foreach ($array as $attribute => $data) { if (is_array($data)) { $data = implode(' ', $data); } $attributes[] = $attribute . '="' . htmlspecialchars($data) . '"'; } ...
php
public function buildAttrFromArray(array $array) { $attributes = []; foreach ($array as $attribute => $data) { if (is_array($data)) { $data = implode(' ', $data); } $attributes[] = $attribute . '="' . htmlspecialchars($data) . '"'; } ...
[ "public", "function", "buildAttrFromArray", "(", "array", "$", "array", ")", "{", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "attribute", "=>", "$", "data", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", ...
Builds HTML tag attributes from an array of attributes data @param array $array @return string
[ "Builds", "HTML", "tag", "attributes", "from", "an", "array", "of", "attributes", "data" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/Menu.php#L315-L328
SnowdogApps/magento2-menu
Model/NodeType/Category.php
Category.fetchConfigData
public function fetchConfigData() { $this->profiler->start(__METHOD__); $metadata = $this->metadataPool->getMetadata(CategoryInterface::class); $identifierField = $metadata->getIdentifierField(); $data = $this->getResource()->fetchConfigData(); $labels = []; foreach...
php
public function fetchConfigData() { $this->profiler->start(__METHOD__); $metadata = $this->metadataPool->getMetadata(CategoryInterface::class); $identifierField = $metadata->getIdentifierField(); $data = $this->getResource()->fetchConfigData(); $labels = []; foreach...
[ "public", "function", "fetchConfigData", "(", ")", "{", "$", "this", "->", "profiler", "->", "start", "(", "__METHOD__", ")", ";", "$", "metadata", "=", "$", "this", "->", "metadataPool", "->", "getMetadata", "(", "CategoryInterface", "::", "class", ")", "...
{@inheritdoc} @throws \Exception
[ "{" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Model/NodeType/Category.php#L51-L89
SnowdogApps/magento2-menu
Controller/Adminhtml/Menu/Create.php
Create.execute
public function execute() { $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $result->setActiveMenu('Snowdog_Menu::menus'); $result->getConfig()->getTitle()->prepend(__('Create new menu')); return $result; }
php
public function execute() { $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $result->setActiveMenu('Snowdog_Menu::menus'); $result->getConfig()->getTitle()->prepend(__('Create new menu')); return $result; }
[ "public", "function", "execute", "(", ")", "{", "$", "result", "=", "$", "this", "->", "resultFactory", "->", "create", "(", "ResultFactory", "::", "TYPE_PAGE", ")", ";", "$", "result", "->", "setActiveMenu", "(", "'Snowdog_Menu::menus'", ")", ";", "$", "r...
Dispatch request @return \Magento\Framework\Controller\ResultInterface|ResponseInterface @throws \Magento\Framework\Exception\NotFoundException
[ "Dispatch", "request" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Controller/Adminhtml/Menu/Create.php#L18-L24
SnowdogApps/magento2-menu
Setup/UpgradeSchema.php
UpgradeSchema.upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '0.1.0', '<')) { $this->changeTitleType($setup); } if (version_compare($context->getVersion(), '0.2.0', '<')) { ...
php
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '0.1.0', '<')) { $this->changeTitleType($setup); } if (version_compare($context->getVersion(), '0.2.0', '<')) { ...
[ "public", "function", "upgrade", "(", "SchemaSetupInterface", "$", "setup", ",", "ModuleContextInterface", "$", "context", ")", "{", "$", "setup", "->", "startSetup", "(", ")", ";", "if", "(", "version_compare", "(", "$", "context", "->", "getVersion", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Setup/UpgradeSchema.php#L23-L48
SnowdogApps/magento2-menu
Model/ResourceModel/NodeType/Category.php
Category.fetchData
public function fetchData($storeId = Store::DEFAULT_STORE_ID, $categoryIds = []) { $connection = $this->getConnection('read'); $table = $this->getTable('url_rewrite'); $select = $connection ->select() ->from($table, ['entity_id', 'request_path']) ->where('...
php
public function fetchData($storeId = Store::DEFAULT_STORE_ID, $categoryIds = []) { $connection = $this->getConnection('read'); $table = $this->getTable('url_rewrite'); $select = $connection ->select() ->from($table, ['entity_id', 'request_path']) ->where('...
[ "public", "function", "fetchData", "(", "$", "storeId", "=", "Store", "::", "DEFAULT_STORE_ID", ",", "$", "categoryIds", "=", "[", "]", ")", "{", "$", "connection", "=", "$", "this", "->", "getConnection", "(", "'read'", ")", ";", "$", "table", "=", "$...
@param int $storeId @param array $categoryIds @return array
[ "@param", "int", "$storeId", "@param", "array", "$categoryIds" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Model/ResourceModel/NodeType/Category.php#L90-L103
SnowdogApps/magento2-menu
Model/ResourceModel/NodeType/AbstractNode.php
AbstractNode.getTable
public function getTable($tableName) { if (is_array($tableName)) { list($tableName, $entitySuffix) = $tableName; } else { $entitySuffix = null; } if ($entitySuffix !== null) { $tableName .= '_' . $entitySuffix; } if (!isset($this-...
php
public function getTable($tableName) { if (is_array($tableName)) { list($tableName, $entitySuffix) = $tableName; } else { $entitySuffix = null; } if ($entitySuffix !== null) { $tableName .= '_' . $entitySuffix; } if (!isset($this-...
[ "public", "function", "getTable", "(", "$", "tableName", ")", "{", "if", "(", "is_array", "(", "$", "tableName", ")", ")", "{", "list", "(", "$", "tableName", ",", "$", "entitySuffix", ")", "=", "$", "tableName", ";", "}", "else", "{", "$", "entitySu...
Get real table name for db table, validated by db adapter @param string $tableName @return string @api
[ "Get", "real", "table", "name", "for", "db", "table", "validated", "by", "db", "adapter" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Model/ResourceModel/NodeType/AbstractNode.php#L62-L82
SnowdogApps/magento2-menu
Block/NodeType/CustomUrl.php
CustomUrl.getHtml
public function getHtml($nodeId, $level) { $classes = $level == 0 ? 'level-top' : ''; $node = $this->nodes[$nodeId]; $url = $this->_storeManager->getStore()->getBaseUrl() . $node->getContent(); $title = $node->getTitle(); return <<<HTML <a href="$url" class="$classes" role="...
php
public function getHtml($nodeId, $level) { $classes = $level == 0 ? 'level-top' : ''; $node = $this->nodes[$nodeId]; $url = $this->_storeManager->getStore()->getBaseUrl() . $node->getContent(); $title = $node->getTitle(); return <<<HTML <a href="$url" class="$classes" role="...
[ "public", "function", "getHtml", "(", "$", "nodeId", ",", "$", "level", ")", "{", "$", "classes", "=", "$", "level", "==", "0", "?", "'level-top'", ":", "''", ";", "$", "node", "=", "$", "this", "->", "nodes", "[", "$", "nodeId", "]", ";", "$", ...
@param int $nodeId @param int $level @return string
[ "@param", "int", "$nodeId", "@param", "int", "$level" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/NodeType/CustomUrl.php#L80-L90
SnowdogApps/magento2-menu
Controller/Adminhtml/Menu/Save.php
Save.execute
public function execute() { $id = $this->getRequest()->getParam('id'); if ($id) { $menu = $this->menuRepository->getById($id); } else { $menu = $this->menuFactory->create(); } $menu->setTitle($this->getRequest()->getParam('title')); $menu->setI...
php
public function execute() { $id = $this->getRequest()->getParam('id'); if ($id) { $menu = $this->menuRepository->getById($id); } else { $menu = $this->menuFactory->create(); } $menu->setTitle($this->getRequest()->getParam('title')); $menu->setI...
[ "public", "function", "execute", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParam", "(", "'id'", ")", ";", "if", "(", "$", "id", ")", "{", "$", "menu", "=", "$", "this", "->", "menuRepository", "->", "getB...
Dispatch request @return \Magento\Framework\Controller\ResultInterface|ResponseInterface @throws \Magento\Framework\Exception\NotFoundException
[ "Dispatch", "request" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Controller/Adminhtml/Menu/Save.php#L83-L208
SnowdogApps/magento2-menu
Controller/Adminhtml/Menu/Edit.php
Edit.execute
public function execute() { $id = $this->getRequest()->getParam('id'); try { $model = $this->menuRepository->getById($id); $this->registry->register(self::REGISTRY_CODE, $model); $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $result...
php
public function execute() { $id = $this->getRequest()->getParam('id'); try { $model = $this->menuRepository->getById($id); $this->registry->register(self::REGISTRY_CODE, $model); $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $result...
[ "public", "function", "execute", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParam", "(", "'id'", ")", ";", "try", "{", "$", "model", "=", "$", "this", "->", "menuRepository", "->", "getById", "(", "$", "id",...
Dispatch request @return \Magento\Framework\Controller\ResultInterface|ResponseInterface @throws \Magento\Framework\Exception\NotFoundException
[ "Dispatch", "request" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Controller/Adminhtml/Menu/Edit.php#L38-L53
SnowdogApps/magento2-menu
Block/NodeType/CmsBlock.php
CmsBlock.getHtml
public function getHtml($nodeId, $level) { $node = $this->nodes[$nodeId]; $storeId = $this->_storeManager->getStore()->getId(); if (isset($this->content[$node->getContent()])) { $content = $this->content[$node->getContent()]; $content = $this->filterProvider->getBloc...
php
public function getHtml($nodeId, $level) { $node = $this->nodes[$nodeId]; $storeId = $this->_storeManager->getStore()->getId(); if (isset($this->content[$node->getContent()])) { $content = $this->content[$node->getContent()]; $content = $this->filterProvider->getBloc...
[ "public", "function", "getHtml", "(", "$", "nodeId", ",", "$", "level", ")", "{", "$", "node", "=", "$", "this", "->", "nodes", "[", "$", "nodeId", "]", ";", "$", "storeId", "=", "$", "this", "->", "_storeManager", "->", "getStore", "(", ")", "->",...
@param int $nodeId @param int $level @return mixed|string
[ "@param", "int", "$nodeId", "@param", "int", "$level" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/NodeType/CmsBlock.php#L90-L103
SnowdogApps/magento2-menu
Model/NodeType/AbstractNode.php
AbstractNode.getResource
protected function getResource() { if (empty($this->_resourceName) && empty($this->_resource)) { throw new LocalizedException( new Phrase('The resource isn\'t set.') ); } return $this->_resource ?: ObjectManager::getInstance()->get($this->_resourceNam...
php
protected function getResource() { if (empty($this->_resourceName) && empty($this->_resource)) { throw new LocalizedException( new Phrase('The resource isn\'t set.') ); } return $this->_resource ?: ObjectManager::getInstance()->get($this->_resourceNam...
[ "protected", "function", "getResource", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_resourceName", ")", "&&", "empty", "(", "$", "this", "->", "_resource", ")", ")", "{", "throw", "new", "LocalizedException", "(", "new", "Phrase", "(", ...
Get resource instance @throws LocalizedException @return \Snowdog\Menu\Model\ResourceModel\NodeType\AbstractNode
[ "Get", "resource", "instance" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Model/NodeType/AbstractNode.php#L92-L101
SnowdogApps/magento2-menu
Block/NodeType/Category.php
Category.getHtml
public function getHtml($nodeId, $level, $storeId = null) { $classes = $level == 0 ? 'level-top' : ''; $node = $this->nodes[$nodeId]; $url = $this->getCategoryUrl($nodeId, $storeId); $title = $node->getTitle(); return <<<HTML <a href="$url" class="$classes" role="menuitem"><...
php
public function getHtml($nodeId, $level, $storeId = null) { $classes = $level == 0 ? 'level-top' : ''; $node = $this->nodes[$nodeId]; $url = $this->getCategoryUrl($nodeId, $storeId); $title = $node->getTitle(); return <<<HTML <a href="$url" class="$classes" role="menuitem"><...
[ "public", "function", "getHtml", "(", "$", "nodeId", ",", "$", "level", ",", "$", "storeId", "=", "null", ")", "{", "$", "classes", "=", "$", "level", "==", "0", "?", "'level-top'", ":", "''", ";", "$", "node", "=", "$", "this", "->", "nodes", "[...
@param int $nodeId @param int $level @param int $storeId @return string
[ "@param", "int", "$nodeId", "@param", "int", "$level", "@param", "int", "$storeId" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/NodeType/Category.php#L160-L170
SnowdogApps/magento2-menu
Block/NodeType/AbstractNode.php
AbstractNode.getNodeAttribute
public function getNodeAttribute($key) { if (array_key_exists($key, $this->nodeAttributes)) { return $this->nodeAttributes[$key]; } return new DataObject(); }
php
public function getNodeAttribute($key) { if (array_key_exists($key, $this->nodeAttributes)) { return $this->nodeAttributes[$key]; } return new DataObject(); }
[ "public", "function", "getNodeAttribute", "(", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "nodeAttributes", ")", ")", "{", "return", "$", "this", "->", "nodeAttributes", "[", "$", "key", "]", ";", "}",...
@param $key @return DataObject
[ "@param", "$key" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/NodeType/AbstractNode.php#L91-L98
SnowdogApps/magento2-menu
Block/NodeType/AbstractNode.php
AbstractNode.removeNodeAttribute
public function removeNodeAttribute($key) { if (array_key_exists($key, $this->nodeAttributes)) { unset($this->nodeAttributes[$key]); return true; } return false; }
php
public function removeNodeAttribute($key) { if (array_key_exists($key, $this->nodeAttributes)) { unset($this->nodeAttributes[$key]); return true; } return false; }
[ "public", "function", "removeNodeAttribute", "(", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "nodeAttributes", ")", ")", "{", "unset", "(", "$", "this", "->", "nodeAttributes", "[", "$", "key", "]", ")...
@param $key @return bool
[ "@param", "$key" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/NodeType/AbstractNode.php#L121-L130
SnowdogApps/magento2-menu
Model/NodeTypeProvider.php
NodeTypeProvider.render
public function render($type, $id, $level) { return $this->providers[$type]->getHtml($id, $level); }
php
public function render($type, $id, $level) { return $this->providers[$type]->getHtml($id, $level); }
[ "public", "function", "render", "(", "$", "type", ",", "$", "id", ",", "$", "level", ")", "{", "return", "$", "this", "->", "providers", "[", "$", "type", "]", "->", "getHtml", "(", "$", "id", ",", "$", "level", ")", ";", "}" ]
@param $type @param $id @param $level @return mixed
[ "@param", "$type", "@param", "$id", "@param", "$level" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Model/NodeTypeProvider.php#L47-L50
SnowdogApps/magento2-menu
Block/NodeType/CmsPage.php
CmsPage.getHtml
public function getHtml($nodeId, $level) { $classes = $level == 0 ? 'level-top' : ''; $node = $this->nodes[$nodeId]; if (isset($this->pageIds[$node->getContent()])) { $pageId = $this->pageIds[$node->getContent()]; $url = $this->_storeManager->getStore()->getBaseUrl()...
php
public function getHtml($nodeId, $level) { $classes = $level == 0 ? 'level-top' : ''; $node = $this->nodes[$nodeId]; if (isset($this->pageIds[$node->getContent()])) { $pageId = $this->pageIds[$node->getContent()]; $url = $this->_storeManager->getStore()->getBaseUrl()...
[ "public", "function", "getHtml", "(", "$", "nodeId", ",", "$", "level", ")", "{", "$", "classes", "=", "$", "level", "==", "0", "?", "'level-top'", ":", "''", ";", "$", "node", "=", "$", "this", "->", "nodes", "[", "$", "nodeId", "]", ";", "if", ...
@param int $nodeId @param int $level @return string
[ "@param", "int", "$nodeId", "@param", "int", "$level" ]
train
https://github.com/SnowdogApps/magento2-menu/blob/75b9ec2e9ee858d41cf11b2fdd724dc89b49f5f3/Block/NodeType/CmsPage.php#L151-L168
calcinai/xero-php
src/XeroPHP/Webhook/Event.php
Event.getResource
public function getResource($application = null) { if ($application === null) { $application = $this->getWebhook()->getApplication(); } $url = new URL($application, $this->getResourceUrl()); $request = new Request($application, $url, Request::METHOD_GET); $reques...
php
public function getResource($application = null) { if ($application === null) { $application = $this->getWebhook()->getApplication(); } $url = new URL($application, $this->getResourceUrl()); $request = new Request($application, $url, Request::METHOD_GET); $reques...
[ "public", "function", "getResource", "(", "$", "application", "=", "null", ")", "{", "if", "(", "$", "application", "===", "null", ")", "{", "$", "application", "=", "$", "this", "->", "getWebhook", "(", ")", "->", "getApplication", "(", ")", ";", "}",...
Fetches the resource and, if possible, loads it into it's respective model class @param \XeroPHP\Application $application an optional application instance to use to retrieve the remote resource. Useful if you have separate instances with different oauth tokens based on the tenant @return \XeroPHP\Remote\Model|array I...
[ "Fetches", "the", "resource", "and", "if", "possible", "loads", "it", "into", "it", "s", "respective", "model", "class" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Webhook/Event.php#L171-L192
calcinai/xero-php
src/XeroPHP/Application.php
Application.loadByGUID
public function loadByGUID($model, $guid) { /** * @var Remote\Model */ $class = $this->validateModelClass($model); $uri = sprintf('%s/%s', $class::getResourceURI(), $guid); $api = $class::getAPIStem(); $url = new URL($this, $uri, $api); $request = ...
php
public function loadByGUID($model, $guid) { /** * @var Remote\Model */ $class = $this->validateModelClass($model); $uri = sprintf('%s/%s', $class::getResourceURI(), $guid); $api = $class::getAPIStem(); $url = new URL($this, $uri, $api); $request = ...
[ "public", "function", "loadByGUID", "(", "$", "model", ",", "$", "guid", ")", "{", "/**\n * @var Remote\\Model\n */", "$", "class", "=", "$", "this", "->", "validateModelClass", "(", "$", "model", ")", ";", "$", "uri", "=", "sprintf", "(", "'...
As you should never have a GUID for a non-existent object, will throw a NotFoundExceptioon @param $model @param $guid @throws Exception @throws Remote\Exception\NotFoundException @return Remote\Model|null
[ "As", "you", "should", "never", "have", "a", "GUID", "for", "a", "non", "-", "existent", "object", "will", "throw", "a", "NotFoundExceptioon" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Application.php#L192-L218
calcinai/xero-php
src/XeroPHP/Application.php
Application.loadByGUIDs
public function loadByGUIDs($model, $guids) { /** * @var Remote\Model */ $class = $this->validateModelClass($model); $uri = sprintf('%s', $class::getResourceURI()); $api = $class::getAPIStem(); $url = new URL($this, $uri, $api); $request = new Requ...
php
public function loadByGUIDs($model, $guids) { /** * @var Remote\Model */ $class = $this->validateModelClass($model); $uri = sprintf('%s', $class::getResourceURI()); $api = $class::getAPIStem(); $url = new URL($this, $uri, $api); $request = new Requ...
[ "public", "function", "loadByGUIDs", "(", "$", "model", ",", "$", "guids", ")", "{", "/**\n * @var Remote\\Model\n */", "$", "class", "=", "$", "this", "->", "validateModelClass", "(", "$", "model", ")", ";", "$", "uri", "=", "sprintf", "(", ...
Filter by comma separated string of guid's @param $model @param string $guids @throws Exception @throws Remote\Exception\NotFoundException @return Collection
[ "Filter", "by", "comma", "separated", "string", "of", "guid", "s" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Application.php#L229-L254
calcinai/xero-php
src/XeroPHP/Application.php
Application.savePropertiesDirectly
private function savePropertiesDirectly(Remote\Model $object) { foreach ($object::getProperties() as $property_name => $meta) { if ($meta[Remote\Model::KEY_SAVE_DIRECTLY] && $object->isDirty($property_name)) { //Then actually save $property_objects = $object->$pro...
php
private function savePropertiesDirectly(Remote\Model $object) { foreach ($object::getProperties() as $property_name => $meta) { if ($meta[Remote\Model::KEY_SAVE_DIRECTLY] && $object->isDirty($property_name)) { //Then actually save $property_objects = $object->$pro...
[ "private", "function", "savePropertiesDirectly", "(", "Remote", "\\", "Model", "$", "object", ")", "{", "foreach", "(", "$", "object", "::", "getProperties", "(", ")", "as", "$", "property_name", "=>", "$", "meta", ")", "{", "if", "(", "$", "meta", "[", ...
Function to save properties directly which do not update via a POST. This is called automatically from the save method for things like adding contacts to ContactGroups @param Remote\Model $object @throws Exception
[ "Function", "to", "save", "properties", "directly", "which", "do", "not", "update", "via", "a", "POST", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Application.php#L384-L419
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.sign
public function sign(Request $request) { $oauth_params = $this->getOAuthParams(); $oauth_params['oauth_signature'] = $this->getSignature($request); //put it where it needs to go in the request switch ($this->config['signature_location']) { case self::SIGN_LOCATION_HEADER...
php
public function sign(Request $request) { $oauth_params = $this->getOAuthParams(); $oauth_params['oauth_signature'] = $this->getSignature($request); //put it where it needs to go in the request switch ($this->config['signature_location']) { case self::SIGN_LOCATION_HEADER...
[ "public", "function", "sign", "(", "Request", "$", "request", ")", "{", "$", "oauth_params", "=", "$", "this", "->", "getOAuthParams", "(", ")", ";", "$", "oauth_params", "[", "'oauth_signature'", "]", "=", "$", "this", "->", "getSignature", "(", "$", "r...
This actually signs the request. It can be called multiple times (for different requests) on the same instance of the client. This method puts it in the oauth params in the Authorization header by default. @param Request $request Request to sign @throws Exception
[ "This", "actually", "signs", "the", "request", ".", "It", "can", "be", "called", "multiple", "times", "(", "for", "different", "requests", ")", "on", "the", "same", "instance", "of", "the", "client", ".", "This", "method", "puts", "it", "in", "the", "oau...
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L55-L85
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.getOAuthParams
private function getOAuthParams() { //this needs to be stateful until the request is signed, then it gets unset if (! isset($this->oauth_params)) { $this->oauth_params = [ 'oauth_consumer_key' => $this->getConsumerKey(), 'oauth_signature_method' => $this->...
php
private function getOAuthParams() { //this needs to be stateful until the request is signed, then it gets unset if (! isset($this->oauth_params)) { $this->oauth_params = [ 'oauth_consumer_key' => $this->getConsumerKey(), 'oauth_signature_method' => $this->...
[ "private", "function", "getOAuthParams", "(", ")", "{", "//this needs to be stateful until the request is signed, then it gets unset", "if", "(", "!", "isset", "(", "$", "this", "->", "oauth_params", ")", ")", "{", "$", "this", "->", "oauth_params", "=", "[", "'oaut...
Gets the skeleton Oauth parameter array. The only one missing is the actual oauth_signature, which should get populated from this data and then merged into it. @return array
[ "Gets", "the", "skeleton", "Oauth", "parameter", "array", ".", "The", "only", "one", "missing", "is", "the", "actual", "oauth_signature", "which", "should", "get", "populated", "from", "this", "data", "and", "then", "merged", "into", "it", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L103-L125
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.getSignature
private function getSignature(Request $request) { switch ($this->getSignatureMethod()) { case self::SIGNATURE_RSA_SHA1: $signature = RSASHA1::generateSignature( $this->config, $this->getSBS($request), $this->getSigningSe...
php
private function getSignature(Request $request) { switch ($this->getSignatureMethod()) { case self::SIGNATURE_RSA_SHA1: $signature = RSASHA1::generateSignature( $this->config, $this->getSBS($request), $this->getSigningSe...
[ "private", "function", "getSignature", "(", "Request", "$", "request", ")", "{", "switch", "(", "$", "this", "->", "getSignatureMethod", "(", ")", ")", "{", "case", "self", "::", "SIGNATURE_RSA_SHA1", ":", "$", "signature", "=", "RSASHA1", "::", "generateSig...
Call the appropriate signature method's signing function. Not all mechanisms use all of the parameters, but for consistency, pass the same constructor to each one. @param Request $request @throws Exception @return string
[ "Call", "the", "appropriate", "signature", "method", "s", "signing", "function", ".", "Not", "all", "mechanisms", "use", "all", "of", "the", "parameters", "but", "for", "consistency", "pass", "the", "same", "constructor", "to", "each", "one", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L136-L170
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.getSBS
public function getSBS(Request $request) { $oauth_params = $this->getOAuthParams(); $sbs_params = array_merge($request->getParameters(), $oauth_params); //Params need sorting so signing order is the same ksort($sbs_params); $sbs_string = Helpers::flattenAssocArray($sbs_param...
php
public function getSBS(Request $request) { $oauth_params = $this->getOAuthParams(); $sbs_params = array_merge($request->getParameters(), $oauth_params); //Params need sorting so signing order is the same ksort($sbs_params); $sbs_string = Helpers::flattenAssocArray($sbs_param...
[ "public", "function", "getSBS", "(", "Request", "$", "request", ")", "{", "$", "oauth_params", "=", "$", "this", "->", "getOAuthParams", "(", ")", ";", "$", "sbs_params", "=", "array_merge", "(", "$", "request", "->", "getParameters", "(", ")", ",", "$",...
Get the Signature Base String for signing. This is basically just all params (including the generated oauth ones) ordered by key, then concatenated with the method and URL GET&https%3A%2F%2Fapi.xero.com%2Fapi.xro%2F2.0%2FContacts&oauth_consumer etc. @param Request $request @return string
[ "Get", "the", "Signature", "Base", "String", "for", "signing", ".", "This", "is", "basically", "just", "all", "params", "(", "including", "the", "generated", "oauth", "ones", ")", "ordered", "by", "key", "then", "concatenated", "with", "the", "method", "and"...
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L181-L199
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.getSigningSecret
private function getSigningSecret() { $secret = $this->getConsumerSecret().'&'; if (null !== $token_secret = $this->getTokenSecret()) { $secret .= $token_secret; } return $secret; }
php
private function getSigningSecret() { $secret = $this->getConsumerSecret().'&'; if (null !== $token_secret = $this->getTokenSecret()) { $secret .= $token_secret; } return $secret; }
[ "private", "function", "getSigningSecret", "(", ")", "{", "$", "secret", "=", "$", "this", "->", "getConsumerSecret", "(", ")", ".", "'&'", ";", "if", "(", "null", "!==", "$", "token_secret", "=", "$", "this", "->", "getTokenSecret", "(", ")", ")", "{"...
This is the signing secret passed to HMAC and PLAINTEXT signing mechanisms. @return string
[ "This", "is", "the", "signing", "secret", "passed", "to", "HMAC", "and", "PLAINTEXT", "signing", "mechanisms", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L206-L215
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.getNonce
private function getNonce($length = 20) { $parts = explode('.', number_format(microtime(true), 22, '.', '')); if (! isset($parts[1])) { $parts[1] = 0; } $nonce = base_convert($parts[1], 10, 36); for ($i = 0; $i < $length - strlen($nonce); $i++) { $non...
php
private function getNonce($length = 20) { $parts = explode('.', number_format(microtime(true), 22, '.', '')); if (! isset($parts[1])) { $parts[1] = 0; } $nonce = base_convert($parts[1], 10, 36); for ($i = 0; $i < $length - strlen($nonce); $i++) { $non...
[ "private", "function", "getNonce", "(", "$", "length", "=", "20", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "number_format", "(", "microtime", "(", "true", ")", ",", "22", ",", "'.'", ",", "''", ")", ")", ";", "if", "(", "!", "isse...
Generic nonce generating function for the request. It's important that it's long enough as the spec says the server will reject any request that reuses one. @param int $length @return string
[ "Generic", "nonce", "generating", "function", "for", "the", "request", ".", "It", "s", "important", "that", "it", "s", "long", "enough", "as", "the", "spec", "says", "the", "server", "will", "reject", "any", "request", "that", "reuses", "one", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L226-L239
calcinai/xero-php
src/XeroPHP/Remote/OAuth/Client.php
Client.appendUrlQuery
protected function appendUrlQuery($url, $query) { $glue = $this->urlHasQuery($url) ? '&' : '?'; return $url.$glue.http_build_query($query); }
php
protected function appendUrlQuery($url, $query) { $glue = $this->urlHasQuery($url) ? '&' : '?'; return $url.$glue.http_build_query($query); }
[ "protected", "function", "appendUrlQuery", "(", "$", "url", ",", "$", "query", ")", "{", "$", "glue", "=", "$", "this", "->", "urlHasQuery", "(", "$", "url", ")", "?", "'&'", ":", "'?'", ";", "return", "$", "url", ".", "$", "glue", ".", "http_build...
Prepend URL with query string. @param string $url @param array $query @return string
[ "Prepend", "URL", "with", "query", "string", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/OAuth/Client.php#L320-L325
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.isDirty
public function isDirty($property = null) { if ($property === null) { return count($this->_dirty) > 0; } else { return isset($this->_dirty[$property]); } }
php
public function isDirty($property = null) { if ($property === null) { return count($this->_dirty) > 0; } else { return isset($this->_dirty[$property]); } }
[ "public", "function", "isDirty", "(", "$", "property", "=", "null", ")", "{", "if", "(", "$", "property", "===", "null", ")", "{", "return", "count", "(", "$", "this", "->", "_dirty", ")", ">", "0", ";", "}", "else", "{", "return", "isset", "(", ...
If there have been any properties changed since load @param null $property @return bool
[ "If", "there", "have", "been", "any", "properties", "changed", "since", "load" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L100-L107
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.setClean
public function setClean($property = null) { if ($property === null) { $this->_dirty = []; } else { unset($this->_dirty[$property]); } return $this; }
php
public function setClean($property = null) { if ($property === null) { $this->_dirty = []; } else { unset($this->_dirty[$property]); } return $this; }
[ "public", "function", "setClean", "(", "$", "property", "=", "null", ")", "{", "if", "(", "$", "property", "===", "null", ")", "{", "$", "this", "->", "_dirty", "=", "[", "]", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "_dirty", "[",...
Manually set a property as clean @param null $property @return self
[ "Manually", "set", "a", "property", "as", "clean" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L128-L137
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.fromStringArray
public function fromStringArray($input_array, $replace_data = false) { foreach (static::getProperties() as $property => $meta) { $type = $meta[self::KEY_TYPE]; $php_type = $meta[self::KEY_PHP_TYPE]; //If set and NOT replace data, continue if (! $replace_data ...
php
public function fromStringArray($input_array, $replace_data = false) { foreach (static::getProperties() as $property => $meta) { $type = $meta[self::KEY_TYPE]; $php_type = $meta[self::KEY_PHP_TYPE]; //If set and NOT replace data, continue if (! $replace_data ...
[ "public", "function", "fromStringArray", "(", "$", "input_array", ",", "$", "replace_data", "=", "false", ")", "{", "foreach", "(", "static", "::", "getProperties", "(", ")", "as", "$", "property", "=>", "$", "meta", ")", "{", "$", "type", "=", "$", "m...
Load an assoc array into the instance of the object $property => $value $replace_data - replace existing data @param $input_array @param $replace_data
[ "Load", "an", "assoc", "array", "into", "the", "instance", "of", "the", "object", "$property", "=", ">", "$value", "$replace_data", "-", "replace", "existing", "data" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L175-L216
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.toStringArray
public function toStringArray($dirty_only = false) { $out = []; foreach (static::getProperties() as $property => $meta) { if (! isset($this->_data[$property])) { continue; } //if we only want the dirty props, stop here if ($dirty_only ...
php
public function toStringArray($dirty_only = false) { $out = []; foreach (static::getProperties() as $property => $meta) { if (! isset($this->_data[$property])) { continue; } //if we only want the dirty props, stop here if ($dirty_only ...
[ "public", "function", "toStringArray", "(", "$", "dirty_only", "=", "false", ")", "{", "$", "out", "=", "[", "]", ";", "foreach", "(", "static", "::", "getProperties", "(", ")", "as", "$", "property", "=>", "$", "meta", ")", "{", "if", "(", "!", "i...
Convert the object into an array, and any non-primitives to string. @param mixed $dirty_only @return array
[ "Convert", "the", "object", "into", "an", "array", "and", "any", "non", "-", "primitives", "to", "string", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L224-L250
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.castToString
public static function castToString($type, $value) { if ($value === '') { return ''; } switch ($type) { case self::PROPERTY_TYPE_BOOLEAN: return $value ? 'true' : 'false'; case self::PROPERTY_TYPE_DATE: /** ...
php
public static function castToString($type, $value) { if ($value === '') { return ''; } switch ($type) { case self::PROPERTY_TYPE_BOOLEAN: return $value ? 'true' : 'false'; case self::PROPERTY_TYPE_DATE: /** ...
[ "public", "static", "function", "castToString", "(", "$", "type", ",", "$", "value", ")", "{", "if", "(", "$", "value", "===", "''", ")", "{", "return", "''", ";", "}", "switch", "(", "$", "type", ")", "{", "case", "self", "::", "PROPERTY_TYPE_BOOLEA...
Convert properties to strings, based on the types parsed. @param $type @param $value @return string
[ "Convert", "properties", "to", "strings", "based", "on", "the", "types", "parsed", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L260-L295
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.castFromString
public static function castFromString($type, $value, $php_type) { //Here should maybe handle locale specific tz overrides in the future. $timezone = null; switch ($type) { case self::PROPERTY_TYPE_INT: return (int) $value; case self::PROPERTY_TYPE_F...
php
public static function castFromString($type, $value, $php_type) { //Here should maybe handle locale specific tz overrides in the future. $timezone = null; switch ($type) { case self::PROPERTY_TYPE_INT: return (int) $value; case self::PROPERTY_TYPE_F...
[ "public", "static", "function", "castFromString", "(", "$", "type", ",", "$", "value", ",", "$", "php_type", ")", "{", "//Here should maybe handle locale specific tz overrides in the future.", "$", "timezone", "=", "null", ";", "switch", "(", "$", "type", ")", "{"...
Cast the values to PHP types. @param $type @param $value @param $php_type @return bool|\DateTimeInterface|float|int|string
[ "Cast", "the", "values", "to", "PHP", "types", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L305-L348
calcinai/xero-php
src/XeroPHP/Remote/Model.php
Model.validate
public function validate($check_children = true) { //validate foreach (static::getProperties() as $property => $meta) { $mandatory = $meta[self::KEY_MANDATORY]; //If it's got a GUID, it's already going to be valid almost all cases if (! $this->hasGUID() && $manda...
php
public function validate($check_children = true) { //validate foreach (static::getProperties() as $property => $meta) { $mandatory = $meta[self::KEY_MANDATORY]; //If it's got a GUID, it's already going to be valid almost all cases if (! $this->hasGUID() && $manda...
[ "public", "function", "validate", "(", "$", "check_children", "=", "true", ")", "{", "//validate", "foreach", "(", "static", "::", "getProperties", "(", ")", "as", "$", "property", "=>", "$", "meta", ")", "{", "$", "mandatory", "=", "$", "meta", "[", "...
Validate the object and (optionally) the child objects recursively. @param bool $check_children @throws Exception @return bool
[ "Validate", "the", "object", "and", "(", "optionally", ")", "the", "child", "objects", "recursively", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Model.php#L357-L393
calcinai/xero-php
src/XeroPHP/Models/Accounting/CreditNote.php
CreditNote.getSupportedMethods
public static function getSupportedMethods() { return [ Remote\Request::METHOD_POST, Remote\Request::METHOD_PUT, Remote\Request::METHOD_GET, ]; }
php
public static function getSupportedMethods() { return [ Remote\Request::METHOD_POST, Remote\Request::METHOD_PUT, Remote\Request::METHOD_GET, ]; }
[ "public", "static", "function", "getSupportedMethods", "(", ")", "{", "return", "[", "Remote", "\\", "Request", "::", "METHOD_POST", ",", "Remote", "\\", "Request", "::", "METHOD_PUT", ",", "Remote", "\\", "Request", "::", "METHOD_GET", ",", "]", ";", "}" ]
Get the supported methods
[ "Get", "the", "supported", "methods" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Models/Accounting/CreditNote.php#L198-L205
calcinai/xero-php
src/XeroPHP/Models/Accounting/Attachment.php
Attachment.getProperties
public static function getProperties() { return [ 'AttachmentID' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'FileName' => [true, self::PROPERTY_TYPE_STRING, null, false, false], 'Url' => [false, self::PROPERTY_TYPE_STRING, null, false, false], ...
php
public static function getProperties() { return [ 'AttachmentID' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'FileName' => [true, self::PROPERTY_TYPE_STRING, null, false, false], 'Url' => [false, self::PROPERTY_TYPE_STRING, null, false, false], ...
[ "public", "static", "function", "getProperties", "(", ")", "{", "return", "[", "'AttachmentID'", "=>", "[", "false", ",", "self", "::", "PROPERTY_TYPE_STRING", ",", "null", ",", "false", ",", "false", "]", ",", "'FileName'", "=>", "[", "true", ",", "self",...
Get a list of properties @return array
[ "Get", "a", "list", "of", "properties" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Models/Accounting/Attachment.php#L60-L69
calcinai/xero-php
src/XeroPHP/Models/Accounting/Attachment.php
Attachment.createFromLocalFile
public static function createFromLocalFile($file_name, $mime_type = null) { //Try to guess. Might be questionable on non-*nix machines if ($mime_type === null) { $finfo = new \finfo(FILEINFO_MIME_TYPE); $info = $finfo->file($file_name); if ($info !== false) { ...
php
public static function createFromLocalFile($file_name, $mime_type = null) { //Try to guess. Might be questionable on non-*nix machines if ($mime_type === null) { $finfo = new \finfo(FILEINFO_MIME_TYPE); $info = $finfo->file($file_name); if ($info !== false) { ...
[ "public", "static", "function", "createFromLocalFile", "(", "$", "file_name", ",", "$", "mime_type", "=", "null", ")", "{", "//Try to guess. Might be questionable on non-*nix machines", "if", "(", "$", "mime_type", "===", "null", ")", "{", "$", "finfo", "=", "new...
Do this with a file handle please
[ "Do", "this", "with", "a", "file", "handle", "please" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Models/Accounting/Attachment.php#L97-L122
calcinai/xero-php
src/XeroPHP/Remote/Collection.php
Collection.removeAt
public function removeAt($index) { if (isset($this[$index])) { foreach ($this->_associated_objects as $parent_property => $object) { /** * @var Model */ $object->setDirty($parent_property); } unset($this[$i...
php
public function removeAt($index) { if (isset($this[$index])) { foreach ($this->_associated_objects as $parent_property => $object) { /** * @var Model */ $object->setDirty($parent_property); } unset($this[$i...
[ "public", "function", "removeAt", "(", "$", "index", ")", "{", "if", "(", "isset", "(", "$", "this", "[", "$", "index", "]", ")", ")", "{", "foreach", "(", "$", "this", "->", "_associated_objects", "as", "$", "parent_property", "=>", "$", "object", "...
Remove an item at a specific index @param $index
[ "Remove", "an", "item", "at", "a", "specific", "index" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Collection.php#L26-L37
calcinai/xero-php
src/XeroPHP/Remote/Collection.php
Collection.remove
public function remove(Model $object) { foreach ($this as $index => $item) { if ($item === $object) { $this->removeAt($index); } } }
php
public function remove(Model $object) { foreach ($this as $index => $item) { if ($item === $object) { $this->removeAt($index); } } }
[ "public", "function", "remove", "(", "Model", "$", "object", ")", "{", "foreach", "(", "$", "this", "as", "$", "index", "=>", "$", "item", ")", "{", "if", "(", "$", "item", "===", "$", "object", ")", "{", "$", "this", "->", "removeAt", "(", "$", ...
Remove a specific object from the collection @param Model $object
[ "Remove", "a", "specific", "object", "from", "the", "collection" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Collection.php#L44-L51
calcinai/xero-php
src/XeroPHP/Remote/Collection.php
Collection.removeAll
public function removeAll() { foreach ($this->_associated_objects as $parent_property => $object) { /** * @var Model */ $object->setDirty($parent_property); } $this->exchangeArray([]); }
php
public function removeAll() { foreach ($this->_associated_objects as $parent_property => $object) { /** * @var Model */ $object->setDirty($parent_property); } $this->exchangeArray([]); }
[ "public", "function", "removeAll", "(", ")", "{", "foreach", "(", "$", "this", "->", "_associated_objects", "as", "$", "parent_property", "=>", "$", "object", ")", "{", "/**\n * @var Model\n */", "$", "object", "->", "setDirty", "(", "$", ...
Remove all of the values int he collection
[ "Remove", "all", "of", "the", "values", "int", "he", "collection" ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Remote/Collection.php#L56-L65
calcinai/xero-php
src/XeroPHP/Traits/PDFTrait.php
PDFTrait.buildPDFRequest
protected function buildPDFRequest() { return (new Request( $this->getApplication(), $this->buildPDFURL(), Request::METHOD_GET ))->setHeader( Request::HEADER_ACCEPT, Request::CONTENT_TYPE_PDF ); }
php
protected function buildPDFRequest() { return (new Request( $this->getApplication(), $this->buildPDFURL(), Request::METHOD_GET ))->setHeader( Request::HEADER_ACCEPT, Request::CONTENT_TYPE_PDF ); }
[ "protected", "function", "buildPDFRequest", "(", ")", "{", "return", "(", "new", "Request", "(", "$", "this", "->", "getApplication", "(", ")", ",", "$", "this", "->", "buildPDFURL", "(", ")", ",", "Request", "::", "METHOD_GET", ")", ")", "->", "setHeade...
Build a request for the resources PDF. @return \XeroPHP\Remote\Request
[ "Build", "a", "request", "for", "the", "resources", "PDF", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Traits/PDFTrait.php#L31-L41
calcinai/xero-php
src/XeroPHP/Helpers.php
Helpers.arrayToXML
public static function arrayToXML(array $array, $key_override = null) { $xml = ''; foreach ($array as $key => $element) { if (is_array($element)) { //recurse and replace. if (self::isAssoc($element)) { $element = self::arrayToXML($eleme...
php
public static function arrayToXML(array $array, $key_override = null) { $xml = ''; foreach ($array as $key => $element) { if (is_array($element)) { //recurse and replace. if (self::isAssoc($element)) { $element = self::arrayToXML($eleme...
[ "public", "static", "function", "arrayToXML", "(", "array", "$", "array", ",", "$", "key_override", "=", "null", ")", "{", "$", "xml", "=", "''", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "element", ")", "{", "if", "(", "is_ar...
Convert a multi-d assoc array into an xml representation. Straightforward <key>val</key> unless there are numeric keys, in which case, the parent key is singularised and used. @param array $array @param null $key_override @return string
[ "Convert", "a", "multi", "-", "d", "assoc", "array", "into", "an", "xml", "representation", ".", "Straightforward", "<key", ">", "val<", "/", "key", ">", "unless", "there", "are", "numeric", "keys", "in", "which", "case", "the", "parent", "key", "is", "s...
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Helpers.php#L24-L63
calcinai/xero-php
src/XeroPHP/Helpers.php
Helpers.singularize
public static function singularize($string) { $singular = [ '/(vert|ind)ices$/i' => '$1ex', '/(alias)es$/i' => '$1', '/(x|ch|ss|sh)es$/i' => '$1', '/(s)eries$/i' => '$1eries', '/(s)tatus$/i' => '$1tatus', '/([^aeiouy]|qu)ies$/i' => '$1y...
php
public static function singularize($string) { $singular = [ '/(vert|ind)ices$/i' => '$1ex', '/(alias)es$/i' => '$1', '/(x|ch|ss|sh)es$/i' => '$1', '/(s)eries$/i' => '$1eries', '/(s)tatus$/i' => '$1tatus', '/([^aeiouy]|qu)ies$/i' => '$1y...
[ "public", "static", "function", "singularize", "(", "$", "string", ")", "{", "$", "singular", "=", "[", "'/(vert|ind)ices$/i'", "=>", "'$1ex'", ",", "'/(alias)es$/i'", "=>", "'$1'", ",", "'/(x|ch|ss|sh)es$/i'", "=>", "'$1'", ",", "'/(s)eries$/i'", "=>", "'$1erie...
This function is based on Wave\Inflector::singularize(). It only contains a fraction of the rules from its predecessor, so only good for a quick basic singularisation. @param $string @return mixed
[ "This", "function", "is", "based", "on", "Wave", "\\", "Inflector", "::", "singularize", "()", ".", "It", "only", "contains", "a", "fraction", "of", "the", "rules", "from", "its", "predecessor", "so", "only", "good", "for", "a", "quick", "basic", "singular...
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Helpers.php#L101-L126
calcinai/xero-php
src/XeroPHP/Helpers.php
Helpers.flattenAssocArray
public static function flattenAssocArray( array $array, $format, $glue = null, $escape = false ) { $pairs = []; foreach ($array as $key => $val) { if ($escape) { $key = self::escape($key); $val = self::escape($val); ...
php
public static function flattenAssocArray( array $array, $format, $glue = null, $escape = false ) { $pairs = []; foreach ($array as $key => $val) { if ($escape) { $key = self::escape($key); $val = self::escape($val); ...
[ "public", "static", "function", "flattenAssocArray", "(", "array", "$", "array", ",", "$", "format", ",", "$", "glue", "=", "null", ",", "$", "escape", "=", "false", ")", "{", "$", "pairs", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$...
Generic function to flatten an associative array into an arbitrarily delimited string. @param array $array @param string $format @param string|null $glue @param bool $escape @return string|array if no glue provided, it won't be imploded
[ "Generic", "function", "to", "flatten", "an", "associative", "array", "into", "an", "arbitrarily", "delimited", "string", "." ]
train
https://github.com/calcinai/xero-php/blob/87df9ec43658ab9ff6914f7ec60d9a2afef2c1db/src/XeroPHP/Helpers.php#L174-L195
bobthecow/Ruler
src/Ruler/VariableProperty.php
VariableProperty.prepareValue
public function prepareValue(Context $context) { $name = $this->getName(); $value = $this->parent->prepareValue($context)->getValue(); if (is_object($value) && !$value instanceof \Closure) { if (method_exists($value, $name)) { return $this->asValue(call_user_fun...
php
public function prepareValue(Context $context) { $name = $this->getName(); $value = $this->parent->prepareValue($context)->getValue(); if (is_object($value) && !$value instanceof \Closure) { if (method_exists($value, $name)) { return $this->asValue(call_user_fun...
[ "public", "function", "prepareValue", "(", "Context", "$", "context", ")", "{", "$", "name", "=", "$", "this", "->", "getName", "(", ")", ";", "$", "value", "=", "$", "this", "->", "parent", "->", "prepareValue", "(", "$", "context", ")", "->", "getV...
Prepare a Value for this VariableProperty given the current Context. To retrieve a Value, the parent Variable is first resolved given the current context. Then, depending on its type, a method, property or offset of the parent Value is returned. If the parent Value is an object, and this VariableProperty name is "bar...
[ "Prepare", "a", "Value", "for", "this", "VariableProperty", "given", "the", "current", "Context", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/VariableProperty.php#L65-L83
bobthecow/Ruler
src/Ruler/Set.php
Set.setContains
public function setContains(Value $value) { if (is_array($value->getValue())) { foreach ($this->value as $val) { if ($val instanceof Set && $val == $value->getSet()) { return true; } } return false; ...
php
public function setContains(Value $value) { if (is_array($value->getValue())) { foreach ($this->value as $val) { if ($val instanceof Set && $val == $value->getSet()) { return true; } } return false; ...
[ "public", "function", "setContains", "(", "Value", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", "->", "getValue", "(", ")", ")", ")", "{", "foreach", "(", "$", "this", "->", "value", "as", "$", "val", ")", "{", "if", "(", "$"...
Set Contains comparison. @param Value $value Value object to compare against @return boolean
[ "Set", "Contains", "comparison", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L71-L85
bobthecow/Ruler
src/Ruler/Set.php
Set.union
public function union(Value $set) { $union = $this->value; /** @var Value $arg */ foreach (func_get_args() as $arg) { /** @var array $convertedArg */ $convertedArg = $arg->getSet()->getValue(); $union = array_merge($union, array_diff($convertedArg, $union...
php
public function union(Value $set) { $union = $this->value; /** @var Value $arg */ foreach (func_get_args() as $arg) { /** @var array $convertedArg */ $convertedArg = $arg->getSet()->getValue(); $union = array_merge($union, array_diff($convertedArg, $union...
[ "public", "function", "union", "(", "Value", "$", "set", ")", "{", "$", "union", "=", "$", "this", "->", "value", ";", "/** @var Value $arg */", "foreach", "(", "func_get_args", "(", ")", "as", "$", "arg", ")", "{", "/** @var array $convertedArg */", "$", ...
Set union operator. Returns a Set which is the union of this Set with all passed Sets. @param Value $set,... @return Set
[ "Set", "union", "operator", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L96-L108
bobthecow/Ruler
src/Ruler/Set.php
Set.intersect
public function intersect(Value $set) { $intersect = $this->value; /** @var Value $arg */ foreach (func_get_args() as $arg) { /** @var array $convertedArg */ $convertedArg = $arg->getSet()->getValue(); //array_values is needed to make sure the indexes are...
php
public function intersect(Value $set) { $intersect = $this->value; /** @var Value $arg */ foreach (func_get_args() as $arg) { /** @var array $convertedArg */ $convertedArg = $arg->getSet()->getValue(); //array_values is needed to make sure the indexes are...
[ "public", "function", "intersect", "(", "Value", "$", "set", ")", "{", "$", "intersect", "=", "$", "this", "->", "value", ";", "/** @var Value $arg */", "foreach", "(", "func_get_args", "(", ")", "as", "$", "arg", ")", "{", "/** @var array $convertedArg */", ...
Set intersection operator. Returns a Set which is the intersection of this Set with all passed sets. @param Value $set,... @return Set
[ "Set", "intersection", "operator", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L119-L132
bobthecow/Ruler
src/Ruler/Set.php
Set.complement
public function complement(Value $set) { $complement = $this->value; /** @var Value $arg */ foreach (func_get_args() as $arg) { /** @var array $convertedArg */ $convertedArg = $arg->getSet()->getValue(); //array_values is needed to make sure the indexes a...
php
public function complement(Value $set) { $complement = $this->value; /** @var Value $arg */ foreach (func_get_args() as $arg) { /** @var array $convertedArg */ $convertedArg = $arg->getSet()->getValue(); //array_values is needed to make sure the indexes a...
[ "public", "function", "complement", "(", "Value", "$", "set", ")", "{", "$", "complement", "=", "$", "this", "->", "value", ";", "/** @var Value $arg */", "foreach", "(", "func_get_args", "(", ")", "as", "$", "arg", ")", "{", "/** @var array $convertedArg */",...
Set complement operator. Returns a Set which is the complement of this Set with all passed Sets. @param Value $set,... @return Set
[ "Set", "complement", "operator", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L143-L156
bobthecow/Ruler
src/Ruler/Set.php
Set.symmetricDifference
public function symmetricDifference(Value $set) { $returnValue = new Set(array()); return $returnValue->union( $this->complement($set), $set->getSet()->complement($this) ); }
php
public function symmetricDifference(Value $set) { $returnValue = new Set(array()); return $returnValue->union( $this->complement($set), $set->getSet()->complement($this) ); }
[ "public", "function", "symmetricDifference", "(", "Value", "$", "set", ")", "{", "$", "returnValue", "=", "new", "Set", "(", "array", "(", ")", ")", ";", "return", "$", "returnValue", "->", "union", "(", "$", "this", "->", "complement", "(", "$", "set"...
Set symmetric difference operator. Returns a Set which is the symmetric difference of this Set with the passed Set. @param Value $set @return Set
[ "Set", "symmetric", "difference", "operator", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L168-L176
bobthecow/Ruler
src/Ruler/Set.php
Set.min
public function min() { if (!$this->isValidNumericSet()) { throw new \RuntimeException('min: all values must be numeric'); } if (empty($this->value)) { return null; } return min($this->value); }
php
public function min() { if (!$this->isValidNumericSet()) { throw new \RuntimeException('min: all values must be numeric'); } if (empty($this->value)) { return null; } return min($this->value); }
[ "public", "function", "min", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isValidNumericSet", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'min: all values must be numeric'", ")", ";", "}", "if", "(", "empty", "(", "$", "this...
Numeric minimum value in this Set. @throws \RuntimeException if this Set contains non-numeric members. @return mixed
[ "Numeric", "minimum", "value", "in", "this", "Set", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L185-L195
bobthecow/Ruler
src/Ruler/Set.php
Set.max
public function max() { if (!$this->isValidNumericSet()) { throw new \RuntimeException('max: all values must be numeric'); } if (empty($this->value)) { return null; } return max($this->value); }
php
public function max() { if (!$this->isValidNumericSet()) { throw new \RuntimeException('max: all values must be numeric'); } if (empty($this->value)) { return null; } return max($this->value); }
[ "public", "function", "max", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isValidNumericSet", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'max: all values must be numeric'", ")", ";", "}", "if", "(", "empty", "(", "$", "this...
Numeric maximum value in this Set. @throws \RuntimeException if this Set contains non-numeric members. @return mixed
[ "Numeric", "maximum", "value", "in", "this", "Set", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L204-L214
bobthecow/Ruler
src/Ruler/Set.php
Set.containsSubset
public function containsSubset(Set $set) { if (count($set->getValue()) > count($this->getValue())) { return false; } return array_intersect($set->getValue(), $this->getValue()) == $set->getValue(); }
php
public function containsSubset(Set $set) { if (count($set->getValue()) > count($this->getValue())) { return false; } return array_intersect($set->getValue(), $this->getValue()) == $set->getValue(); }
[ "public", "function", "containsSubset", "(", "Set", "$", "set", ")", "{", "if", "(", "count", "(", "$", "set", "->", "getValue", "(", ")", ")", ">", "count", "(", "$", "this", "->", "getValue", "(", ")", ")", ")", "{", "return", "false", ";", "}"...
Contains Subset comparison. @param Set $set @return bool
[ "Contains", "Subset", "comparison", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Set.php#L223-L230
bobthecow/Ruler
src/Ruler/Operator/StringDoesNotContain.php
StringDoesNotContain.evaluate
public function evaluate(Context $context) { /** @var VariableOperand $left */ /** @var VariableOperand $right */ list($left, $right) = $this->getOperands(); return $left->prepareValue($context)->stringContains($right->prepareValue($context)) === false; }
php
public function evaluate(Context $context) { /** @var VariableOperand $left */ /** @var VariableOperand $right */ list($left, $right) = $this->getOperands(); return $left->prepareValue($context)->stringContains($right->prepareValue($context)) === false; }
[ "public", "function", "evaluate", "(", "Context", "$", "context", ")", "{", "/** @var VariableOperand $left */", "/** @var VariableOperand $right */", "list", "(", "$", "left", ",", "$", "right", ")", "=", "$", "this", "->", "getOperands", "(", ")", ";", "return...
@param Context $context Context with which to evaluate this Proposition @return boolean
[ "@param", "Context", "$context", "Context", "with", "which", "to", "evaluate", "this", "Proposition" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Operator/StringDoesNotContain.php#L30-L37
bobthecow/Ruler
src/Ruler/Operator/SetDoesNotContain.php
SetDoesNotContain.evaluate
public function evaluate(Context $context) { /** @var VariableOperand $left */ /** @var VariableOperand $right */ list($left, $right) = $this->getOperands(); return $left->prepareValue($context)->getSet()->setContains($right->prepareValue($context)) === false; }
php
public function evaluate(Context $context) { /** @var VariableOperand $left */ /** @var VariableOperand $right */ list($left, $right) = $this->getOperands(); return $left->prepareValue($context)->getSet()->setContains($right->prepareValue($context)) === false; }
[ "public", "function", "evaluate", "(", "Context", "$", "context", ")", "{", "/** @var VariableOperand $left */", "/** @var VariableOperand $right */", "list", "(", "$", "left", ",", "$", "right", ")", "=", "$", "this", "->", "getOperands", "(", ")", ";", "return...
@param Context $context Context with which to evaluate this Proposition @return boolean
[ "@param", "Context", "$context", "Context", "with", "which", "to", "evaluate", "this", "Proposition" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Operator/SetDoesNotContain.php#L30-L37
bobthecow/Ruler
src/Ruler/Operator/LogicalOr.php
LogicalOr.evaluate
public function evaluate(Context $context) { /** @var Proposition $operand */ foreach ($this->getOperands() as $operand) { if ($operand->evaluate($context) === true) { return true; } } return false; }
php
public function evaluate(Context $context) { /** @var Proposition $operand */ foreach ($this->getOperands() as $operand) { if ($operand->evaluate($context) === true) { return true; } } return false; }
[ "public", "function", "evaluate", "(", "Context", "$", "context", ")", "{", "/** @var Proposition $operand */", "foreach", "(", "$", "this", "->", "getOperands", "(", ")", "as", "$", "operand", ")", "{", "if", "(", "$", "operand", "->", "evaluate", "(", "$...
@param Context $context Context with which to evaluate this Proposition @return boolean
[ "@param", "Context", "$context", "Context", "with", "which", "to", "evaluate", "this", "Proposition" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Operator/LogicalOr.php#L29-L39
bobthecow/Ruler
src/Ruler/RuleBuilder.php
RuleBuilder.offsetGet
public function offsetGet($name) { if (!isset($this->variables[$name])) { $this->variables[$name] = new RuleBuilder\Variable($this, $name); } return $this->variables[$name]; }
php
public function offsetGet($name) { if (!isset($this->variables[$name])) { $this->variables[$name] = new RuleBuilder\Variable($this, $name); } return $this->variables[$name]; }
[ "public", "function", "offsetGet", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "variables", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "variables", "[", "$", "name", "]", "=", "new", "RuleBuilder", "...
Retrieve a Variable by name. @param string $name The Variable name @return Variable
[ "Retrieve", "a", "Variable", "by", "name", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder.php#L132-L139
bobthecow/Ruler
src/Ruler/RuleBuilder.php
RuleBuilder.findOperator
public function findOperator($name) { $operator = ucfirst($name); foreach (array_keys($this->operatorNamespaces) as $namespace) { $class = $namespace . '\\' . $operator; if (class_exists($class)) { return $class; } } throw new \Log...
php
public function findOperator($name) { $operator = ucfirst($name); foreach (array_keys($this->operatorNamespaces) as $namespace) { $class = $namespace . '\\' . $operator; if (class_exists($class)) { return $class; } } throw new \Log...
[ "public", "function", "findOperator", "(", "$", "name", ")", "{", "$", "operator", "=", "ucfirst", "(", "$", "name", ")", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "operatorNamespaces", ")", "as", "$", "namespace", ")", "{", "$", "clas...
Find an operator in the registered operator namespaces. @throws \LogicException If a matching operator is not found. @param string $name @return string
[ "Find", "an", "operator", "in", "the", "registered", "operator", "namespaces", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder.php#L173-L184
bobthecow/Ruler
src/Ruler/Operator/LogicalNot.php
LogicalNot.evaluate
public function evaluate(Context $context) { /** @var Proposition $operand */ list($operand) = $this->getOperands(); return !$operand->evaluate($context); }
php
public function evaluate(Context $context) { /** @var Proposition $operand */ list($operand) = $this->getOperands(); return !$operand->evaluate($context); }
[ "public", "function", "evaluate", "(", "Context", "$", "context", ")", "{", "/** @var Proposition $operand */", "list", "(", "$", "operand", ")", "=", "$", "this", "->", "getOperands", "(", ")", ";", "return", "!", "$", "operand", "->", "evaluate", "(", "$...
@param Context $context Context with which to evaluate this Proposition @return boolean
[ "@param", "Context", "$context", "Context", "with", "which", "to", "evaluate", "this", "Proposition" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Operator/LogicalNot.php#L29-L35
bobthecow/Ruler
src/Ruler/RuleSet.php
RuleSet.executeRules
public function executeRules(Context $context) { foreach ($this->rules as $rule) { $rule->execute($context); } }
php
public function executeRules(Context $context) { foreach ($this->rules as $rule) { $rule->execute($context); } }
[ "public", "function", "executeRules", "(", "Context", "$", "context", ")", "{", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "rule", "->", "execute", "(", "$", "context", ")", ";", "}", "}" ]
Execute all Rules in the RuleSet. @param Context $context Context with which to execute each Rule
[ "Execute", "all", "Rules", "in", "the", "RuleSet", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleSet.php#L52-L57
bobthecow/Ruler
src/Ruler/Operator/Contains.php
Contains.evaluate
public function evaluate(Context $context) { /** @var VariableOperand $left */ /** @var VariableOperand $right */ list($left, $right) = $this->getOperands(); $left = $left->prepareValue($context); if (is_array($left->getValue())) { trigger_error('Contains operat...
php
public function evaluate(Context $context) { /** @var VariableOperand $left */ /** @var VariableOperand $right */ list($left, $right) = $this->getOperands(); $left = $left->prepareValue($context); if (is_array($left->getValue())) { trigger_error('Contains operat...
[ "public", "function", "evaluate", "(", "Context", "$", "context", ")", "{", "/** @var VariableOperand $left */", "/** @var VariableOperand $right */", "list", "(", "$", "left", ",", "$", "right", ")", "=", "$", "this", "->", "getOperands", "(", ")", ";", "$", ...
@param Context $context Context with which to evaluate this Proposition @return boolean
[ "@param", "Context", "$context", "Context", "with", "which", "to", "evaluate", "this", "Proposition" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Operator/Contains.php#L32-L49
bobthecow/Ruler
src/Ruler/Context.php
Context.offsetGet
public function offsetGet($name) { if (!$this->offsetExists($name)) { throw new \InvalidArgumentException(sprintf('Fact "%s" is not defined.', $name)); } $value = $this->values[$name]; // If the value is already frozen, or if it's not callable, or if it's protected, ret...
php
public function offsetGet($name) { if (!$this->offsetExists($name)) { throw new \InvalidArgumentException(sprintf('Fact "%s" is not defined.', $name)); } $value = $this->values[$name]; // If the value is already frozen, or if it's not callable, or if it's protected, ret...
[ "public", "function", "offsetGet", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "name", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Fact \"%s\" is not defined.'", ",", ...
Get the value of a fact. @param string $name The unique name for the fact @return mixed The resolved value of the fact @throws InvalidArgumentException if the name is not defined
[ "Get", "the", "value", "of", "a", "fact", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Context.php#L90-L113
bobthecow/Ruler
src/Ruler/Context.php
Context.offsetSet
public function offsetSet($name, $value) { if (isset($this->frozen[$name])) { throw new \RuntimeException(sprintf('Cannot override frozen fact "%s".', $name)); } $this->keys[$name] = true; $this->values[$name] = $value; }
php
public function offsetSet($name, $value) { if (isset($this->frozen[$name])) { throw new \RuntimeException(sprintf('Cannot override frozen fact "%s".', $name)); } $this->keys[$name] = true; $this->values[$name] = $value; }
[ "public", "function", "offsetSet", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "frozen", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Cannot over...
Set a fact name and value. A fact will be lazily evaluated if it is a Closure or invokable object. To define a fact as a literal callable, use Context::protect. @param string $name The unique name for the fact @param mixed $value The value or a closure to lazily define the value @throws RuntimeException if a froze...
[ "Set", "a", "fact", "name", "and", "value", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Context.php#L126-L134
bobthecow/Ruler
src/Ruler/Context.php
Context.offsetUnset
public function offsetUnset($name) { if ($this->offsetExists($name)) { $value = $this->values[$name]; if (is_object($value)) { $this->shared->detach($value); $this->protected->detach($value); } unset($this->keys[$name], $this-...
php
public function offsetUnset($name) { if ($this->offsetExists($name)) { $value = $this->values[$name]; if (is_object($value)) { $this->shared->detach($value); $this->protected->detach($value); } unset($this->keys[$name], $this-...
[ "public", "function", "offsetUnset", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "offsetExists", "(", "$", "name", ")", ")", "{", "$", "value", "=", "$", "this", "->", "values", "[", "$", "name", "]", ";", "if", "(", "is_object", "(...
Unset a fact @param string $name The unique name for the fact
[ "Unset", "a", "fact" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Context.php#L141-L153
bobthecow/Ruler
src/Ruler/Context.php
Context.raw
public function raw($name) { if (!$this->offsetExists($name)) { throw new \InvalidArgumentException(sprintf('Fact "%s" is not defined.', $name)); } if (isset($this->frozen[$name])) { return $this->raw[$name]; } return $this->values[$name]; }
php
public function raw($name) { if (!$this->offsetExists($name)) { throw new \InvalidArgumentException(sprintf('Fact "%s" is not defined.', $name)); } if (isset($this->frozen[$name])) { return $this->raw[$name]; } return $this->values[$name]; }
[ "public", "function", "raw", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "name", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Fact \"%s\" is not defined.'", ",", "$", ...
Get a fact or the closure defining a fact. @param string $name The unique name for the fact @return mixed The value of the fact or the closure defining the fact @throws InvalidArgumentException if the name is not defined
[ "Get", "a", "fact", "or", "the", "closure", "defining", "a", "fact", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Context.php#L208-L219
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.getProperty
public function getProperty($name, $value = null) { if (!isset($this->properties[$name])) { $this->properties[$name] = new VariableProperty($this, $name, $value); } return $this->properties[$name]; }
php
public function getProperty($name, $value = null) { if (!isset($this->properties[$name])) { $this->properties[$name] = new VariableProperty($this, $name, $value); } return $this->properties[$name]; }
[ "public", "function", "getProperty", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "properties", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "properties", "[", "$", "name...
Get a VariableProperty for accessing methods, indexes and properties of the current variable. @param string $name Property name @param mixed $value The default VariableProperty value @return VariableProperty
[ "Get", "a", "VariableProperty", "for", "accessing", "methods", "indexes", "and", "properties", "of", "the", "current", "variable", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L70-L77
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.add
public function add($variable) { return $this->wrap(new Operator\Addition($this, $this->asVariable($variable))); }
php
public function add($variable) { return $this->wrap(new Operator\Addition($this, $this->asVariable($variable))); }
[ "public", "function", "add", "(", "$", "variable", ")", "{", "return", "$", "this", "->", "wrap", "(", "new", "Operator", "\\", "Addition", "(", "$", "this", ",", "$", "this", "->", "asVariable", "(", "$", "variable", ")", ")", ")", ";", "}" ]
@param $variable @return Operator\Addition
[ "@param", "$variable" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L379-L382
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.divide
public function divide($variable) { return $this->wrap(new Operator\Division($this, $this->asVariable($variable))); }
php
public function divide($variable) { return $this->wrap(new Operator\Division($this, $this->asVariable($variable))); }
[ "public", "function", "divide", "(", "$", "variable", ")", "{", "return", "$", "this", "->", "wrap", "(", "new", "Operator", "\\", "Division", "(", "$", "this", ",", "$", "this", "->", "asVariable", "(", "$", "variable", ")", ")", ")", ";", "}" ]
@param $variable @return Operator\Division
[ "@param", "$variable" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L389-L392
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.modulo
public function modulo($variable) { return $this->wrap(new Operator\Modulo($this, $this->asVariable($variable))); }
php
public function modulo($variable) { return $this->wrap(new Operator\Modulo($this, $this->asVariable($variable))); }
[ "public", "function", "modulo", "(", "$", "variable", ")", "{", "return", "$", "this", "->", "wrap", "(", "new", "Operator", "\\", "Modulo", "(", "$", "this", ",", "$", "this", "->", "asVariable", "(", "$", "variable", ")", ")", ")", ";", "}" ]
@param $variable @return Operator\Modulo
[ "@param", "$variable" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L399-L402
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.multiply
public function multiply($variable) { return $this->wrap(new Operator\Multiplication($this, $this->asVariable($variable))); }
php
public function multiply($variable) { return $this->wrap(new Operator\Multiplication($this, $this->asVariable($variable))); }
[ "public", "function", "multiply", "(", "$", "variable", ")", "{", "return", "$", "this", "->", "wrap", "(", "new", "Operator", "\\", "Multiplication", "(", "$", "this", ",", "$", "this", "->", "asVariable", "(", "$", "variable", ")", ")", ")", ";", "...
@param $variable @return Operator\Multiplication
[ "@param", "$variable" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L409-L412
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.subtract
public function subtract($variable) { return $this->wrap(new Operator\Subtraction($this, $this->asVariable($variable))); }
php
public function subtract($variable) { return $this->wrap(new Operator\Subtraction($this, $this->asVariable($variable))); }
[ "public", "function", "subtract", "(", "$", "variable", ")", "{", "return", "$", "this", "->", "wrap", "(", "new", "Operator", "\\", "Subtraction", "(", "$", "this", ",", "$", "this", "->", "asVariable", "(", "$", "variable", ")", ")", ")", ";", "}" ...
@param $variable @return Operator\Subtraction
[ "@param", "$variable" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L419-L422
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.exponentiate
public function exponentiate($variable) { return $this->wrap(new Operator\Exponentiate($this, $this->asVariable($variable))); }
php
public function exponentiate($variable) { return $this->wrap(new Operator\Exponentiate($this, $this->asVariable($variable))); }
[ "public", "function", "exponentiate", "(", "$", "variable", ")", "{", "return", "$", "this", "->", "wrap", "(", "new", "Operator", "\\", "Exponentiate", "(", "$", "this", ",", "$", "this", "->", "asVariable", "(", "$", "variable", ")", ")", ")", ";", ...
@param $variable @return Operator\Exponentiate
[ "@param", "$variable" ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L453-L456
bobthecow/Ruler
src/Ruler/RuleBuilder/Variable.php
Variable.applySetOperator
private function applySetOperator($name, array $args) { $reflection = new \ReflectionClass('\\Ruler\\Operator\\' . $name); array_unshift($args, $this); return $this->wrap($reflection->newInstanceArgs($args)); }
php
private function applySetOperator($name, array $args) { $reflection = new \ReflectionClass('\\Ruler\\Operator\\' . $name); array_unshift($args, $this); return $this->wrap($reflection->newInstanceArgs($args)); }
[ "private", "function", "applySetOperator", "(", "$", "name", ",", "array", "$", "args", ")", "{", "$", "reflection", "=", "new", "\\", "ReflectionClass", "(", "'\\\\Ruler\\\\Operator\\\\'", ".", "$", "name", ")", ";", "array_unshift", "(", "$", "args", ",", ...
Private helper to apply a set operator. @param string $name @param array $args @return Variable
[ "Private", "helper", "to", "apply", "a", "set", "operator", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/RuleBuilder/Variable.php#L478-L484
bobthecow/Ruler
src/Ruler/Variable.php
Variable.prepareValue
public function prepareValue(Context $context) { if (isset($this->name) && isset($context[$this->name])) { $value = $context[$this->name]; } elseif ($this->value instanceof VariableOperand) { $value = $this->value->prepareValue($context); } else { $value =...
php
public function prepareValue(Context $context) { if (isset($this->name) && isset($context[$this->name])) { $value = $context[$this->name]; } elseif ($this->value instanceof VariableOperand) { $value = $this->value->prepareValue($context); } else { $value =...
[ "public", "function", "prepareValue", "(", "Context", "$", "context", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "name", ")", "&&", "isset", "(", "$", "context", "[", "$", "this", "->", "name", "]", ")", ")", "{", "$", "value", "=", "$...
Prepare a Value for this Variable given the current Context. @param Context $context The current Context @return Value
[ "Prepare", "a", "Value", "for", "this", "Variable", "given", "the", "current", "Context", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Variable.php#L77-L88
bobthecow/Ruler
src/Ruler/Rule.php
Rule.execute
public function execute(Context $context) { if ($this->evaluate($context) && isset($this->action)) { if (!is_callable($this->action)) { throw new \LogicException('Rule actions must be callable.'); } call_user_func($this->action); } }
php
public function execute(Context $context) { if ($this->evaluate($context) && isset($this->action)) { if (!is_callable($this->action)) { throw new \LogicException('Rule actions must be callable.'); } call_user_func($this->action); } }
[ "public", "function", "execute", "(", "Context", "$", "context", ")", "{", "if", "(", "$", "this", "->", "evaluate", "(", "$", "context", ")", "&&", "isset", "(", "$", "this", "->", "action", ")", ")", "{", "if", "(", "!", "is_callable", "(", "$", ...
Execute the Rule with the given Context. The Rule will be evaluated, and if successful, will execute its $action callback. @param Context $context Context with which to execute this Rule @throws \LogicException
[ "Execute", "the", "Rule", "with", "the", "given", "Context", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Rule.php#L60-L69
bobthecow/Ruler
src/Ruler/Value.php
Value.startsWith
public function startsWith(Value $value, $insensitive = false) { $value = $value->getValue(); $valueLength = strlen($value); if (!empty($this->value) && !empty($value) && strlen($this->value) >= $valueLength) { return substr_compare($this->value, $value, 0, $valueLength, $insens...
php
public function startsWith(Value $value, $insensitive = false) { $value = $value->getValue(); $valueLength = strlen($value); if (!empty($this->value) && !empty($value) && strlen($this->value) >= $valueLength) { return substr_compare($this->value, $value, 0, $valueLength, $insens...
[ "public", "function", "startsWith", "(", "Value", "$", "value", ",", "$", "insensitive", "=", "false", ")", "{", "$", "value", "=", "$", "value", "->", "getValue", "(", ")", ";", "$", "valueLength", "=", "strlen", "(", "$", "value", ")", ";", "if", ...
String StartsWith comparison. @param Value $value Value object to compare against @param bool $insensitive Perform a case-insensitive comparison (default: false) @return boolean
[ "String", "StartsWith", "comparison", "." ]
train
https://github.com/bobthecow/Ruler/blob/08d387c563033a4f35130cbfdea18984ebc82126/src/Ruler/Value.php#L226-L236
nafiesl/SimpleCrudGenerator
src/CrudMake.php
CrudMake.handle
public function handle() { $this->getModelName(); if ($this->modelExists()) { $this->error("{$this->modelNames['model_name']} model already exists."); return; } // Warn if it has no default layout view based on // simple-crud.default_layout_view conf...
php
public function handle() { $this->getModelName(); if ($this->modelExists()) { $this->error("{$this->modelNames['model_name']} model already exists."); return; } // Warn if it has no default layout view based on // simple-crud.default_layout_view conf...
[ "public", "function", "handle", "(", ")", "{", "$", "this", "->", "getModelName", "(", ")", ";", "if", "(", "$", "this", "->", "modelExists", "(", ")", ")", "{", "$", "this", "->", "error", "(", "\"{$this->modelNames['model_name']} model already exists.\"", ...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/CrudMake.php#L31-L64
nafiesl/SimpleCrudGenerator
src/CrudMake.php
CrudMake.generateModel
public function generateModel() { app('Luthfi\CrudGenerator\Generators\ModelGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\MigrationGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\ModelPolicyGenerator', ['command' => $t...
php
public function generateModel() { app('Luthfi\CrudGenerator\Generators\ModelGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\MigrationGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\ModelPolicyGenerator', ['command' => $t...
[ "public", "function", "generateModel", "(", ")", "{", "app", "(", "'Luthfi\\CrudGenerator\\Generators\\ModelGenerator'", ",", "[", "'command'", "=>", "$", "this", "]", ")", "->", "generate", "(", ")", ";", "app", "(", "'Luthfi\\CrudGenerator\\Generators\\MigrationGene...
Generate Model @return void
[ "Generate", "Model" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/CrudMake.php#L93-L99
nafiesl/SimpleCrudGenerator
src/CrudMake.php
CrudMake.generateResources
public function generateResources() { app('Luthfi\CrudGenerator\Generators\LangFileGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\FormViewGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\IndexViewGenerator', ['command' =...
php
public function generateResources() { app('Luthfi\CrudGenerator\Generators\LangFileGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\FormViewGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\IndexViewGenerator', ['command' =...
[ "public", "function", "generateResources", "(", ")", "{", "app", "(", "'Luthfi\\CrudGenerator\\Generators\\LangFileGenerator'", ",", "[", "'command'", "=>", "$", "this", "]", ")", "->", "generate", "(", ")", ";", "app", "(", "'Luthfi\\CrudGenerator\\Generators\\FormVi...
Generate Resources @return void
[ "Generate", "Resources" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/CrudMake.php#L116-L122
nafiesl/SimpleCrudGenerator
src/Generators/ModelPolicyGenerator.php
ModelPolicyGenerator.generate
public function generate(string $type = 'full') { $parentDirectory = ''; if (!is_null($this->command->option('parent'))) { $parentDirectory = '/'.$this->command->option('parent'); } $modelPolicyPath = $this->makeDirectory(app_path('Policies'.$parentDirectory)); $...
php
public function generate(string $type = 'full') { $parentDirectory = ''; if (!is_null($this->command->option('parent'))) { $parentDirectory = '/'.$this->command->option('parent'); } $modelPolicyPath = $this->makeDirectory(app_path('Policies'.$parentDirectory)); $...
[ "public", "function", "generate", "(", "string", "$", "type", "=", "'full'", ")", "{", "$", "parentDirectory", "=", "''", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "command", "->", "option", "(", "'parent'", ")", ")", ")", "{", "$", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelPolicyGenerator.php#L13-L29
nafiesl/SimpleCrudGenerator
src/Generators/ModelPolicyGenerator.php
ModelPolicyGenerator.getContent
public function getContent(string $stubName) { $stub = $this->getStubFileContent($stubName); $policyFileContent = $this->replaceStubString($stub); $userModel = config('auth.providers.users.model'); if ('App\User' !== $userModel) { $policyFileContent = str_replace('App\...
php
public function getContent(string $stubName) { $stub = $this->getStubFileContent($stubName); $policyFileContent = $this->replaceStubString($stub); $userModel = config('auth.providers.users.model'); if ('App\User' !== $userModel) { $policyFileContent = str_replace('App\...
[ "public", "function", "getContent", "(", "string", "$", "stubName", ")", "{", "$", "stub", "=", "$", "this", "->", "getStubFileContent", "(", "$", "stubName", ")", ";", "$", "policyFileContent", "=", "$", "this", "->", "replaceStubString", "(", "$", "stub"...
{@inheritDoc}
[ "{" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelPolicyGenerator.php#L34-L63
nafiesl/SimpleCrudGenerator
src/Generators/ModelPolicyGenerator.php
ModelPolicyGenerator.updateAuthServiceProviderClass
public function updateAuthServiceProviderClass() { $modelName = $this->modelNames['model_name']; $fullModelName = $this->modelNames['full_model_name']; $authSPPath = $this->makeAuthServiceProvilderFile(app_path('Providers'), 'AuthServiceProvider.php'); $authSPContent = $this->files-...
php
public function updateAuthServiceProviderClass() { $modelName = $this->modelNames['model_name']; $fullModelName = $this->modelNames['full_model_name']; $authSPPath = $this->makeAuthServiceProvilderFile(app_path('Providers'), 'AuthServiceProvider.php'); $authSPContent = $this->files-...
[ "public", "function", "updateAuthServiceProviderClass", "(", ")", "{", "$", "modelName", "=", "$", "this", "->", "modelNames", "[", "'model_name'", "]", ";", "$", "fullModelName", "=", "$", "this", "->", "modelNames", "[", "'full_model_name'", "]", ";", "$", ...
Update AuthServiceProviderClass based on created model policy object @return void
[ "Update", "AuthServiceProviderClass", "based", "on", "created", "model", "policy", "object" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelPolicyGenerator.php#L70-L93
nafiesl/SimpleCrudGenerator
src/Generators/ModelPolicyGenerator.php
ModelPolicyGenerator.makeAuthServiceProvilderFile
protected function makeAuthServiceProvilderFile($routeDirPath, $filename) { $routeDirPath = $this->makeDirectory($routeDirPath); if (!$this->files->exists($routeDirPath.'/'.$filename)) { $this->generateFile( $routeDirPath.'/'.$filename, $this->files->get(...
php
protected function makeAuthServiceProvilderFile($routeDirPath, $filename) { $routeDirPath = $this->makeDirectory($routeDirPath); if (!$this->files->exists($routeDirPath.'/'.$filename)) { $this->generateFile( $routeDirPath.'/'.$filename, $this->files->get(...
[ "protected", "function", "makeAuthServiceProvilderFile", "(", "$", "routeDirPath", ",", "$", "filename", ")", "{", "$", "routeDirPath", "=", "$", "this", "->", "makeDirectory", "(", "$", "routeDirPath", ")", ";", "if", "(", "!", "$", "this", "->", "files", ...
Create AuthServiceProvider class if not exists @param string $routeDirPath Absolute directory path @param string $filename File name to be created @return string Absolute path of create route file
[ "Create", "AuthServiceProvider", "class", "if", "not", "exists" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelPolicyGenerator.php#L103-L115
nafiesl/SimpleCrudGenerator
src/Generators/ControllerGenerator.php
ControllerGenerator.generate
public function generate(string $type = 'full') { $modelName = $this->modelNames['model_name']; $parentControllerDirectory = ''; if (!is_null($this->command->option('parent'))) { $parentControllerDirectory = '/'.$this->command->option('parent'); } if ($this->isFo...
php
public function generate(string $type = 'full') { $modelName = $this->modelNames['model_name']; $parentControllerDirectory = ''; if (!is_null($this->command->option('parent'))) { $parentControllerDirectory = '/'.$this->command->option('parent'); } if ($this->isFo...
[ "public", "function", "generate", "(", "string", "$", "type", "=", "'full'", ")", "{", "$", "modelName", "=", "$", "this", "->", "modelNames", "[", "'model_name'", "]", ";", "$", "parentControllerDirectory", "=", "''", ";", "if", "(", "!", "is_null", "("...
{@inheritDoc}
[ "{" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ControllerGenerator.php#L13-L35
nafiesl/SimpleCrudGenerator
src/Generators/ControllerGenerator.php
ControllerGenerator.getContent
public function getContent(string $stubName) { if ($this->command->option('form-requests')) { $stubName .= '-formrequests'; } $stub = $this->getStubFileContent($stubName); $controllerFileContent = $this->replaceStubString($stub); $appNamespace = $this->getAppNa...
php
public function getContent(string $stubName) { if ($this->command->option('form-requests')) { $stubName .= '-formrequests'; } $stub = $this->getStubFileContent($stubName); $controllerFileContent = $this->replaceStubString($stub); $appNamespace = $this->getAppNa...
[ "public", "function", "getContent", "(", "string", "$", "stubName", ")", "{", "if", "(", "$", "this", "->", "command", "->", "option", "(", "'form-requests'", ")", ")", "{", "$", "stubName", ".=", "'-formrequests'", ";", "}", "$", "stub", "=", "$", "th...
{@inheritDoc}
[ "{" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ControllerGenerator.php#L40-L77
nafiesl/SimpleCrudGenerator
src/GeneratorCommand.php
GeneratorCommand.getModelName
public function getModelName($modelName = null) { $modelName = is_null($modelName) ? $this->argument('name') : $modelName; $model_name = ucfirst(class_basename($modelName)); $plural_model_name = str_plural($model_name); $modelPath = $this->getModelPath($modelName); $modelName...
php
public function getModelName($modelName = null) { $modelName = is_null($modelName) ? $this->argument('name') : $modelName; $model_name = ucfirst(class_basename($modelName)); $plural_model_name = str_plural($model_name); $modelPath = $this->getModelPath($modelName); $modelName...
[ "public", "function", "getModelName", "(", "$", "modelName", "=", "null", ")", "{", "$", "modelName", "=", "is_null", "(", "$", "modelName", ")", "?", "$", "this", "->", "argument", "(", "'name'", ")", ":", "$", "modelName", ";", "$", "model_name", "="...
Generate class properties for model names in different usage. @return array
[ "Generate", "class", "properties", "for", "model", "names", "in", "different", "usage", "." ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/GeneratorCommand.php#L60-L79
nafiesl/SimpleCrudGenerator
src/GeneratorCommand.php
GeneratorCommand.getModelPath
protected function getModelPath($modelName) { $inputName = explode('/', ucfirst($modelName)); array_pop($inputName); return implode('/', $inputName); }
php
protected function getModelPath($modelName) { $inputName = explode('/', ucfirst($modelName)); array_pop($inputName); return implode('/', $inputName); }
[ "protected", "function", "getModelPath", "(", "$", "modelName", ")", "{", "$", "inputName", "=", "explode", "(", "'/'", ",", "ucfirst", "(", "$", "modelName", ")", ")", ";", "array_pop", "(", "$", "inputName", ")", ";", "return", "implode", "(", "'/'", ...
Get model path on storage @param string $modelName Input model name from command argument @return string Model path on storage
[ "Get", "model", "path", "on", "storage" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/GeneratorCommand.php#L87-L93
nafiesl/SimpleCrudGenerator
src/GeneratorCommand.php
GeneratorCommand.getModelNamespace
protected function getModelNamespace($modelPath) { $appNamespace = trim($this->getAppNamespace(), '\\'); $modelNamespace = str_replace('/', '\\', $appNamespace.'/'.ucfirst($modelPath)); $modelNamespace = trim($modelNamespace, '\\'); return $modelNamespace == 'App\\' ? 'App' : $modelN...
php
protected function getModelNamespace($modelPath) { $appNamespace = trim($this->getAppNamespace(), '\\'); $modelNamespace = str_replace('/', '\\', $appNamespace.'/'.ucfirst($modelPath)); $modelNamespace = trim($modelNamespace, '\\'); return $modelNamespace == 'App\\' ? 'App' : $modelN...
[ "protected", "function", "getModelNamespace", "(", "$", "modelPath", ")", "{", "$", "appNamespace", "=", "trim", "(", "$", "this", "->", "getAppNamespace", "(", ")", ",", "'\\\\'", ")", ";", "$", "modelNamespace", "=", "str_replace", "(", "'/'", ",", "'\\\...
Get model namespace @param string $modelPath Model path @return string Model namespace
[ "Get", "model", "namespace" ]
train
https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/GeneratorCommand.php#L101-L107