code
stringlengths
17
247k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
private function render($templateString, $data = null) { $t = SSViewer::fromString($templateString); if (!$data) { $data = new TestFixture(); } return $t->process($data); }
Small helper to render templates from strings Cloned from SSViewerTest
render
php
silverstripe/silverstripe-framework
tests/php/View/ContentNegotiatorTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/ContentNegotiatorTest.php
BSD-3-Clause
public function shortcodeSaver($arguments, $content, $parser, $tagName, $extra) { $this->arguments = $arguments; $this->contents = $content; $this->tagName = $tagName; $this->extra = $extra; return $content; }
Stores the result of a shortcode parse in object properties for easy testing access.
shortcodeSaver
php
silverstripe/silverstripe-framework
tests/php/View/Parsers/ShortcodeParserTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/Parsers/ShortcodeParserTest.php
BSD-3-Clause
protected function getRecursive($url, $limit = 10) { $this->cssParser = null; $response = $this->mainSession->get($url); while (--$limit > 0 && $response instanceof HTTPResponse && $response->getHeader('Location')) { $response = $this->mainSession->followRedirection(); } return $response; }
Follow all redirects recursively @param string $url @param int $limit Max number of requests @return HTTPResponse
getRecursive
php
silverstripe/silverstripe-framework
tests/php/Security/SecurityTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php
BSD-3-Clause
public function doTestLoginForm($email, $password, $backURL = 'test/link') { $this->get(Config::inst()->get(Security::class, 'logout_url')); $this->session()->set('BackURL', $backURL); $this->get(Config::inst()->get(Security::class, 'login_url')); return $this->submitForm( "MemberLoginForm_LoginForm", null, [ 'Email' => $email, 'Password' => $password, 'AuthenticationMethod' => MemberAuthenticator::class, 'action_doLogin' => 1, ] ); }
Execute a log-in form using Director::test(). Helper method for the tests above @param string $email @param string $password @param string $backURL @return HTTPResponse
doTestLoginForm
php
silverstripe/silverstripe-framework
tests/php/Security/SecurityTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php
BSD-3-Clause
public function doTestChangepasswordForm($oldPassword, $newPassword) { return $this->submitForm( "ChangePasswordForm_ChangePasswordForm", null, [ 'OldPassword' => $oldPassword, 'NewPassword1' => $newPassword, 'NewPassword2' => $newPassword, 'action_doChangePassword' => 1, ] ); }
Helper method to execute a change password form @param string $oldPassword @param string $newPassword @return HTTPResponse
doTestChangepasswordForm
php
silverstripe/silverstripe-framework
tests/php/Security/SecurityTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php
BSD-3-Clause
protected function assertHasMessage($expected, $errorMessage = null) { $messages = []; $result = $this->getValidationResult(); if ($result) { foreach ($result->getMessages() as $message) { $messages[] = $message['message']; } } $this->assertContains($expected, $messages, $errorMessage ?: ''); }
Assert this message is in the current login form errors @param string $expected @param string $errorMessage
assertHasMessage
php
silverstripe/silverstripe-framework
tests/php/Security/SecurityTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php
BSD-3-Clause
protected function getValidationResult() { $result = $this->session()->get('FormInfo.MemberLoginForm_LoginForm.result'); if ($result) { return unserialize($result ?? ''); } return null; }
Get validation result from last login form submission @return ValidationResult
getValidationResult
php
silverstripe/silverstripe-framework
tests/php/Security/SecurityTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php
BSD-3-Clause
public function providerContextSummary() { return [ [ 'This is some text. It is a test', 20, 'test', '… text. It is a <mark>test</mark>' ], [ // Retains case of original string 'This is some test text. Test test what if you have multiple keywords.', 50, 'some test', 'This is <mark>some</mark> <mark>test</mark> text.' . ' <mark>Test</mark> <mark>test</mark> what if you have…' ], [ 'Here is some text &amp; HTML included', 20, 'html', '… text &amp; <mark>HTML</mark> inc…' ], [ 'A dog ate a cat while looking at a Foobar', 100, 'a', // test that it does not highlight too much (eg every a) 'A dog ate a cat while looking at a Foobar', ], [ 'A dog ate a cat while looking at a Foobar', 100, 'ate', // it should highlight 3 letters or more. 'A dog <mark>ate</mark> a cat while looking at a Foobar', ], // HTML Content is plain-textified, and incorrect tags removed [ '<p>A dog ate a cat while <mark>looking</mark> at a Foobar</p>', 100, 'ate', // it should highlight 3 letters or more. 'A dog <mark>ate</mark> a cat while looking at a Foobar', ], [ '<p>This is a lot of text before this but really, this is a test sentence</p> <p>with about more stuff after the line break</p>', 35, 'test', '… really, this is a <mark>test</mark> sentence…' ], [ '<p>This is a lot of text before this but really, this is a test sentence</p> <p>with about more stuff after the line break</p>', 50, 'with', '… sentence<br /> <br /> <mark>with</mark> about more stuff…' ] ]; }
each test is in the format input, charactere limit, highlight, expected output @return array
providerContextSummary
php
silverstripe/silverstripe-framework
tests/php/ORM/DBHTMLTextTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBHTMLTextTest.php
BSD-3-Clause
protected function getNodeClassFromTree($html, $node) { $parser = new CSSContentParser($html); $xpath = '//ul/li[@data-id="' . $node->ID . '"]'; $object = $parser->getByXpath($xpath); foreach ($object[0]->attributes() as $key => $attr) { if ($key == 'class') { return (string)$attr; } } return ''; }
Get the HTML class attribute from a node in the sitetree @param string$html @param DataObject $node @return string
getNodeClassFromTree
php
silverstripe/silverstripe-framework
tests/php/ORM/MarkedSetTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/MarkedSetTest.php
BSD-3-Clause
public function providerContextSummary() { return [ [ 'This is some text. It is a test', 20, 'test', '… text. It is a <mark>test</mark>' ], [ // Retains case of original string 'This is some test text. Test test what if you have multiple keywords.', 50, 'some test', 'This is <mark>some</mark> <mark>test</mark> text.' . ' <mark>Test</mark> <mark>test</mark> what if you have…' ], [ 'Here is some text & HTML included', 20, 'html', '… text &amp; <mark>HTML</mark> inc…' ], [ 'A dog ate a cat while looking at a Foobar', 100, 'a', // test that it does not highlight too much (eg every a) 'A dog ate a cat while looking at a Foobar', ], [ 'A dog ate a cat while looking at a Foobar', 100, 'ate', // it should highlight 3 letters or more. 'A dog <mark>ate</mark> a cat while looking at a Foobar', ], [ 'both schön and können have umlauts', 21, 'schön', // check UTF8 support 'both <mark>schön</mark> and können…', ], [ 'both schön and können have umlauts', 21, '', // check non-existent search term 'both schön and können…', ] ]; }
each test is in the format input, character limit, highlight, expected output @return array
providerContextSummary
php
silverstripe/silverstripe-framework
tests/php/ORM/DBTextTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBTextTest.php
BSD-3-Clause
public function providerSummary() { return [ 'simple test' => [ 'This is some text. It is a test', 3, false, 'This is some…', ], 'custom ellipses' => [ // check custom ellipsis 'This is a test text in a longer sentence and a custom ellipsis.', 8, '...', // regular dots instead of the ellipsis character 'This is a test text in a longer...', ], 'umlauts' => [ 'both schön and können have umlauts', 5, false, 'both schön and können have…', ], 'invalid UTF' => [ // check invalid UTF8 handling — input is an invalid UTF sequence, output should be empty string "\xf0\x28\x8c\xbc", 50, false, '', ], 'treats period as sentence boundary' => [ 'This is some text. It is a test. There are three sentences.', 10, false, 'This is some text. It is a test.', ], 'treats exclamation mark as sentence boundary' => [ 'This is some text! It is a test! There are three sentences.', 10, false, 'This is some text! It is a test!', ], 'treats question mark as sentence boundary' => [ 'This is some text? It is a test? There are three sentences.', 10, false, 'This is some text? It is a test?', ], 'does not treat colon as sentence boundary' => [ 'This is some text: It is a test: There are three sentences.', 10, false, 'This is some text: It is a test: There are…', ], ]; }
each test is in the format input, word limit, add ellipsis (false or string), expected output @return array
providerSummary
php
silverstripe/silverstripe-framework
tests/php/ORM/DBTextTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBTextTest.php
BSD-3-Clause
protected function clean($input) { $nbsp = html_entity_decode('&nbsp;', 0, 'UTF-8'); return str_replace(' ', $nbsp ?? '', trim($input ?? '')); }
In some cases and locales, validation expects non-breaking spaces. Duplicates non-public NumericField::clean method @param string $input @return string The input value, with all spaces replaced with non-breaking spaces
clean
php
silverstripe/silverstripe-framework
tests/php/ORM/DBMoneyTest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBMoneyTest.php
BSD-3-Clause
public function resetCounts() { $update = new SQLUpdate( sprintf('"%s"', TreeNode::baseTable()), ['"WriteCount"' => 0] ); $results = $update->execute(); }
Reset the WriteCount on all TreeNodes
resetCounts
php
silverstripe/silverstripe-framework
tests/php/ORM/DataObjectTest/TreeNode.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DataObjectTest/TreeNode.php
BSD-3-Clause
public function prepValueForDB($value) { if ($value) { return $this->dynamicAssignment ? ['ABS(?)' => [1]] : 1; } return 0; }
If the field value and $dynamicAssignment are true, we'll try to do a dynamic assignment. @param $value @return array|int
prepValueForDB
php
silverstripe/silverstripe-framework
tests/php/ORM/DataObjectTest/MockDynamicAssignmentDBField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DataObjectTest/MockDynamicAssignmentDBField.php
BSD-3-Clause
public function getSubclassFieldWithOverride() { return $this->getField('SubclassFieldWithOverride') . ' (override)'; }
Override the value of SubclassFieldWithOverride @return string Suffixes " (override)" to SubclassFieldWithOverride value
getSubclassFieldWithOverride
php
silverstripe/silverstripe-framework
tests/php/ORM/DataObjectTest/SubTeam.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DataObjectTest/SubTeam.php
BSD-3-Clause
protected function pushManifest(ClassManifest $manifest) { $this->manifests++; ClassLoader::inst()->pushManifest($manifest); }
Safely push a new class manifest. These will be cleaned up on tearDown() @param ClassManifest $manifest
pushManifest
php
silverstripe/silverstripe-framework
tests/php/i18n/i18nTestManifest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/i18n/i18nTestManifest.php
BSD-3-Clause
public function setUSBirthday($val, $record = null) { $this->Birthday = preg_replace('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-90-9]{2,4})/', '\\3-\\1-\\2', $val ?? ''); }
Custom setter for "Birthday" property when passed/imported in different format. @param string $val @param array $record
setUSBirthday
php
silverstripe/silverstripe-framework
tests/php/Dev/CsvBulkLoaderTest/Player.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Dev/CsvBulkLoaderTest/Player.php
BSD-3-Clause
public function mockException($depth = 0) { switch ($depth) { case 0: try { $this->mockException(1); } catch (\Exception $ex) { return $ex; } return null; break; case 4: throw new Exception('Error'); default: return $this->mockException($depth + 1); } }
Generate an exception with a trace depeth of at least 4 @param int $depth @return Exception @throws Exception
mockException
php
silverstripe/silverstripe-framework
tests/php/Logging/DetailedErrorFormatterTest/ErrorGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Logging/DetailedErrorFormatterTest/ErrorGenerator.php
BSD-3-Clause
public function __construct(array $resultSet = []) { $this->resultSet = $resultSet; }
Creates a new mock statement that will serve the provided fake result set to clients. @param array $resultSet The faked SQL result set.
__construct
php
Sylius/Sylius
tests/Functional/Doctrine/Mock/DriverResultMock.php
https://github.com/Sylius/Sylius/blob/master/tests/Functional/Doctrine/Mock/DriverResultMock.php
MIT
protected function pageLevel() { $siteTitle = $this->setting->getValueByKey('site_title'); if (!empty($siteTitle)) { $siteTitle = ' | ' . $siteTitle; } $this->tags[] = '<title>' . $this->page->getTitle() . $siteTitle . '</title>'; $this->tags[] = '<link rel="canonical" href="' . $this->page->getCanonical() . '" />'; $description = $this->page->getDescription(); if (!empty($description)) { $this->tags[] = '<meta name="description" content="' . $description . '" />'; } return $this; }
Create all meta tags that are saved in pages table row.
pageLevel
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
protected function webmaster() { $webmaster_tools = $this->meta['webmaster_tools'] ?? []; $this->generator($webmaster_tools); return $this; }
Generate webmaster validation meta tags @return $this
webmaster
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
public function asHtml() { $metaHtml = implode("\n", $this->tags); $metaHtml .= PHP_EOL . $this->schemaJsonLd() . PHP_EOL; return $metaHtml; }
Show tags array into html string @return string
asHtml
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
public function make() { $this->makeMeta(); $this->robots()->webmaster()->pageLevel()->og()->twitter()->otherTags(); return $this; }
Generate meta tags adn save them into tags array @return $this
make
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
public function show() { if ($this->hasPage()) { return $this->make()->asHtml(); } }
For outside. It will make meta tags and then return as html string.
show
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
public function hasPage() { return $this->page instanceof Page; }
Check has this path has a seo page. If so return true or false @return bool
hasPage
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
protected function makeMeta() { if (!$this->hasPage()) { return []; } $pageMeta = $this->page->metaTags(); $globalMeta = MetaTag::withContent('', 'global'); foreach ($pageMeta as $group => $tags) { foreach ($tags as $tag) { $this->meta[$group][$tag->id] = $tag; } } foreach ($globalMeta as $meta) { if (!empty($meta->group)) { $this->meta[$meta->group][$meta->id] = $meta; } elseif ($meta->visibility == 'global') { $this->meta['global'][$meta->id] = $meta; } elseif ($meta->visibility == 'page') { $this->meta['page'][$meta->id] = $meta; } else { $this->meta['others'][$meta->id] = $meta; } } return $this->meta; }
Normalize meta tags with content @return array
makeMeta
php
digitaldreams/laravel-seo-tools
src/Tag.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php
MIT
public function tools() { $data = []; return view('seo::pages.dashboard.tools', $data); }
Import Export and Download Pages
tools
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/DashboardController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/DashboardController.php
MIT
public function update(Update $request, Setting $setting) { $setting->fill($request->all()); if ($setting->save()) { session()->flash(config('seo.flash_message'), 'Setting successfully updated'); return redirect()->route('seo::settings.index'); } else { session()->flash(config('seo.flash_error'), 'Something is wrong while updating Setting'); } return redirect()->back(); }
Update a existing resource in storage. @return Response
update
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/SettingController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/SettingController.php
MIT
public function show(Show $request, Page $page) { $data = [ 'record' => $page, 'success' => false ]; $pageAnalysis = new KeywordAnalysis($page->getFullUrl(), $page->keyword); if ($pageAnalysis->isSuccess()) { $data = array_merge($pageAnalysis->fromCache()->save()->toArray(), $data); $data['result'] = $pageAnalysis->run()->result(); $data['success'] = true; } return view('seo::pages.pages.show', $data); }
Display the specified resource. @return Response @throws \Exception
show
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/PageController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/PageController.php
MIT
public function destroy(Destroy $request, Page $page) { if ($page->delete()) { session()->flash(config('seo.flash_message'), 'Page successfully deleted'); } else { session()->flash(config('seo.flash_error'), 'Error occurred while deleting Page'); } return redirect()->back(); }
Delete a resource from storage. @param Request $request @return Response @throws \Exception
destroy
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/PageController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/PageController.php
MIT
public function store(Store $request) { $model = new LinkTag; $model->fill($request->all()); if ($model->save()) { session()->flash('app_message', 'LinkTag saved successfully'); return redirect()->route('seo_link_tags.index'); } else { session()->flash('app_message', 'Something is wrong while saving LinkTag'); } return redirect()->back(); }
Store a newly created resource in storage. @return \Illuminate\Http\Response
store
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/LinkTagController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/LinkTagController.php
MIT
public function update(Update $request, LinkTag $linktag) { $linktag->fill($request->all()); if ($linktag->save()) { session()->flash('app_message', 'LinkTag successfully updated'); return redirect()->route('seo_link_tags.index'); } else { session()->flash('app_error', 'Something is wrong while updating LinkTag'); } return redirect()->back(); }
Update a existing resource in storage. @return \Illuminate\Http\Response
update
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/LinkTagController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/LinkTagController.php
MIT
public function destroy(Destroy $request, LinkTag $linktag) { if ($linktag->delete()) { session()->flash('app_message', 'LinkTag successfully deleted'); } else { session()->flash('app_error', 'Error occurred while deleting LinkTag'); } return redirect()->back(); }
Delete a resource from storage. @return \Illuminate\Http\Response @throws \Exception
destroy
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/LinkTagController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/LinkTagController.php
MIT
public function destroy(Destroy $request, MetaTag $meta_tag) { if ($meta_tag->delete()) { session()->flash(config('seo.flash_message'), 'MetaTag successfully deleted'); } else { session()->flash(config('seo.flash_error'), 'Error occurred while deleting MetaTag'); } return redirect()->back(); }
Delete a resource from storage. @return Response @throws \Exception
destroy
php
digitaldreams/laravel-seo-tools
src/Http/Controllers/MetaTagController.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/MetaTagController.php
MIT
public function fromCache() { if (Cache::has($this->url)) { $this->data = json_decode((string) Cache::get($this->url), true); } else { $this->fetch(); } return $this; }
Try to get result from cache if exists otherwise run fetch @return PageAnalysis
fromCache
php
digitaldreams/laravel-seo-tools
src/Services/PageAnalysis.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Services/PageAnalysis.php
MIT
public function edit(User $user, Setting $setting) { return false; }
Determine whether the user can edit the Setting. @param User $user @param Setting $setting @return mixed
edit
php
digitaldreams/laravel-seo-tools
Policies/SettingPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php
MIT
public function update(User $user, Setting $setting) { return false; }
Determine whether the user can update the Setting. @param User $user @param Setting $setting @return mixed
update
php
digitaldreams/laravel-seo-tools
Policies/SettingPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php
MIT
public function create(User $user) { return true; }
Determine whether the user can store the Setting. @param User $user @param Setting $setting @return mixed
create
php
digitaldreams/laravel-seo-tools
Policies/SettingPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php
MIT
public function robotTxt(User $user, Setting $setting) { return false; }
Determine whether the user can robotTxt the Setting. @param User $user @param Setting $setting @return mixed
robotTxt
php
digitaldreams/laravel-seo-tools
Policies/SettingPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php
MIT
public function htaccess(User $user, Setting $setting) { return false; }
Determine whether the user can htaccess the Setting. @param User $user @param Setting $setting @return mixed
htaccess
php
digitaldreams/laravel-seo-tools
Policies/SettingPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php
MIT
public function store(User $user, MetaTag $metaTag) { return false; }
Determine whether the user can store the MetaTag. @param User $user @param MetaTag $metaTag @return mixed
store
php
digitaldreams/laravel-seo-tools
Policies/MetaTagPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php
MIT
public function edit(User $user, MetaTag $metaTag) { return false; }
Determine whether the user can edit the MetaTag. @param User $user @param MetaTag $metaTag @return mixed
edit
php
digitaldreams/laravel-seo-tools
Policies/MetaTagPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php
MIT
public function update(User $user, MetaTag $metaTag) { return false; }
Determine whether the user can update the MetaTag. @param User $user @param MetaTag $metaTag @return mixed
update
php
digitaldreams/laravel-seo-tools
Policies/MetaTagPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php
MIT
public function global(User $user, MetaTag $metaTag) { return false; }
Determine whether the user can global the MetaTag. @param User $user @param MetaTag $metaTag @return mixed
global
php
digitaldreams/laravel-seo-tools
Policies/MetaTagPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php
MIT
public function delete(User $user, MetaTag $metaTag) { return false; }
Determine whether the user can delete the MetaTag. @param User $user @param MetaTag $metaTag @return mixed
delete
php
digitaldreams/laravel-seo-tools
Policies/MetaTagPolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php
MIT
public function view(User $user, Page $page) { return false; }
Determine whether the user can view the Page. @param User $user @param Page $page @return mixed
view
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function store(User $user, Page $page) { return false; }
Determine whether the user can store the Page. @param User $user @param Page $page @return mixed
store
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function edit(User $user, Page $page) { return false; }
Determine whether the user can edit the Page. @param User $user @param Page $page @return mixed
edit
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function update(User $user, Page $page) { return false; }
Determine whether the user can update the Page. @param User $user @param Page $page @return mixed
update
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function bulkUpdate(User $user) { return false; }
Determine whether the user can bulkUpdate the Page. @param User $user @param Page $page @return mixed
bulkUpdate
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function delete(User $user, Page $page) { return true; }
Determine whether the user can delete the Page. @param User $user @param Page $page @return mixed
delete
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function generate(User $user) { return true; }
Determine whether the user can generate the Page. @param User $user @param Page $page @return mixed
generate
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function meta(User $user, Page $page) { return true; }
Determine whether the user can meta the Page. @param User $user @param Page $page @return mixed
meta
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function upload(User $user) { return false; }
Determine whether the user can upload the Page. @param User $user @param Page $page @return mixed
upload
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function download(User $user) { return false; }
Determine whether the user can download the Page. @param User $user @param Page $page @return mixed
download
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function images(User $user, Page $page) { return false; }
Determine whether the user can images the Page. @param User $user @param Page $page @return mixed
images
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function cache(User $user) { return true; }
Determine whether the user can cache the Page. @param User $user @param Page $page @return mixed
cache
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function zip(User $user) { return false; }
Determine whether the user can zip the Page. @param User $user @param Page $page @return mixed
zip
php
digitaldreams/laravel-seo-tools
Policies/PagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php
MIT
public function store(User $user, Image $image) { return false; }
Determine whether the user can store the Image. @param User $user @param Image $image @return mixed
store
php
digitaldreams/laravel-seo-tools
Policies/ImagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php
MIT
public function edit(User $user, Image $image) { return false; }
Determine whether the user can edit the Image. @param User $user @param Image $image @return mixed
edit
php
digitaldreams/laravel-seo-tools
Policies/ImagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php
MIT
public function update(User $user, Image $image) { return false; }
Determine whether the user can update the Image. @param User $user @param Image $image @return mixed
update
php
digitaldreams/laravel-seo-tools
Policies/ImagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php
MIT
public function delete(User $user, Image $image) { return false; }
Determine whether the user can delete the Image. @param User $user @param Image $image @return mixed
delete
php
digitaldreams/laravel-seo-tools
Policies/ImagePolicy.php
https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php
MIT
public static function defineDirectives() { $omitParenthesis = version_compare(app()->version(), '5.3', '<'); self::defineWidgetDirective($omitParenthesis); self::defineSlotDirectives($omitParenthesis); }
| ------------------------------------------ | | Define Blade Directives | | ------------------------------------------ | | When you call @ widget from your views | | The only thing that happens is that the | | `renderWidget` method Gets called on the | | `Utils\WidgetRenderer` class | | ------------------------------------------ |.
defineDirectives
php
imanghafoori1/laravel-widgetize
src/BladeDirective.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/BladeDirective.php
MIT
private function setTokenInMemory(string $tag, string $token) { return $this->tagTokens[$tag] = $token; }
Set token in Memory for fast access within the same request. @param $tag string @param $token string @return string
setTokenInMemory
php
imanghafoori1/laravel-widgetize
src/Utils/CacheTag.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/CacheTag.php
MIT
private function persistToken(string $tag, string $token) { Cache::forever('9z10_o6cg_r'.$tag, $token); }
Save token to disk for later requests. @param $tag string @param $token string @return void
persistToken
php
imanghafoori1/laravel-widgetize
src/Utils/CacheTag.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/CacheTag.php
MIT
public function startSlot($name) { if (ob_start()) { $this->slotName = $name; } }
Start output buffer to get content of slot and set slot name. @param string $name
startSlot
php
imanghafoori1/laravel-widgetize
src/Utils/SlotRenderer.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/SlotRenderer.php
MIT
public function renderSlot($data = '') { $this->slots[$this->slotName] = $data; }
get slot content from widget block. @param string $data
renderSlot
php
imanghafoori1/laravel-widgetize
src/Utils/SlotRenderer.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/SlotRenderer.php
MIT
public function hasSlots() { return ! empty($this->slots); }
check if widget has any slots. @return bool
hasSlots
php
imanghafoori1/laravel-widgetize
src/Utils/SlotRenderer.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/SlotRenderer.php
MIT
private function cacheState() { if (! $this->policies->widgetShouldUseCache()) { return ' &#013; Cache: is globally turned off (You should put "enable_cache" => true in config\widgetize.php) '; } $l = $this->widget->cacheLifeTime->i ?? 0; return " &#013;Cache : {$l} (min) "; }
Generates a string of current cache configurations. @return string
cacheState
php
imanghafoori1/laravel-widgetize
src/Utils/DebugInfo.php
https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/DebugInfo.php
MIT
public function __construct( array $destinationClassList, array $context = [] ) { $this->destinationClassList = $destinationClassList; $this->ownContext = $context; }
MapToAnyOf constructor. @param string[] $destinationClassList List of possible destination classes. The first match will be used. @param array $context Optional context that will be merged with the parent's context.
__construct
php
mark-gerarts/automapper-plus
src/MappingOperation/Implementations/MapToAnyOf.php
https://github.com/mark-gerarts/automapper-plus/blob/master/src/MappingOperation/Implementations/MapToAnyOf.php
MIT
public function __construct( string $destinationClass, bool $sourceIsObjectArray = false, array $context = [] ) { $this->destinationClass = $destinationClass; $this->sourceIsObjectArray = $sourceIsObjectArray; $this->ownContext = $context; }
MapTo constructor. @param string $destinationClass @param bool $sourceIsObjectArray Indicates whether or not an array as source value should be treated as a collection of elements, or as an array representing an object. @param array $context Optional context that will be merged with the parent's context.
__construct
php
mark-gerarts/automapper-plus
src/MappingOperation/Implementations/MapTo.php
https://github.com/mark-gerarts/automapper-plus/blob/master/src/MappingOperation/Implementations/MapTo.php
MIT
protected function getPrivate($object, string $propertyName) { $objectArray = (array) $object; foreach ($objectArray as $name => $value) { if (substr($name, - \strlen($propertyName) - 1) === "\x00" . $propertyName) { return $value; } } return null; }
Abuses PHP's internal representation of properties when casting an object to an array. @param $object @param string $propertyName @return mixed
getPrivate
php
mark-gerarts/automapper-plus
src/PropertyAccessor/PropertyAccessor.php
https://github.com/mark-gerarts/automapper-plus/blob/master/src/PropertyAccessor/PropertyAccessor.php
MIT
public function __construct() { $this->path = []; $this->omit_empty = false; }
No constructor params are made available in this case as we do not allow customizing how we link to the parent object. There is only one parent object available, that is the one we are linking to and that's it.
__construct
php
square/pjson
src/JsonParent.php
https://github.com/square/pjson/blob/master/src/JsonParent.php
Apache-2.0
protected function handleMissingValue($data) { if ($this->required) { throw new MissingRequiredPropertyException($this->path, json_encode($data)); } return null; }
What happens when deserializing a property that isn't set.
handleMissingValue
php
square/pjson
src/Json.php
https://github.com/square/pjson/blob/master/src/Json.php
Apache-2.0
public static function clear() { self::$resultCache = array(); self::$compiledCheckerCache = array(); }
Clears the memoization cache once you are done @return void
clear
php
composer/semver
src/CompilingMatcher.php
https://github.com/composer/semver/blob/master/src/CompilingMatcher.php
MIT
public static function match(ConstraintInterface $constraint, $operator, $version) { $resultCacheKey = $operator.$constraint.';'.$version; if (isset(self::$resultCache[$resultCacheKey])) { return self::$resultCache[$resultCacheKey]; } if (self::$enabled === null) { self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true); } if (!self::$enabled) { return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version)); } $cacheKey = $operator.$constraint; if (!isset(self::$compiledCheckerCache[$cacheKey])) { $code = $constraint->compile($operator); self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};'); } else { $function = self::$compiledCheckerCache[$cacheKey]; } return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0); }
Evaluates the expression: $constraint match $operator $version @param ConstraintInterface $constraint @param int $operator @phpstan-param Constraint::OP_* $operator @param string $version @return bool
match
php
composer/semver
src/CompilingMatcher.php
https://github.com/composer/semver/blob/master/src/CompilingMatcher.php
MIT
public static function greaterThan($version1, $version2) { return self::compare($version1, '>', $version2); }
Evaluates the expression: $version1 > $version2. @param string $version1 @param string $version2 @return bool
greaterThan
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function greaterThanOrEqualTo($version1, $version2) { return self::compare($version1, '>=', $version2); }
Evaluates the expression: $version1 >= $version2. @param string $version1 @param string $version2 @return bool
greaterThanOrEqualTo
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function lessThan($version1, $version2) { return self::compare($version1, '<', $version2); }
Evaluates the expression: $version1 < $version2. @param string $version1 @param string $version2 @return bool
lessThan
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function lessThanOrEqualTo($version1, $version2) { return self::compare($version1, '<=', $version2); }
Evaluates the expression: $version1 <= $version2. @param string $version1 @param string $version2 @return bool
lessThanOrEqualTo
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function equalTo($version1, $version2) { return self::compare($version1, '==', $version2); }
Evaluates the expression: $version1 == $version2. @param string $version1 @param string $version2 @return bool
equalTo
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function notEqualTo($version1, $version2) { return self::compare($version1, '!=', $version2); }
Evaluates the expression: $version1 != $version2. @param string $version1 @param string $version2 @return bool
notEqualTo
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function compare($version1, $operator, $version2) { $constraint = new Constraint($operator, $version2); return $constraint->matchSpecific(new Constraint('==', $version1), true); }
Evaluates the expression: $version1 $operator $version2. @param string $version1 @param string $operator @param string $version2 @return bool @phpstan-param Constraint::STR_OP_* $operator
compare
php
composer/semver
src/Comparator.php
https://github.com/composer/semver/blob/master/src/Comparator.php
MIT
public static function parseStability($version) { $version = (string) preg_replace('{#.+$}', '', (string) $version); if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) { return 'dev'; } preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match); if (!empty($match[3])) { return 'dev'; } if (!empty($match[1])) { if ('beta' === $match[1] || 'b' === $match[1]) { return 'beta'; } if ('alpha' === $match[1] || 'a' === $match[1]) { return 'alpha'; } if ('rc' === $match[1]) { return 'RC'; } } return 'stable'; }
Returns the stability of a version. @param string $version @return string @phpstan-return 'stable'|'RC'|'beta'|'alpha'|'dev'
parseStability
php
composer/semver
src/VersionParser.php
https://github.com/composer/semver/blob/master/src/VersionParser.php
MIT
public function parseNumericAliasPrefix($branch) { if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', (string) $branch, $matches)) { return $matches['version'] . '.'; } return false; }
Extract numeric prefix from alias, if it is in numeric format, suitable for version comparison. @param string $branch Branch name (e.g. 2.1.x-dev) @return string|false Numeric prefix if present (e.g. 2.1.) or false
parseNumericAliasPrefix
php
composer/semver
src/VersionParser.php
https://github.com/composer/semver/blob/master/src/VersionParser.php
MIT
public function normalizeBranch($name) { $name = trim((string) $name); if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) { $version = ''; for ($i = 1; $i < 5; ++$i) { $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x'; } return str_replace('x', '9999999', $version) . '-dev'; } return 'dev-' . $name; }
Normalizes a branch name to be able to perform comparisons on it. @param string $name @return string
normalizeBranch
php
composer/semver
src/VersionParser.php
https://github.com/composer/semver/blob/master/src/VersionParser.php
MIT
public function normalizeDefaultBranch($name) { if ($name === 'dev-master' || $name === 'dev-default' || $name === 'dev-trunk') { return '9999999-dev'; } return (string) $name; }
Normalizes a default branch name (i.e. master on git) to 9999999-dev. @param string $name @return string @deprecated No need to use this anymore in theory, Composer 2 does not normalize any branch names to 9999999-dev anymore
normalizeDefaultBranch
php
composer/semver
src/VersionParser.php
https://github.com/composer/semver/blob/master/src/VersionParser.php
MIT
private function expandStability($stability) { $stability = strtolower($stability); switch ($stability) { case 'a': return 'alpha'; case 'b': return 'beta'; case 'p': case 'pl': return 'patch'; case 'rc': return 'RC'; default: return $stability; } }
Expand shorthand stability string to long version. @param string $stability @return string
expandStability
php
composer/semver
src/VersionParser.php
https://github.com/composer/semver/blob/master/src/VersionParser.php
MIT
public static function isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint) { if ($constraint instanceof MatchAllConstraint) { return true; } if ($candidate instanceof MatchNoneConstraint || $constraint instanceof MatchNoneConstraint) { return false; } $intersectionIntervals = self::get(new MultiConstraint(array($candidate, $constraint), true)); $candidateIntervals = self::get($candidate); if (\count($intersectionIntervals['numeric']) !== \count($candidateIntervals['numeric'])) { return false; } foreach ($intersectionIntervals['numeric'] as $index => $interval) { if (!isset($candidateIntervals['numeric'][$index])) { return false; } if ((string) $candidateIntervals['numeric'][$index]->getStart() !== (string) $interval->getStart()) { return false; } if ((string) $candidateIntervals['numeric'][$index]->getEnd() !== (string) $interval->getEnd()) { return false; } } if ($intersectionIntervals['branches']['exclude'] !== $candidateIntervals['branches']['exclude']) { return false; } if (\count($intersectionIntervals['branches']['names']) !== \count($candidateIntervals['branches']['names'])) { return false; } foreach ($intersectionIntervals['branches']['names'] as $index => $name) { if ($name !== $candidateIntervals['branches']['names'][$index]) { return false; } } return true; }
Checks whether $candidate is a subset of $constraint @return bool
isSubsetOf
php
composer/semver
src/Intervals.php
https://github.com/composer/semver/blob/master/src/Intervals.php
MIT
public static function haveIntersections(ConstraintInterface $a, ConstraintInterface $b) { if ($a instanceof MatchAllConstraint || $b instanceof MatchAllConstraint) { return true; } if ($a instanceof MatchNoneConstraint || $b instanceof MatchNoneConstraint) { return false; } $intersectionIntervals = self::generateIntervals(new MultiConstraint(array($a, $b), true), true); return \count($intersectionIntervals['numeric']) > 0 || $intersectionIntervals['branches']['exclude'] || \count($intersectionIntervals['branches']['names']) > 0; }
Checks whether $a and $b have any intersection, equivalent to $a->matches($b) @return bool
haveIntersections
php
composer/semver
src/Intervals.php
https://github.com/composer/semver/blob/master/src/Intervals.php
MIT
public static function satisfies($version, $constraints) { if (null === self::$versionParser) { self::$versionParser = new VersionParser(); } $versionParser = self::$versionParser; $provider = new Constraint('==', $versionParser->normalize($version)); $parsedConstraints = $versionParser->parseConstraints($constraints); return $parsedConstraints->matches($provider); }
Determine if given version satisfies given constraints. @param string $version @param string $constraints @return bool
satisfies
php
composer/semver
src/Semver.php
https://github.com/composer/semver/blob/master/src/Semver.php
MIT
public static function rsort(array $versions) { return self::usort($versions, self::SORT_DESC); }
Sort given array of versions in reverse. @param string[] $versions @return string[]
rsort
php
composer/semver
src/Semver.php
https://github.com/composer/semver/blob/master/src/Semver.php
MIT
public function __construct($operator, $version) { if (!isset(self::$transOpStr[$operator])) { throw new \InvalidArgumentException(sprintf( 'Invalid operator "%s" given, expected one of: %s', $operator, implode(', ', self::getSupportedOperators()) )); } $this->operator = self::$transOpStr[$operator]; $this->version = $version; }
Sets operator and version to compare with. @param string $operator @param string $version @throws \InvalidArgumentException if invalid operator is given. @phpstan-param self::STR_OP_* $operator
__construct
php
composer/semver
src/Constraint/Constraint.php
https://github.com/composer/semver/blob/master/src/Constraint/Constraint.php
MIT
public static function getSupportedOperators() { return array_keys(self::$transOpStr); }
Get all supported comparison operators. @return array @phpstan-return list<self::STR_OP_*>
getSupportedOperators
php
composer/semver
src/Constraint/Constraint.php
https://github.com/composer/semver/blob/master/src/Constraint/Constraint.php
MIT
public function compareTo(Bound $other, $operator) { if (!\in_array($operator, array('<', '>'), true)) { throw new \InvalidArgumentException('Does not support any other operator other than > or <.'); } // If they are the same it doesn't matter if ($this == $other) { return false; } $compareResult = version_compare($this->getVersion(), $other->getVersion()); // Not the same version means we don't need to check if the bounds are inclusive or not if (0 !== $compareResult) { return (('>' === $operator) ? 1 : -1) === $compareResult; } // Question we're answering here is "am I higher than $other?" return '>' === $operator ? $other->isInclusive() : !$other->isInclusive(); }
Compares a bound to another with a given operator. @param Bound $other @param string $operator @return bool
compareTo
php
composer/semver
src/Constraint/Bound.php
https://github.com/composer/semver/blob/master/src/Constraint/Bound.php
MIT
public static function invite($invitationId, $name) { $invitation = new self(); // After instantiation of the object we apply the "InvitedEvent". $invitation->apply(new InvitedEvent($invitationId, $name)); return $invitation; }
Factory method to create an invitation.
invite
php
broadway/broadway
examples/event-sourced-domain-with-tests/Invites.php
https://github.com/broadway/broadway/blob/master/examples/event-sourced-domain-with-tests/Invites.php
MIT
protected function handleInviteCommand(InviteCommand $command) { $invitation = Invitation::invite($command->invitationId, $command->name); $this->repository->save($invitation); }
A new invite aggregate root is created and added to the repository.
handleInviteCommand
php
broadway/broadway
examples/event-sourced-domain-with-tests/Invites.php
https://github.com/broadway/broadway/blob/master/examples/event-sourced-domain-with-tests/Invites.php
MIT
protected function handleAcceptCommand(AcceptCommand $command) { $invitation = $this->repository->load($command->invitationId); $invitation->accept(); $this->repository->save($invitation); }
An existing invite is loaded from the repository and the accept() method is called.
handleAcceptCommand
php
broadway/broadway
examples/event-sourced-domain-with-tests/Invites.php
https://github.com/broadway/broadway/blob/master/examples/event-sourced-domain-with-tests/Invites.php
MIT
public static function startLookingForWork($jobSeekerId) { $jobSeeker = new self(); // After instantiation of the object we apply the "JobSeekerStartedLookingForWorkEvent". $jobSeeker->apply(new JobSeekerStartedLookingForWorkEvent($jobSeekerId)); return $jobSeeker; }
Factory method to create a job seeker.
startLookingForWork
php
broadway/broadway
examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php
https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php
MIT
protected function handleJobSeekerStartLookingForWorkCommand(JobSeekerStartLookingForWorkCommand $command) { $jobSeeker = JobSeeker::startLookingForWork($command->jobSeekerId); $this->repository->save($jobSeeker); }
A new job seeker aggregate root is created and added to the repository.
handleJobSeekerStartLookingForWorkCommand
php
broadway/broadway
examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php
https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php
MIT