11<?php
2+
23/**
34 * Copyright © Magento, Inc. All rights reserved.
45 * See COPYING.txt for license details.
56 */
7+ declare (strict_types=1 );
8+
69namespace Magento \Framework \App ;
710
811use Magento \Framework \App \ResourceConnection \ConfigInterface as ResourceConfigInterface ;
1922 */
2023class ResourceConnection
2124{
22- const AUTO_UPDATE_ONCE = 0 ;
23-
24- const AUTO_UPDATE_NEVER = -1 ;
25-
26- const AUTO_UPDATE_ALWAYS = 1 ;
27-
28- const DEFAULT_CONNECTION = 'default ' ;
25+ public const AUTO_UPDATE_ONCE = 0 ;
26+ public const AUTO_UPDATE_NEVER = -1 ;
27+ public const AUTO_UPDATE_ALWAYS = 1 ;
28+ public const DEFAULT_CONNECTION = 'default ' ;
2929
3030 /**
3131 * Instances of actual connections.
@@ -94,8 +94,7 @@ public function __construct(
9494 public function getConnection ($ resourceName = self ::DEFAULT_CONNECTION )
9595 {
9696 $ connectionName = $ this ->config ->getConnectionName ($ resourceName );
97- $ connection = $ this ->getConnectionByName ($ connectionName );
98- return $ connection ;
97+ return $ this ->getConnectionByName ($ connectionName );
9998 }
10099
101100 /**
@@ -161,15 +160,15 @@ public function getConnectionByName($connectionName)
161160 */
162161 private function getProcessConnectionName ($ connectionName )
163162 {
164- return $ connectionName . '_process_ ' . getmypid ();
163+ return $ connectionName . '_process_ ' . getmypid ();
165164 }
166165
167166 /**
168167 * Get resource table name, validated by db adapter.
169168 *
170- * @param string|string[] $modelEntity
169+ * @param string|string[] $modelEntity
171170 * @param string $connectionName
172- * @return string
171+ * @return string
173172 * @api
174173 */
175174 public function getTableName ($ modelEntity , $ connectionName = self ::DEFAULT_CONNECTION )
@@ -213,9 +212,9 @@ public function getTablePlaceholder($tableName)
213212 /**
214213 * Build a trigger name.
215214 *
216- * @param string $tableName The table that is the subject of the trigger
217- * @param string $time Either "before" or "after"
218- * @param string $event The DB level event which activates the trigger, i.e. "update" or "insert"
215+ * @param string $tableName The table that is the subject of the trigger
216+ * @param string $time Either "before" or "after"
217+ * @param string $event The DB level event which activates the trigger, i.e. "update" or "insert"
219218 * @return string
220219 */
221220 public function getTriggerName ($ tableName , $ time , $ event )
@@ -276,9 +275,9 @@ public function getIdxName(
276275 /**
277276 * Retrieve 32bit UNIQUE HASH for a Table foreign key.
278277 *
279- * @param string $priTableName the target table name
278+ * @param string $priTableName the target table name
280279 * @param string $priColumnName the target table column name
281- * @param string $refTableName the reference table name
280+ * @param string $refTableName the reference table name
282281 * @param string $refColumnName the reference table column name
283282 * @return string
284283 */
@@ -304,10 +303,7 @@ public function getFkName($priTableName, $priColumnName, $refTableName, $refColu
304303 public function getSchemaName ($ resourceName )
305304 {
306305 return $ this ->deploymentConfig ->get (
307- ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS .
308- '/ ' .
309- $ resourceName .
310- '/dbname '
306+ ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/ ' . $ resourceName . '/dbname '
311307 );
312308 }
313309
@@ -322,8 +318,6 @@ public function getTablePrefix()
322318 return $ this ->tablePrefix ;
323319 }
324320
325- return (string ) $ this ->deploymentConfig ->get (
326- ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX
327- );
321+ return (string )$ this ->deploymentConfig ->get (ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX );
328322 }
329323}
0 commit comments