Completed
Pull Request — 1.0.x (#1416)
by Maciej
09:32
created

AbstractCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 42
ccs 0
cts 12
cp 0
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
processDocumentCollection() 0 1 ?
processCollection() 0 1 ?
processDocumentDb() 0 1 ?
processDb() 0 1 ?
processDocumentIndex() 0 1 ?
processIndex() 0 1 ?
A getSchemaManager() 0 4 1
A getDocumentManager() 0 4 1
A getMetadataFactory() 0 4 1
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace Doctrine\ODM\MongoDB\Tools\Console\Command\Schema;
21
22
use Doctrine\ODM\MongoDB\SchemaManager;
23
use Symfony\Component\Console\Command\Command;
24
25
/**
26
 * @author Bulat Shakirzyanov <[email protected]>
27
 */
28
abstract class AbstractCommand extends Command
29
{
30
    const DB = 'db';
31
    const COLLECTION = 'collection';
32
    const INDEX = 'index';
33
34
    abstract protected function processDocumentCollection(SchemaManager $sm, $document);
35
36
    abstract protected function processCollection(SchemaManager $sm);
37
38
    abstract protected function processDocumentDb(SchemaManager $sm, $document);
39
40
    abstract protected function processDb(SchemaManager $sm);
41
42
    abstract protected function processDocumentIndex(SchemaManager $sm, $document);
43
44
    abstract protected function processIndex(SchemaManager $sm);
45
46
    /**
47
     * @return SchemaManager
48
     */
49
    protected function getSchemaManager()
50
    {
51
        return $this->getDocumentManager()->getSchemaManager();
52
    }
53
54
    /**
55
     * @return \Doctrine\ODM\MongoDB\DocumentManager
56
     */
57
    protected function getDocumentManager()
58
    {
59
        return $this->getHelper('documentManager')->getDocumentManager();
60
    }
61
62
    /**
63
     * @return \Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory
64
     */
65
    protected function getMetadataFactory()
66
    {
67
        return $this->getDocumentManager()->getMetadataFactory();
68
    }
69
}
70