-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Introduce category factory #20693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
94d9d73
Introduce category factory
laoneo 229a9a5
Merge branch '4.0-dev' into j4/category/factory
laoneo b4d5180
Merge branch '4.0-dev' into j4/category/factory
laoneo 04585ee
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/categ…
laoneo b082c79
Adapt banners
laoneo ab035be
Introduce CategoryInterface
laoneo b853e72
Merge branch '4.0-dev' into j4/category/factory
laoneo 6effc50
Merge branch '4.0-dev' into j4/category/factory
laoneo f4433e1
Merge branch '4.0-dev' into j4/category/factory
laoneo ae2c1d4
Merge conflicts
laoneo 928a192
Merge remote-tracking branch 'origin/j4/category/factory' into j4/cat…
laoneo cfa75cd
Merge branch '4.0-dev' into j4/category/factory
laoneo 415a9fb
Merge branch '4.0-dev' into j4/category/factory
laoneo bde3fce
Merge branch '4.0-dev' into j4/category/factory
laoneo 582fa3e
Merge branch '4.0-dev' into j4/category/factory
laoneo 8a98738
Merge branch '4.0-dev' into j4/category/factory
laoneo 1096d28
Less strict method signature
laoneo 970f7fa
Restore typed classes
laoneo 006c385
Merge remote-tracking branch 'origin/j4/category/factory' into j4/cat…
laoneo 3a7a601
doc block
laoneo 34b8bfc
Remove obsolete code
laoneo c15cfd5
Merge branch '4.0-dev' into j4/category/factory
laoneo 2b14500
Merge branch '4.0-dev' into j4/category/factory
laoneo 5dca489
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/categ…
laoneo bddbd98
Merge remote-tracking branch 'origin/j4/category/factory' into j4/cat…
laoneo a1b8f49
Rename CategoriesServiceTrait to CategoryServiceTrait
laoneo ff0b995
Rename CategoriesServiceInterface to CategoryServiceInterface
laoneo c86ba15
Rename CategoriesFactoryInterface to CategoryFactoryInterface
laoneo 684acdb
Rename setCategoriesFactory to setCategoryFactory
laoneo bda3a8b
Rename CategoriesFactory service provider to CategoryFactory
laoneo ab9ffc7
Merge branch '4.0-dev' into j4/category/factory
laoneo d2680ac
Merge branch '4.0-dev' into j4/category/factory
laoneo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <?php | ||
| /** | ||
| * Joomla! Content Management System | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE | ||
| */ | ||
|
|
||
| namespace Joomla\CMS\Categories; | ||
|
|
||
| defined('_JEXEC') or die; | ||
|
|
||
| /** | ||
| * Option based categories factory. | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| class CategoriesFactory implements CategoriesFactoryInterface | ||
| { | ||
| /** | ||
| * The options | ||
| * | ||
| * @var array | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| private $options; | ||
|
|
||
| /** | ||
| * CategoriesFactory constructor. | ||
| * | ||
| * @param array $options The options | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| public function __construct(array $options) | ||
| { | ||
| $this->options = $options; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a category. | ||
| * | ||
| * @param string $section The section | ||
| * | ||
| * @return CategoryInterface | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| * | ||
| * @throws SectionNotFoundException | ||
| */ | ||
| public function createCategory(string $section): CategoryInterface | ||
| { | ||
| if (!array_key_exists($section, $this->options)) | ||
| { | ||
| throw new SectionNotFoundException; | ||
| } | ||
|
|
||
| return new Categories($this->options[$section]); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?php | ||
| /** | ||
| * Joomla! Content Management System | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| namespace Joomla\CMS\Categories; | ||
|
|
||
| defined('_JEXEC') or die; | ||
|
|
||
| /** | ||
| * Categories factory interface | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| interface CategoriesFactoryInterface | ||
| { | ||
| /** | ||
| * Creates a category. | ||
| * | ||
| * @param string $section The section | ||
| * | ||
| * @return CategoryInterface | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| * | ||
| * @throws SectionNotFoundException | ||
| */ | ||
| public function createCategory(string $section): CategoryInterface; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this is a b/c break for people who are subclassing JCategories and overriding this method.
Having said that I doubt people are overriding this method so it's probably ok. any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, lets revert it then.