Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
227 / 227 |
EccubeServiceProvider | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
8 | |
100.00% |
227 / 227 |
register | |
100.00% |
1 / 1 |
4 | |
100.00% |
140 / 140 |
|||
anonymous function | |
100.00% |
1 / 1 |
3 | |
100.00% |
85 / 85 |
|||
boot | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
/* | |
* This file is part of EC-CUBE | |
* | |
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. | |
* | |
* http://www.lockon.co.jp/ | |
* | |
* This program is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU General Public License | |
* as published by the Free Software Foundation; either version 2 | |
* of the License, or (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* | |
* You should have received a copy of the GNU General Public License | |
* along with this program; if not, write to the Free Software | |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
*/ | |
namespace Eccube\ServiceProvider; | |
use Eccube\Application; | |
use Silex\Application as BaseApplication; | |
use Silex\ServiceProviderInterface; | |
class EccubeServiceProvider implements ServiceProviderInterface | |
{ | |
/** | |
* Registers services on the given app. | |
* | |
* This method should only be used to configure services and parameters. | |
* It should not get services. | |
* | |
* @param BaseApplication $app An Application instance | |
*/ | |
public function register(BaseApplication $app) | |
{ | |
// Service | |
$app['eccube.service.system'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\SystemService($app); | |
}); | |
$app['view'] = $app->share(function () use ($app) { | |
return $app['twig']; | |
}); | |
$app['eccube.service.cart'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\CartService($app); | |
}); | |
$app['eccube.service.order'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\OrderService($app); | |
}); | |
$app['eccube.service.tax_rule'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\TaxRuleService($app['eccube.repository.tax_rule']); | |
}); | |
$app['eccube.service.plugin'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\PluginService($app); | |
}); | |
$app['eccube.service.mail'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\MailService($app); | |
}); | |
$app['eccube.service.csv.export'] = $app->share(function () use ($app) { | |
$csvService = new \Eccube\Service\CsvExportService(); | |
$csvService->setEntityManager($app['orm.em']); | |
$csvService->setConfig($app['config']); | |
$csvService->setCsvRepository($app['eccube.repository.csv']); | |
$csvService->setCsvTypeRepository($app['eccube.repository.master.csv_type']); | |
$csvService->setOrderRepository($app['eccube.repository.order']); | |
$csvService->setCustomerRepository($app['eccube.repository.customer']); | |
$csvService->setProductRepository($app['eccube.repository.product']); | |
return $csvService; | |
}); | |
$app['eccube.service.shopping'] = $app->share(function () use ($app) { | |
return new \Eccube\Service\ShoppingService($app, $app['eccube.service.cart'], $app['eccube.service.order']); | |
}); | |
// Repository | |
$app['eccube.repository.master.authority'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\Authority'); | |
}); | |
$app['eccube.repository.master.tag'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\Tag'); | |
}); | |
$app['eccube.repository.master.pref'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\Pref'); | |
}); | |
$app['eccube.repository.master.sex'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\Sex'); | |
}); | |
$app['eccube.repository.master.disp'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\Disp'); | |
}); | |
$app['eccube.repository.master.product_type'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\ProductType'); | |
}); | |
$app['eccube.repository.master.page_max'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\PageMax'); | |
}); | |
$app['eccube.repository.master.order_status'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\OrderStatus'); | |
}); | |
$app['eccube.repository.master.device_type'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\DeviceType'); | |
}); | |
$app['eccube.repository.master.csv_type'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\CsvType'); | |
}); | |
$app['eccube.repository.delivery'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Delivery'); | |
}); | |
$app['eccube.repository.delivery_date'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\DeliveryDate'); | |
}); | |
$app['eccube.repository.delivery_fee'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\DeliveryFee'); | |
}); | |
$app['eccube.repository.delivery_time'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\DeliveryTime'); | |
}); | |
$app['eccube.repository.payment'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Payment'); | |
}); | |
$app['eccube.repository.payment_option'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\PaymentOption'); | |
}); | |
$app['eccube.repository.category'] = $app->share(function () use ($app) { | |
$CategoryRepository = $app['orm.em']->getRepository('Eccube\Entity\Category'); | |
$CategoryRepository->setApplication($app); | |
return $CategoryRepository; | |
}); | |
$app['eccube.repository.customer'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Customer'); | |
}); | |
$app['eccube.repository.news'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\News'); | |
}); | |
$app['eccube.repository.mail_history'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\MailHistory'); | |
}); | |
$app['eccube.repository.member'] = $app->share(function () use ($app) { | |
$memberRepository = $app['orm.em']->getRepository('Eccube\Entity\Member'); | |
$memberRepository->setEncoderFactorty($app['security.encoder_factory']); | |
return $memberRepository; | |
}); | |
$app['eccube.repository.order'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Order'); | |
}); | |
$app['eccube.repository.product'] = $app->share(function () use ($app) { | |
$productRepository = $app['orm.em']->getRepository('Eccube\Entity\Product'); | |
return $productRepository; | |
}); | |
$app['eccube.repository.product_image'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\ProductImage'); | |
}); | |
$app['eccube.repository.product_class'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\ProductClass'); | |
}); | |
$app['eccube.repository.product_stock'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\ProductStock'); | |
}); | |
$app['eccube.repository.product_tag'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\ProductTag'); | |
}); | |
$app['eccube.repository.class_name'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\ClassName'); | |
}); | |
$app['eccube.repository.class_category'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\ClassCategory'); | |
}); | |
$app['eccube.repository.customer_favorite_product'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\CustomerFavoriteProduct'); | |
}); | |
$app['eccube.repository.base_info'] = $app->share(function () use ($app) { | |
$BaseInfoRepository = $app['orm.em']->getRepository('Eccube\Entity\BaseInfo'); | |
$BaseInfoRepository->setApplication($app); | |
return $BaseInfoRepository; | |
}); | |
$app['eccube.repository.tax_rule'] = $app->share(function () use ($app) { | |
$taxRuleRepository = $app['orm.em']->getRepository('Eccube\Entity\TaxRule'); | |
$taxRuleRepository->setApplication($app); | |
return $taxRuleRepository; | |
}); | |
$app['eccube.repository.page_layout'] = $app->share(function () use ($app) { | |
$pageLayoutRepository = $app['orm.em']->getRepository('Eccube\Entity\PageLayout'); | |
$pageLayoutRepository->setApplication($app); | |
return $pageLayoutRepository; | |
}); | |
$app['eccube.repository.block'] = $app->share(function () use ($app) { | |
$blockRepository = $app['orm.em']->getRepository('Eccube\Entity\Block'); | |
$blockRepository->setApplication($app); | |
return $blockRepository; | |
}); | |
$app['eccube.repository.order'] = $app->share(function () use ($app) { | |
$orderRepository = $app['orm.em']->getRepository('Eccube\Entity\Order'); | |
$orderRepository->setApplication($app); | |
return $orderRepository; | |
}); | |
$app['eccube.repository.customer_address'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\CustomerAddress'); | |
}); | |
$app['eccube.repository.shipping'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Shipping'); | |
}); | |
$app['eccube.repository.customer_status'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\CustomerStatus'); | |
}); | |
$app['eccube.repository.order_status'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Master\OrderStatus'); | |
}); | |
$app['eccube.repository.mail_template'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\MailTemplate'); | |
}); | |
$app['eccube.repository.csv'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Csv'); | |
}); | |
$app['eccube.repository.template'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Template'); | |
}); | |
$app['eccube.repository.authority_role'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\AuthorityRole'); | |
}); | |
$app['paginator'] = $app->protect(function () { | |
return new \Knp\Component\Pager\Paginator(); | |
}); | |
$app['eccube.repository.help'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Help'); | |
}); | |
$app['eccube.repository.plugin'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\Plugin'); | |
}); | |
$app['eccube.repository.plugin_event_handler'] = $app->share(function () use ($app) { | |
return $app['orm.em']->getRepository('Eccube\Entity\PluginEventHandler'); | |