1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* ownCloud - Music app |
5
|
|
|
* |
6
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
7
|
|
|
* later. See the COPYING file. |
8
|
|
|
* |
9
|
|
|
* @author Pauli Järvinen <[email protected]> |
10
|
|
|
* @copyright Pauli Järvinen 2020 |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace OCA\Music\Db; |
14
|
|
|
|
15
|
|
|
use \OCP\IL10N; |
|
|
|
|
16
|
|
|
use \OCP\AppFramework\Db\Entity; |
|
|
|
|
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @method string getUserId() |
20
|
|
|
* @method void setUserId(string $userId) |
21
|
|
|
* @method string getName() |
22
|
|
|
* @method void setName(string $name) |
23
|
|
|
* @method string getLowerName() |
24
|
|
|
* @method void setLowerName(string $lowerName) |
25
|
|
|
* @method int getTrackCount() |
26
|
|
|
* @method void setTrackCount(int $count) |
27
|
|
|
* @method int getAlbumCount() |
28
|
|
|
* @method void setAlbumCount(int $count) |
29
|
|
|
* @method int getArtistCount() |
30
|
|
|
* @method void setArtistCount(int $count) |
31
|
|
|
* @method array getTrackIds() |
32
|
|
|
* @method void setTrackIds(array $trackIds) |
33
|
|
|
*/ |
34
|
|
|
class Genre extends Entity { |
35
|
|
|
public $userId; |
36
|
|
|
public $name; |
37
|
|
|
public $lowerName; |
38
|
|
|
// not from the music_genres table but still part of the standard content of this entity |
39
|
|
|
public $trackCount; |
40
|
|
|
public $albumCount; |
41
|
|
|
public $artistCount; |
42
|
|
|
|
43
|
|
|
// not part of the standard content, injected separately when needed |
44
|
|
|
public $trackIds; |
45
|
|
|
|
46
|
|
|
public function __construct() { |
47
|
|
|
$this->addType('trackCount', 'int'); |
48
|
|
|
$this->addType('albumCount', 'int'); |
49
|
|
|
$this->addType('artistCount', 'int'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getNameString(IL10N $l10n) { |
53
|
|
|
return $this->getName() ?: self::unknownNameString($l10n); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function toApi() { |
57
|
|
|
return [ |
58
|
|
|
'id' => $this->getId(), |
59
|
|
|
'name' => $this->getName(), |
60
|
|
|
'trackIds' => $this->trackIds ? \array_map('\intval', $this->trackIds) : [] |
61
|
|
|
]; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public static function unknownNameString(IL10N $l10n) { |
65
|
|
|
$name = $l10n->t('(Unknown genre)'); |
66
|
|
|
if (!\is_string($name)) { |
67
|
|
|
/** @var \OC_L10N_String $name */ |
68
|
|
|
$name = $name->__toString(); |
69
|
|
|
} |
70
|
|
|
return $name; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths