Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
10 / 10 |
LocalSourceEntityNamespacesFactory | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
10 / 10 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
getEntityNamespaces | |
100.00% |
1 / 1 |
1 | |
100.00% |
7 / 7 |
<?php | |
namespace MediaWiki\Extension\WikibaseManifest; | |
use NamespaceInfo; | |
use Wikibase\DataAccess\DatabaseEntitySource; | |
class LocalSourceEntityNamespacesFactory implements EntityNamespacesFactory { | |
private $localEntitySource; | |
private $namespaceInfo; | |
public function __construct( DatabaseEntitySource $localEntitySource, NamespaceInfo $namespaceInfo ) { | |
$this->localEntitySource = $localEntitySource; | |
$this->namespaceInfo = $namespaceInfo; | |
} | |
public function getEntityNamespaces(): EntityNamespaces { | |
$entityNamespaceMapping = array_map( | |
function ( $x ) { | |
return [ | |
EntityNamespaces::NAMESPACE_ID => $x, | |
EntityNamespaces::NAMESPACE_NAME => $this->namespaceInfo->getCanonicalName( | |
$x ) | |
]; | |
}, | |
$this->localEntitySource->getEntityNamespaceIds() | |
); | |
return new EntityNamespaces( $entityNamespaceMapping ); | |
} | |
} |