blob: 11da03a102653d2a42a443aa46103d35089ca35e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
/**
* ownCloud - galleryplus
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Olivier Paroz <owncloud@interfasys.ch>
*
* @copyright Olivier Paroz 2014-2015
*/
namespace OCA\GalleryPlus\Service;
use OCA\GalleryPlus\Utility\SmarterLogger;
/**
* Contains methods which all services will need
*
* @package OCA\GalleryPlus\Service
*/
abstract class Service {
/**
* @type string
*/
private $appName;
/**
* @type SmarterLogger
*/
protected $logger;
/**
* Constructor
*
* @param string $appName
* @param SmarterLogger $logger
*/
public function __construct(
$appName,
SmarterLogger $logger
) {
$this->appName = $appName;
$this->logger = $logger;
}
/**
* Logs the error and raises an exception
*
* @param string $message
*
* @throws ServiceException
*/
protected function logAndThrowNotFound($message) {
$this->logger->error($message . ' (404)');
throw new NotFoundServiceException($message);
}
}
|