/** * * return a object to handle news items * from the news app * * @return mixed|null */ private function getNewsApp() { /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ $app = new \OCA\News\AppInfo\Application(); $container = $app->getContainer(); $service = null; try { $service = $container->query('OCA\\News\\Service\\ItemService'); } catch (\InvalidArgumentException $e) { } if (!$service) { $service = $container->query('ItemService'); } return $service; }
<?php /** * ownCloud - News * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Bernhard Posselt <*****@*****.**> * @copyright Bernhard Posselt 2015 */ $newsApp = new OCA\News\AppInfo\Application(); $newsContainer = $newsApp->getContainer(); $newsCmd = $newsContainer->query('OCA\\News\\Command\\GenerateSearchIndices'); $application->add($newsCmd);
private function getNewsapi() { $app = null; if (class_exists('\OCA\News\App\News')) { $app = new \OCA\News\App\News(); } elseif (class_exists('\OCA\News\AppInfo\Application')) { $app = new \OCA\News\AppInfo\Application(); } if( $app ) { $container = $app->getContainer(); $this->itembusinesslayer = $container->query('ItemBusinessLayer'); } }