Passed
Pull Request — 4.2 (#140)
by David
09:31
created
src/Mouf/Database/TDBM/Configuration.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -15,161 +15,161 @@
 block discarded – undo
15 15
 class Configuration implements ConfigurationInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @var string
20
-     */
21
-    private $beanNamespace;
22
-    /**
23
-     * @var string
24
-     */
25
-    private $daoNamespace;
26
-    /**
27
-     * @var Connection
28
-     */
29
-    private $connection;
30
-    /**
31
-     * @var Cache
32
-     */
33
-    private $cache;
34
-    /**
35
-     * @var SchemaAnalyzer
36
-     */
37
-    private $schemaAnalyzer;
38
-    /**
39
-     * @var LoggerInterface
40
-     */
41
-    private $logger;
42
-    /**
43
-     * @var GeneratorListenerInterface
44
-     */
45
-    private $generatorEventDispatcher;
46
-    /**
47
-     * @var NamingStrategyInterface
48
-     */
49
-    private $namingStrategy;
50
-    /**
51
-     * @var string|null
52
-     */
53
-    private $customComposerFile;
54
-
55
-    /**
56
-     * @param string $beanNamespace The namespace hosting the beans
57
-     * @param string $daoNamespace The namespace hosting the DAOs
58
-     * @param Connection $connection The connection to the database
59
-     * @param Cache|null $cache The Doctrine cache to store database metadata
60
-     * @param SchemaAnalyzer|null $schemaAnalyzer The schema analyzer that will be used to find shortest paths... Will be automatically created if not passed
61
-     * @param LoggerInterface|null $logger The logger
62
-     * @param GeneratorListenerInterface[] $generatorListeners A list of listeners that will be triggered when beans/daos are generated
63
-     */
64
-    public function __construct(string $beanNamespace, string $daoNamespace, Connection $connection, NamingStrategyInterface $namingStrategy, Cache $cache = null, SchemaAnalyzer $schemaAnalyzer = null, LoggerInterface $logger = null, array $generatorListeners = [])
65
-    {
66
-        $this->beanNamespace = rtrim($beanNamespace, '\\');
67
-        $this->daoNamespace = rtrim($daoNamespace, '\\');
68
-        $this->connection = $connection;
69
-        $this->namingStrategy = $namingStrategy;
70
-        if ($cache !== null) {
71
-            $this->cache = $cache;
72
-        } else {
73
-            $this->cache = new VoidCache();
74
-        }
75
-        if ($schemaAnalyzer !== null) {
76
-            $this->schemaAnalyzer = $schemaAnalyzer;
77
-        } else {
78
-            $this->schemaAnalyzer = new SchemaAnalyzer($this->connection->getSchemaManager(), $this->cache, $this->getConnectionUniqueId());
79
-        }
80
-        $this->logger = $logger;
81
-        $this->generatorEventDispatcher = new GeneratorEventDispatcher($generatorListeners);
82
-    }
83
-
84
-    /**
85
-     * @return string
86
-     */
87
-    public function getBeanNamespace(): string
88
-    {
89
-        return $this->beanNamespace;
90
-    }
91
-
92
-    /**
93
-     * @return string
94
-     */
95
-    public function getDaoNamespace(): string
96
-    {
97
-        return $this->daoNamespace;
98
-    }
99
-
100
-    /**
101
-     * @return Connection
102
-     */
103
-    public function getConnection(): Connection
104
-    {
105
-        return $this->connection;
106
-    }
107
-
108
-    /**
109
-     * @return NamingStrategyInterface
110
-     */
111
-    public function getNamingStrategy(): NamingStrategyInterface
112
-    {
113
-        return $this->namingStrategy;
114
-    }
115
-
116
-    /**
117
-     * @return Cache
118
-     */
119
-    public function getCache(): Cache
120
-    {
121
-        return $this->cache;
122
-    }
123
-
124
-    /**
125
-     * @return SchemaAnalyzer
126
-     */
127
-    public function getSchemaAnalyzer(): SchemaAnalyzer
128
-    {
129
-        return $this->schemaAnalyzer;
130
-    }
131
-
132
-    /**
133
-     * @return LoggerInterface
134
-     */
135
-    public function getLogger(): ?LoggerInterface
136
-    {
137
-        return $this->logger;
138
-    }
139
-
140
-    /**
141
-     * @return GeneratorListenerInterface
142
-     */
143
-    public function getGeneratorEventDispatcher(): GeneratorListenerInterface
144
-    {
145
-        return $this->generatorEventDispatcher;
146
-    }
147
-
148
-
149
-
150
-    /**
151
-     * Creates a unique cache key for the current connection.
152
-     *
153
-     * @return string
154
-     */
155
-    private function getConnectionUniqueId(): string
156
-    {
157
-        return hash('md4', $this->connection->getHost().'-'.$this->connection->getPort().'-'.$this->connection->getDatabase().'-'.$this->connection->getDriver()->getName());
158
-    }
159
-
160
-    /**
161
-     * @return null|string
162
-     */
163
-    public function getCustomComposerFile() : ?string
164
-    {
165
-        return $this->customComposerFile;
166
-    }
167
-
168
-    /**
169
-     * @param null|string $customComposerFile
170
-     */
171
-    public function setCustomComposerFile($customComposerFile)
172
-    {
173
-        $this->customComposerFile = $customComposerFile;
174
-    }
18
+	/**
19
+	 * @var string
20
+	 */
21
+	private $beanNamespace;
22
+	/**
23
+	 * @var string
24
+	 */
25
+	private $daoNamespace;
26
+	/**
27
+	 * @var Connection
28
+	 */
29
+	private $connection;
30
+	/**
31
+	 * @var Cache
32
+	 */
33
+	private $cache;
34
+	/**
35
+	 * @var SchemaAnalyzer
36
+	 */
37
+	private $schemaAnalyzer;
38
+	/**
39
+	 * @var LoggerInterface
40
+	 */
41
+	private $logger;
42
+	/**
43
+	 * @var GeneratorListenerInterface
44
+	 */
45
+	private $generatorEventDispatcher;
46
+	/**
47
+	 * @var NamingStrategyInterface
48
+	 */
49
+	private $namingStrategy;
50
+	/**
51
+	 * @var string|null
52
+	 */
53
+	private $customComposerFile;
54
+
55
+	/**
56
+	 * @param string $beanNamespace The namespace hosting the beans
57
+	 * @param string $daoNamespace The namespace hosting the DAOs
58
+	 * @param Connection $connection The connection to the database
59
+	 * @param Cache|null $cache The Doctrine cache to store database metadata
60
+	 * @param SchemaAnalyzer|null $schemaAnalyzer The schema analyzer that will be used to find shortest paths... Will be automatically created if not passed
61
+	 * @param LoggerInterface|null $logger The logger
62
+	 * @param GeneratorListenerInterface[] $generatorListeners A list of listeners that will be triggered when beans/daos are generated
63
+	 */
64
+	public function __construct(string $beanNamespace, string $daoNamespace, Connection $connection, NamingStrategyInterface $namingStrategy, Cache $cache = null, SchemaAnalyzer $schemaAnalyzer = null, LoggerInterface $logger = null, array $generatorListeners = [])
65
+	{
66
+		$this->beanNamespace = rtrim($beanNamespace, '\\');
67
+		$this->daoNamespace = rtrim($daoNamespace, '\\');
68
+		$this->connection = $connection;
69
+		$this->namingStrategy = $namingStrategy;
70
+		if ($cache !== null) {
71
+			$this->cache = $cache;
72
+		} else {
73
+			$this->cache = new VoidCache();
74
+		}
75
+		if ($schemaAnalyzer !== null) {
76
+			$this->schemaAnalyzer = $schemaAnalyzer;
77
+		} else {
78
+			$this->schemaAnalyzer = new SchemaAnalyzer($this->connection->getSchemaManager(), $this->cache, $this->getConnectionUniqueId());
79
+		}
80
+		$this->logger = $logger;
81
+		$this->generatorEventDispatcher = new GeneratorEventDispatcher($generatorListeners);
82
+	}
83
+
84
+	/**
85
+	 * @return string
86
+	 */
87
+	public function getBeanNamespace(): string
88
+	{
89
+		return $this->beanNamespace;
90
+	}
91
+
92
+	/**
93
+	 * @return string
94
+	 */
95
+	public function getDaoNamespace(): string
96
+	{
97
+		return $this->daoNamespace;
98
+	}
99
+
100
+	/**
101
+	 * @return Connection
102
+	 */
103
+	public function getConnection(): Connection
104
+	{
105
+		return $this->connection;
106
+	}
107
+
108
+	/**
109
+	 * @return NamingStrategyInterface
110
+	 */
111
+	public function getNamingStrategy(): NamingStrategyInterface
112
+	{
113
+		return $this->namingStrategy;
114
+	}
115
+
116
+	/**
117
+	 * @return Cache
118
+	 */
119
+	public function getCache(): Cache
120
+	{
121
+		return $this->cache;
122
+	}
123
+
124
+	/**
125
+	 * @return SchemaAnalyzer
126
+	 */
127
+	public function getSchemaAnalyzer(): SchemaAnalyzer
128
+	{
129
+		return $this->schemaAnalyzer;
130
+	}
131
+
132
+	/**
133
+	 * @return LoggerInterface
134
+	 */
135
+	public function getLogger(): ?LoggerInterface
136
+	{
137
+		return $this->logger;
138
+	}
139
+
140
+	/**
141
+	 * @return GeneratorListenerInterface
142
+	 */
143
+	public function getGeneratorEventDispatcher(): GeneratorListenerInterface
144
+	{
145
+		return $this->generatorEventDispatcher;
146
+	}
147
+
148
+
149
+
150
+	/**
151
+	 * Creates a unique cache key for the current connection.
152
+	 *
153
+	 * @return string
154
+	 */
155
+	private function getConnectionUniqueId(): string
156
+	{
157
+		return hash('md4', $this->connection->getHost().'-'.$this->connection->getPort().'-'.$this->connection->getDatabase().'-'.$this->connection->getDriver()->getName());
158
+	}
159
+
160
+	/**
161
+	 * @return null|string
162
+	 */
163
+	public function getCustomComposerFile() : ?string
164
+	{
165
+		return $this->customComposerFile;
166
+	}
167
+
168
+	/**
169
+	 * @param null|string $customComposerFile
170
+	 */
171
+	public function setCustomComposerFile($customComposerFile)
172
+	{
173
+		$this->customComposerFile = $customComposerFile;
174
+	}
175 175
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     /**
133 133
      * @return LoggerInterface
134 134
      */
135
-    public function getLogger(): ?LoggerInterface
135
+    public function getLogger(): ? LoggerInterface
136 136
     {
137 137
         return $this->logger;
138 138
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     /**
161 161
      * @return null|string
162 162
      */
163
-    public function getCustomComposerFile() : ?string
163
+    public function getCustomComposerFile() : ? string
164 164
     {
165 165
         return $this->customComposerFile;
166 166
     }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/ConfigurationInterface.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,43 +11,43 @@
 block discarded – undo
11 11
 
12 12
 interface ConfigurationInterface
13 13
 {
14
-    /**
15
-     * @return string
16
-     */
17
-    public function getBeanNamespace(): string;
18
-
19
-    /**
20
-     * @return string
21
-     */
22
-    public function getDaoNamespace(): string;
23
-
24
-    /**
25
-     * @return Connection
26
-     */
27
-    public function getConnection(): Connection;
28
-
29
-    /**
30
-     * @return Cache
31
-     */
32
-    public function getCache(): Cache;
33
-
34
-    /**
35
-     * @return NamingStrategyInterface
36
-     */
37
-    public function getNamingStrategy(): NamingStrategyInterface;
38
-
39
-    /**
40
-     * @return SchemaAnalyzer
41
-     */
42
-    public function getSchemaAnalyzer(): SchemaAnalyzer;
43
-
44
-    /**
45
-     * @return LoggerInterface
46
-     */
47
-    public function getLogger(): ?LoggerInterface;
48
-
49
-    /**
50
-     * @return GeneratorListenerInterface
51
-     */
52
-    public function getGeneratorEventDispatcher(): GeneratorListenerInterface;
14
+	/**
15
+	 * @return string
16
+	 */
17
+	public function getBeanNamespace(): string;
18
+
19
+	/**
20
+	 * @return string
21
+	 */
22
+	public function getDaoNamespace(): string;
23
+
24
+	/**
25
+	 * @return Connection
26
+	 */
27
+	public function getConnection(): Connection;
28
+
29
+	/**
30
+	 * @return Cache
31
+	 */
32
+	public function getCache(): Cache;
33
+
34
+	/**
35
+	 * @return NamingStrategyInterface
36
+	 */
37
+	public function getNamingStrategy(): NamingStrategyInterface;
38
+
39
+	/**
40
+	 * @return SchemaAnalyzer
41
+	 */
42
+	public function getSchemaAnalyzer(): SchemaAnalyzer;
43
+
44
+	/**
45
+	 * @return LoggerInterface
46
+	 */
47
+	public function getLogger(): ?LoggerInterface;
48
+
49
+	/**
50
+	 * @return GeneratorListenerInterface
51
+	 */
52
+	public function getGeneratorEventDispatcher(): GeneratorListenerInterface;
53 53
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     /**
45 45
      * @return LoggerInterface
46 46
      */
47
-    public function getLogger(): ?LoggerInterface;
47
+    public function getLogger(): ? LoggerInterface;
48 48
 
49 49
     /**
50 50
      * @return GeneratorListenerInterface
Please login to merge, or discard this patch.
src/views/installStep2.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 <input type="hidden" id="selfedit" name="selfedit" value="<?php echo plainstring_to_htmlprotected($this->selfedit) ?>" />
9 9
 
10 10
 <?php if (!$this->autoloadDetected) {
11
-    ?>
11
+	?>
12 12
 <div class="alert">Warning! TDBM could not detect the autoload section of your composer.json file.
13 13
 Unless you are developing your own autoload system, you should configure <strong>composer.json</strong> to <a href="http://getcomposer.org/doc/01-basic-usage.md#autoloading" target="_blank">define a source directory and a root namespace using PSR-0</a>.</div>
14 14
 <?php
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Utils/MoufDiListener.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -11,58 +11,58 @@
 block discarded – undo
11 11
 class MoufDiListener implements GeneratorListenerInterface
12 12
 {
13 13
 
14
-    /**
15
-     * @param ConfigurationInterface $configuration
16
-     * @param BeanDescriptorInterface[] $beanDescriptors
17
-     */
18
-    public function onGenerate(ConfigurationInterface $configuration, array $beanDescriptors): void
19
-    {
20
-        // Let's generate the needed instance in Mouf.
21
-        $moufManager = MoufManager::getMoufManager();
14
+	/**
15
+	 * @param ConfigurationInterface $configuration
16
+	 * @param BeanDescriptorInterface[] $beanDescriptors
17
+	 */
18
+	public function onGenerate(ConfigurationInterface $configuration, array $beanDescriptors): void
19
+	{
20
+		// Let's generate the needed instance in Mouf.
21
+		$moufManager = MoufManager::getMoufManager();
22 22
 
23
-        $daoFactoryInstanceName = null;
24
-        if ($configuration instanceof MoufConfiguration) {
25
-            $daoFactoryInstanceName = $configuration->getDaoFactoryInstanceName();
26
-            $daoFactoryClassName = $configuration->getDaoNamespace().'\\Generated\\'.$configuration->getNamingStrategy()->getDaoFactoryClassName();
27
-            $moufManager->declareComponent($daoFactoryInstanceName, $daoFactoryClassName, false, MoufManager::DECLARE_ON_EXIST_KEEP_INCOMING_LINKS);
28
-        }
23
+		$daoFactoryInstanceName = null;
24
+		if ($configuration instanceof MoufConfiguration) {
25
+			$daoFactoryInstanceName = $configuration->getDaoFactoryInstanceName();
26
+			$daoFactoryClassName = $configuration->getDaoNamespace().'\\Generated\\'.$configuration->getNamingStrategy()->getDaoFactoryClassName();
27
+			$moufManager->declareComponent($daoFactoryInstanceName, $daoFactoryClassName, false, MoufManager::DECLARE_ON_EXIST_KEEP_INCOMING_LINKS);
28
+		}
29 29
 
30
-        $tdbmServiceInstanceName = $this->getTdbmInstanceName($configuration);
30
+		$tdbmServiceInstanceName = $this->getTdbmInstanceName($configuration);
31 31
 
32
-        foreach ($beanDescriptors as $beanDescriptor) {
33
-            $daoName = $beanDescriptor->getDaoClassName();
32
+		foreach ($beanDescriptors as $beanDescriptor) {
33
+			$daoName = $beanDescriptor->getDaoClassName();
34 34
 
35
-            $instanceName = TDBMDaoGenerator::toVariableName($daoName);
36
-            if (!$moufManager->instanceExists($instanceName)) {
37
-                $moufManager->declareComponent($instanceName, $configuration->getDaoNamespace().'\\'.$daoName);
38
-            }
39
-            $moufManager->setParameterViaConstructor($instanceName, 0, $tdbmServiceInstanceName, 'object');
40
-            if ($daoFactoryInstanceName !== null) {
41
-                $moufManager->bindComponentViaSetter($daoFactoryInstanceName, 'set'.$daoName, $instanceName);
42
-            }
43
-        }
35
+			$instanceName = TDBMDaoGenerator::toVariableName($daoName);
36
+			if (!$moufManager->instanceExists($instanceName)) {
37
+				$moufManager->declareComponent($instanceName, $configuration->getDaoNamespace().'\\'.$daoName);
38
+			}
39
+			$moufManager->setParameterViaConstructor($instanceName, 0, $tdbmServiceInstanceName, 'object');
40
+			if ($daoFactoryInstanceName !== null) {
41
+				$moufManager->bindComponentViaSetter($daoFactoryInstanceName, 'set'.$daoName, $instanceName);
42
+			}
43
+		}
44 44
 
45
-        $moufManager->rewriteMouf();
46
-    }
45
+		$moufManager->rewriteMouf();
46
+	}
47 47
 
48
-    private function getTdbmInstanceName(ConfigurationInterface $configuration) : string
49
-    {
50
-        $moufManager = MoufManager::getMoufManager();
48
+	private function getTdbmInstanceName(ConfigurationInterface $configuration) : string
49
+	{
50
+		$moufManager = MoufManager::getMoufManager();
51 51
 
52
-        $configurationInstanceName = $moufManager->findInstanceName($configuration);
53
-        if (!$configurationInstanceName) {
54
-            throw new \TDBMException('Could not find TDBM instance for configuration object.');
55
-        }
52
+		$configurationInstanceName = $moufManager->findInstanceName($configuration);
53
+		if (!$configurationInstanceName) {
54
+			throw new \TDBMException('Could not find TDBM instance for configuration object.');
55
+		}
56 56
 
57
-        // Let's find the configuration
58
-        $tdbmServicesNames = $moufManager->findInstances(TDBMService::class);
57
+		// Let's find the configuration
58
+		$tdbmServicesNames = $moufManager->findInstances(TDBMService::class);
59 59
 
60
-        foreach ($tdbmServicesNames as $name) {
61
-            if ($moufManager->getInstanceDescriptor($name)->getConstructorArgumentProperty('configuration')->getValue()->getName() === $configurationInstanceName) {
62
-                return $name;
63
-            }
64
-        }
60
+		foreach ($tdbmServicesNames as $name) {
61
+			if ($moufManager->getInstanceDescriptor($name)->getConstructorArgumentProperty('configuration')->getValue()->getName() === $configurationInstanceName) {
62
+				return $name;
63
+			}
64
+		}
65 65
 
66
-        throw new \TDBMException('Could not find TDBMService instance.');
67
-    }
66
+		throw new \TDBMException('Could not find TDBMService instance.');
67
+	}
68 68
 }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Utils/DefaultNamingStrategy.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -7,168 +7,168 @@
 block discarded – undo
7 7
 
8 8
 class DefaultNamingStrategy implements NamingStrategyInterface
9 9
 {
10
-    private $beanPrefix = '';
11
-    private $beanSuffix = '';
12
-    private $baseBeanPrefix = 'Abstract';
13
-    private $baseBeanSuffix = '';
14
-    private $daoPrefix = '';
15
-    private $daoSuffix = 'Dao';
16
-    private $baseDaoPrefix = 'Abstract';
17
-    private $baseDaoSuffix = 'Dao';
18
-
19
-    /**
20
-     * Sets the string prefix to any bean class name.
21
-     *
22
-     * @param string $beanPrefix
23
-     */
24
-    public function setBeanPrefix(string $beanPrefix)
25
-    {
26
-        $this->beanPrefix = $beanPrefix;
27
-    }
28
-
29
-    /**
30
-     * Sets the string suffix to any bean class name.
31
-     *
32
-     * @param string $beanSuffix
33
-     */
34
-    public function setBeanSuffix(string $beanSuffix)
35
-    {
36
-        $this->beanSuffix = $beanSuffix;
37
-    }
38
-
39
-    /**
40
-     * Sets the string prefix to any base bean class name.
41
-     *
42
-     * @param string $baseBeanPrefix
43
-     */
44
-    public function setBaseBeanPrefix(string $baseBeanPrefix)
45
-    {
46
-        $this->baseBeanPrefix = $baseBeanPrefix;
47
-    }
48
-
49
-    /**
50
-     * Sets the string suffix to any base bean class name.
51
-     *
52
-     * @param string $baseBeanSuffix
53
-     */
54
-    public function setBaseBeanSuffix(string $baseBeanSuffix)
55
-    {
56
-        $this->baseBeanSuffix = $baseBeanSuffix;
57
-    }
58
-
59
-    /**
60
-     * Sets the string prefix to any DAO class name.
61
-     *
62
-     * @param string $daoPrefix
63
-     */
64
-    public function setDaoPrefix(string $daoPrefix)
65
-    {
66
-        $this->daoPrefix = $daoPrefix;
67
-    }
68
-
69
-    /**
70
-     * Sets the string suffix to any DAO class name.
71
-     *
72
-     * @param string $daoSuffix
73
-     */
74
-    public function setDaoSuffix(string $daoSuffix)
75
-    {
76
-        $this->daoSuffix = $daoSuffix;
77
-    }
78
-
79
-    /**
80
-     * Sets the string prefix to any base DAO class name.
81
-     *
82
-     * @param string $baseDaoPrefix
83
-     */
84
-    public function setBaseDaoPrefix(string $baseDaoPrefix)
85
-    {
86
-        $this->baseDaoPrefix = $baseDaoPrefix;
87
-    }
88
-
89
-    /**
90
-     * Sets the string suffix to any base DAO class name.
91
-     *
92
-     * @param string $baseDaoSuffix
93
-     */
94
-    public function setBaseDaoSuffix(string $baseDaoSuffix)
95
-    {
96
-        $this->baseDaoSuffix = $baseDaoSuffix;
97
-    }
98
-
99
-
100
-    /**
101
-     * Returns the bean class name from the table name (excluding the namespace).
102
-     *
103
-     * @param string $tableName
104
-     * @return string
105
-     */
106
-    public function getBeanClassName(string $tableName): string
107
-    {
108
-        return $this->beanPrefix.self::toSingularCamelCase($tableName).$this->beanSuffix;
109
-    }
110
-
111
-    /**
112
-     * Returns the base bean class name from the table name (excluding the namespace).
113
-     *
114
-     * @param string $tableName
115
-     * @return string
116
-     */
117
-    public function getBaseBeanClassName(string $tableName): string
118
-    {
119
-        return $this->baseBeanPrefix.self::toSingularCamelCase($tableName).$this->baseBeanSuffix;
120
-    }
121
-
122
-    /**
123
-     * Returns the name of the DAO class from the table name (excluding the namespace).
124
-     *
125
-     * @param string $tableName
126
-     * @return string
127
-     */
128
-    public function getDaoClassName(string $tableName): string
129
-    {
130
-        return $this->daoPrefix.self::toSingularCamelCase($tableName).$this->daoSuffix;
131
-    }
132
-
133
-    /**
134
-     * Returns the name of the base DAO class from the table name (excluding the namespace).
135
-     *
136
-     * @param string $tableName
137
-     * @return string
138
-     */
139
-    public function getBaseDaoClassName(string $tableName): string
140
-    {
141
-        return $this->baseDaoPrefix.self::toSingularCamelCase($tableName).$this->baseDaoSuffix;
142
-    }
143
-
144
-    /**
145
-     * Tries to put string to the singular form (if it is plural) and camel case form.
146
-     * We assume the table names are in english.
147
-     *
148
-     * @param $str string
149
-     *
150
-     * @return string
151
-     */
152
-    private static function toSingularCamelCase(string $str): string
153
-    {
154
-        $tokens = preg_split("/[_ ]+/", $str);
155
-        $tokens = array_map([Inflector::class, 'singularize'], $tokens);
156
-
157
-        $str = '';
158
-        foreach ($tokens as $token) {
159
-            $str .= ucfirst(Inflector::singularize($token));
160
-        }
161
-
162
-        return $str;
163
-    }
164
-
165
-    /**
166
-     * Returns the class name for the DAO factory.
167
-     *
168
-     * @return string
169
-     */
170
-    public function getDaoFactoryClassName(): string
171
-    {
172
-        return 'DaoFactory';
173
-    }
10
+	private $beanPrefix = '';
11
+	private $beanSuffix = '';
12
+	private $baseBeanPrefix = 'Abstract';
13
+	private $baseBeanSuffix = '';
14
+	private $daoPrefix = '';
15
+	private $daoSuffix = 'Dao';
16
+	private $baseDaoPrefix = 'Abstract';
17
+	private $baseDaoSuffix = 'Dao';
18
+
19
+	/**
20
+	 * Sets the string prefix to any bean class name.
21
+	 *
22
+	 * @param string $beanPrefix
23
+	 */
24
+	public function setBeanPrefix(string $beanPrefix)
25
+	{
26
+		$this->beanPrefix = $beanPrefix;
27
+	}
28
+
29
+	/**
30
+	 * Sets the string suffix to any bean class name.
31
+	 *
32
+	 * @param string $beanSuffix
33
+	 */
34
+	public function setBeanSuffix(string $beanSuffix)
35
+	{
36
+		$this->beanSuffix = $beanSuffix;
37
+	}
38
+
39
+	/**
40
+	 * Sets the string prefix to any base bean class name.
41
+	 *
42
+	 * @param string $baseBeanPrefix
43
+	 */
44
+	public function setBaseBeanPrefix(string $baseBeanPrefix)
45
+	{
46
+		$this->baseBeanPrefix = $baseBeanPrefix;
47
+	}
48
+
49
+	/**
50
+	 * Sets the string suffix to any base bean class name.
51
+	 *
52
+	 * @param string $baseBeanSuffix
53
+	 */
54
+	public function setBaseBeanSuffix(string $baseBeanSuffix)
55
+	{
56
+		$this->baseBeanSuffix = $baseBeanSuffix;
57
+	}
58
+
59
+	/**
60
+	 * Sets the string prefix to any DAO class name.
61
+	 *
62
+	 * @param string $daoPrefix
63
+	 */
64
+	public function setDaoPrefix(string $daoPrefix)
65
+	{
66
+		$this->daoPrefix = $daoPrefix;
67
+	}
68
+
69
+	/**
70
+	 * Sets the string suffix to any DAO class name.
71
+	 *
72
+	 * @param string $daoSuffix
73
+	 */
74
+	public function setDaoSuffix(string $daoSuffix)
75
+	{
76
+		$this->daoSuffix = $daoSuffix;
77
+	}
78
+
79
+	/**
80
+	 * Sets the string prefix to any base DAO class name.
81
+	 *
82
+	 * @param string $baseDaoPrefix
83
+	 */
84
+	public function setBaseDaoPrefix(string $baseDaoPrefix)
85
+	{
86
+		$this->baseDaoPrefix = $baseDaoPrefix;
87
+	}
88
+
89
+	/**
90
+	 * Sets the string suffix to any base DAO class name.
91
+	 *
92
+	 * @param string $baseDaoSuffix
93
+	 */
94
+	public function setBaseDaoSuffix(string $baseDaoSuffix)
95
+	{
96
+		$this->baseDaoSuffix = $baseDaoSuffix;
97
+	}
98
+
99
+
100
+	/**
101
+	 * Returns the bean class name from the table name (excluding the namespace).
102
+	 *
103
+	 * @param string $tableName
104
+	 * @return string
105
+	 */
106
+	public function getBeanClassName(string $tableName): string
107
+	{
108
+		return $this->beanPrefix.self::toSingularCamelCase($tableName).$this->beanSuffix;
109
+	}
110
+
111
+	/**
112
+	 * Returns the base bean class name from the table name (excluding the namespace).
113
+	 *
114
+	 * @param string $tableName
115
+	 * @return string
116
+	 */
117
+	public function getBaseBeanClassName(string $tableName): string
118
+	{
119
+		return $this->baseBeanPrefix.self::toSingularCamelCase($tableName).$this->baseBeanSuffix;
120
+	}
121
+
122
+	/**
123
+	 * Returns the name of the DAO class from the table name (excluding the namespace).
124
+	 *
125
+	 * @param string $tableName
126
+	 * @return string
127
+	 */
128
+	public function getDaoClassName(string $tableName): string
129
+	{
130
+		return $this->daoPrefix.self::toSingularCamelCase($tableName).$this->daoSuffix;
131
+	}
132
+
133
+	/**
134
+	 * Returns the name of the base DAO class from the table name (excluding the namespace).
135
+	 *
136
+	 * @param string $tableName
137
+	 * @return string
138
+	 */
139
+	public function getBaseDaoClassName(string $tableName): string
140
+	{
141
+		return $this->baseDaoPrefix.self::toSingularCamelCase($tableName).$this->baseDaoSuffix;
142
+	}
143
+
144
+	/**
145
+	 * Tries to put string to the singular form (if it is plural) and camel case form.
146
+	 * We assume the table names are in english.
147
+	 *
148
+	 * @param $str string
149
+	 *
150
+	 * @return string
151
+	 */
152
+	private static function toSingularCamelCase(string $str): string
153
+	{
154
+		$tokens = preg_split("/[_ ]+/", $str);
155
+		$tokens = array_map([Inflector::class, 'singularize'], $tokens);
156
+
157
+		$str = '';
158
+		foreach ($tokens as $token) {
159
+			$str .= ucfirst(Inflector::singularize($token));
160
+		}
161
+
162
+		return $str;
163
+	}
164
+
165
+	/**
166
+	 * Returns the class name for the DAO factory.
167
+	 *
168
+	 * @return string
169
+	 */
170
+	public function getDaoFactoryClassName(): string
171
+	{
172
+		return 'DaoFactory';
173
+	}
174 174
 }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Commands/AlteredConfiguration.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -19,92 +19,92 @@
 block discarded – undo
19 19
  */
20 20
 class AlteredConfiguration implements ConfigurationInterface
21 21
 {
22
-    /**
23
-     * @var ConfigurationInterface
24
-     */
25
-    private $configuration;
26
-
27
-    /**
28
-     * @var LoggerInterface
29
-     */
30
-    private $logger;
31
-
32
-    public function __construct(ConfigurationInterface $configuration)
33
-    {
34
-        $this->configuration = $configuration;
35
-        $this->logger = $configuration->getLogger();
36
-    }
37
-
38
-
39
-    /**
40
-     * @return string
41
-     */
42
-    public function getBeanNamespace(): string
43
-    {
44
-        return $this->configuration->getBeanNamespace();
45
-    }
46
-
47
-    /**
48
-     * @return string
49
-     */
50
-    public function getDaoNamespace(): string
51
-    {
52
-        return $this->configuration->getDaoNamespace();
53
-    }
54
-
55
-    /**
56
-     * @return Connection
57
-     */
58
-    public function getConnection(): Connection
59
-    {
60
-        return $this->configuration->getConnection();
61
-    }
62
-
63
-    /**
64
-     * @return Cache
65
-     */
66
-    public function getCache(): Cache
67
-    {
68
-        return $this->configuration->getCache();
69
-    }
70
-
71
-    /**
72
-     * @return NamingStrategyInterface
73
-     */
74
-    public function getNamingStrategy(): NamingStrategyInterface
75
-    {
76
-        return $this->configuration->getNamingStrategy();
77
-    }
78
-
79
-    /**
80
-     * @return SchemaAnalyzer
81
-     */
82
-    public function getSchemaAnalyzer(): SchemaAnalyzer
83
-    {
84
-        return $this->configuration->getSchemaAnalyzer();
85
-    }
86
-
87
-    /**
88
-     * @return LoggerInterface
89
-     */
90
-    public function getLogger(): ?LoggerInterface
91
-    {
92
-        return $this->configuration->getLogger();
93
-    }
94
-
95
-    /**
96
-     * @return GeneratorListenerInterface
97
-     */
98
-    public function getGeneratorEventDispatcher(): GeneratorListenerInterface
99
-    {
100
-        return $this->configuration->getGeneratorEventDispatcher();
101
-    }
102
-
103
-    /**
104
-     * @param LoggerInterface $logger
105
-     */
106
-    public function setLogger(LoggerInterface $logger)
107
-    {
108
-        $this->logger = $logger;
109
-    }
22
+	/**
23
+	 * @var ConfigurationInterface
24
+	 */
25
+	private $configuration;
26
+
27
+	/**
28
+	 * @var LoggerInterface
29
+	 */
30
+	private $logger;
31
+
32
+	public function __construct(ConfigurationInterface $configuration)
33
+	{
34
+		$this->configuration = $configuration;
35
+		$this->logger = $configuration->getLogger();
36
+	}
37
+
38
+
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function getBeanNamespace(): string
43
+	{
44
+		return $this->configuration->getBeanNamespace();
45
+	}
46
+
47
+	/**
48
+	 * @return string
49
+	 */
50
+	public function getDaoNamespace(): string
51
+	{
52
+		return $this->configuration->getDaoNamespace();
53
+	}
54
+
55
+	/**
56
+	 * @return Connection
57
+	 */
58
+	public function getConnection(): Connection
59
+	{
60
+		return $this->configuration->getConnection();
61
+	}
62
+
63
+	/**
64
+	 * @return Cache
65
+	 */
66
+	public function getCache(): Cache
67
+	{
68
+		return $this->configuration->getCache();
69
+	}
70
+
71
+	/**
72
+	 * @return NamingStrategyInterface
73
+	 */
74
+	public function getNamingStrategy(): NamingStrategyInterface
75
+	{
76
+		return $this->configuration->getNamingStrategy();
77
+	}
78
+
79
+	/**
80
+	 * @return SchemaAnalyzer
81
+	 */
82
+	public function getSchemaAnalyzer(): SchemaAnalyzer
83
+	{
84
+		return $this->configuration->getSchemaAnalyzer();
85
+	}
86
+
87
+	/**
88
+	 * @return LoggerInterface
89
+	 */
90
+	public function getLogger(): ?LoggerInterface
91
+	{
92
+		return $this->configuration->getLogger();
93
+	}
94
+
95
+	/**
96
+	 * @return GeneratorListenerInterface
97
+	 */
98
+	public function getGeneratorEventDispatcher(): GeneratorListenerInterface
99
+	{
100
+		return $this->configuration->getGeneratorEventDispatcher();
101
+	}
102
+
103
+	/**
104
+	 * @param LoggerInterface $logger
105
+	 */
106
+	public function setLogger(LoggerInterface $logger)
107
+	{
108
+		$this->logger = $logger;
109
+	}
110 110
 }
111 111
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
     /**
88 88
      * @return LoggerInterface
89 89
      */
90
-    public function getLogger(): ?LoggerInterface
90
+    public function getLogger(): ? LoggerInterface
91 91
     {
92 92
         return $this->configuration->getLogger();
93 93
     }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Commands/GenerateCommand.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -13,48 +13,48 @@
 block discarded – undo
13 13
 class GenerateCommand extends Command
14 14
 {
15 15
 
16
-    /**
17
-     * @var TDBMService
18
-     */
19
-    private $configuration;
16
+	/**
17
+	 * @var TDBMService
18
+	 */
19
+	private $configuration;
20 20
 
21
-    public function __construct(ConfigurationInterface $configuration)
22
-    {
23
-        parent::__construct();
24
-        $this->configuration = $configuration;
25
-    }
21
+	public function __construct(ConfigurationInterface $configuration)
22
+	{
23
+		parent::__construct();
24
+		$this->configuration = $configuration;
25
+	}
26 26
 
27
-    protected function configure()
28
-    {
29
-        $this->setName('tdbm:generate')
30
-            ->setDescription('Generates DAOs and beans.')
31
-            ->setHelp('Use this command to generate or regenerate the DAOs and beans for your project.')
32
-        ;
33
-    }
27
+	protected function configure()
28
+	{
29
+		$this->setName('tdbm:generate')
30
+			->setDescription('Generates DAOs and beans.')
31
+			->setHelp('Use this command to generate or regenerate the DAOs and beans for your project.')
32
+		;
33
+	}
34 34
 
35
-    protected function execute(InputInterface $input, OutputInterface $output)
36
-    {
37
-        // TODO: externalize composer.json file for autoloading (no more parameters for generateAllDaosAndBeans)
35
+	protected function execute(InputInterface $input, OutputInterface $output)
36
+	{
37
+		// TODO: externalize composer.json file for autoloading (no more parameters for generateAllDaosAndBeans)
38 38
 
39
-        $alteredConf = new AlteredConfiguration($this->configuration);
39
+		$alteredConf = new AlteredConfiguration($this->configuration);
40 40
 
41 41
 
42
-        $loggers = [ new ConsoleLogger($output) ];
42
+		$loggers = [ new ConsoleLogger($output) ];
43 43
 
44
-        $logger = $alteredConf->getLogger();
45
-        if ($logger) {
46
-            $loggers[] = $logger;
47
-        }
44
+		$logger = $alteredConf->getLogger();
45
+		if ($logger) {
46
+			$loggers[] = $logger;
47
+		}
48 48
 
49
-        $multiLogger = new MultiLogger($loggers);
49
+		$multiLogger = new MultiLogger($loggers);
50 50
 
51
-        $alteredConf->setLogger($multiLogger);
51
+		$alteredConf->setLogger($multiLogger);
52 52
 
53
-        $multiLogger->notice('Starting regenerating DAOs and beans');
53
+		$multiLogger->notice('Starting regenerating DAOs and beans');
54 54
 
55
-        $tdbmService = new TDBMService($this->configuration);
56
-        $tdbmService->generateAllDaosAndBeans();
55
+		$tdbmService = new TDBMService($this->configuration);
56
+		$tdbmService->generateAllDaosAndBeans();
57 57
 
58
-        $multiLogger->notice('Finished regenerating DAOs and beans');
59
-    }
58
+		$multiLogger->notice('Finished regenerating DAOs and beans');
59
+	}
60 60
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
         $alteredConf = new AlteredConfiguration($this->configuration);
40 40
 
41 41
 
42
-        $loggers = [ new ConsoleLogger($output) ];
42
+        $loggers = [new ConsoleLogger($output)];
43 43
 
44 44
         $logger = $alteredConf->getLogger();
45 45
         if ($logger) {
Please login to merge, or discard this patch.