From 828325e86ca2fa6b59225d32a275b1ea41170bb6 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Mon, 19 Aug 2019 21:47:59 +0100 Subject: [PATCH] Move to new dispatcher concept --- .travis.yml | 11 +--- composer.json | 5 +- .../Extension/WeblinksComponent.php | 57 +++++++++++++++++++ .../components/com_weblinks/dispatcher.php | 29 ---------- .../com_weblinks/services/provider.php | 55 ++++++++++++++++++ .../components/com_weblinks/weblinks.xml | 1 + 6 files changed, 118 insertions(+), 40 deletions(-) create mode 100644 src/administrator/components/com_weblinks/Extension/WeblinksComponent.php delete mode 100644 src/administrator/components/com_weblinks/dispatcher.php create mode 100644 src/administrator/components/com_weblinks/services/provider.php diff --git a/.travis.yml b/.travis.yml index 3f685bf..bd378b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,14 +10,9 @@ env: matrix: fast_finish: true include: - - php: 5.6 - - php: 7.0 - env: RUN_PHPCS="yes" - sudo: true - addons: - firefox: 'latest-esr' - - php: 7.1 - php: 7.2 + sudo: true + env: RUN_PHPCS="yes" - php: 7.3 before_script: @@ -50,5 +45,5 @@ script: # System tests (Codeception) - mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml - vendor/bin/robo run:tests --use-htaccess -# Run phpcs on PHP 7.0 against weblinks source +# Run phpcs on flagged php versions against weblinks source - if [[ $RUN_PHPCS == "yes" ]]; then vendor/bin/phpcs --report=full --extensions=php -p --standard=tests/joomla/build/phpcs/Joomla ./src; fi diff --git a/composer.json b/composer.json index ba46131..327f822 100644 --- a/composer.json +++ b/composer.json @@ -4,14 +4,13 @@ "license" : "GPL-2.0+", "config": { "platform": { - "php": "5.6.0" + "php": "7.2.0" } }, "require" : { - "php": ">=5.4" + "php": ">=7.2" }, "require-dev": { - "php": ">=5.6", "codeception/codeception": "^3", "phpunit/phpunit": "^5.7.27", "joomla-projects/joomla-browser": "v3.9.0", diff --git a/src/administrator/components/com_weblinks/Extension/WeblinksComponent.php b/src/administrator/components/com_weblinks/Extension/WeblinksComponent.php new file mode 100644 index 0000000..1172396 --- /dev/null +++ b/src/administrator/components/com_weblinks/Extension/WeblinksComponent.php @@ -0,0 +1,57 @@ +registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Weblinks')); + $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Weblinks')); + $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Weblinks')); + $container->set( + ComponentInterface::class, + function (Container $container) + { + $component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class)); + $component->setMVCFactory($container->get(MVCFactoryInterface::class)); + $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); + + return $component; + } + ); + } +}; diff --git a/src/administrator/components/com_weblinks/weblinks.xml b/src/administrator/components/com_weblinks/weblinks.xml index dec3e4c..a872b1c 100644 --- a/src/administrator/components/com_weblinks/weblinks.xml +++ b/src/administrator/components/com_weblinks/weblinks.xml @@ -10,6 +10,7 @@ ##VERSION## COM_WEBLINKS_XML_DESCRIPTION script.php + Joomla\Component\Weblinks