4 * This file is part of the Fxp Composer Asset Plugin package.
6 * (c) François Pluchino <francois.pluchino@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Fxp\Composer\AssetPlugin\Tests\Fixtures\Repository\Vcs;
15 * Mock vcs driver for packages test.
17 * @author François Pluchino <francois.pluchino@gmail.com>
19 class MockVcsDriverWithPackages extends MockVcsDriver
21 protected $composer = array(
22 'branch:master' => array(
26 'branch:1.x' => array(
30 'tag:v1.0.0' => array(
34 'tag:v1.0.1' => array(
37 'tag:invalid' => array(
39 'description' => 'invalid tag name',
46 public function getRootIdentifier()
54 public function hasComposerFile($identifier)
56 return isset($this->composer['branch:'.$identifier])
57 || isset($this->composer['tag:'.$identifier]);
63 public function getComposerInformation($identifier)
67 if ($this->hasComposerFile($identifier)) {
68 if (isset($this->composer['branch:'.$identifier])) {
69 $composer = $this->composer['branch:'.$identifier];
70 } elseif (isset($this->composer['tag:'.$identifier])) {
71 $composer = $this->composer['tag:'.$identifier];
81 public function getBranches()
83 return $this->getDataPackages('branch');
89 public function getTags()
91 return $this->getDataPackages('tag');
99 protected function getDataPackages($type)
103 foreach ($this->composer as $name => $data) {
104 if (0 === strpos($name, $type.':')) {
105 $name = substr($name, strpos($name, ':') + 1);
106 $packages[$name] = $data;