Completed
Push — master ( 6ecc9a...44f20a )
by Andrzej
03:44
created
src/DB/DoctrineBootstrap.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 	
79 79
 	/**
80 80
 	 *
81
-	 * @return entityManager EntityManager
81
+	 * @return EntityManager EntityManager
82 82
 	 */
83 83
 	private static function _getInstance() {
84 84
 		$isDevMode = true;
Please login to merge, or discard this patch.
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -44,76 +44,76 @@
 block discarded – undo
44 44
  */
45 45
 class DoctrineBootstrap {
46 46
 	
47
-	/**
48
-	 * entity manager
49
-	 *
50
-	 * @var _entityManager EnitytManager
51
-	 */
52
-	private static $_entityManager;
47
+    /**
48
+     * entity manager
49
+     *
50
+     * @var _entityManager EnitytManager
51
+     */
52
+    private static $_entityManager;
53 53
 	
54
-	/**
55
-	 * loading envs
56
-	 */
57
-	private static function _loadEnv() {
58
-		if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") {
59
-			return;
60
-		}
61
-		if (defined ( 'ABSPATH' )) {
62
-			\Dotenv::load ( ABSPATH );
63
-		} else {
64
-			\Dotenv::load ( getenv ( 'HOME' ) );
65
-		}
66
-	}
67
-	private static function getPaths() {
68
-		if (file_exists ( getcwd () . "/src/Entities" )) {
69
-			return array (
70
-					getcwd () . "/src/Entities" 
71
-			);
72
-		} else {
73
-			return array (
74
-					getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" 
75
-			);
76
-		}
77
-	}
54
+    /**
55
+     * loading envs
56
+     */
57
+    private static function _loadEnv() {
58
+        if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") {
59
+            return;
60
+        }
61
+        if (defined ( 'ABSPATH' )) {
62
+            \Dotenv::load ( ABSPATH );
63
+        } else {
64
+            \Dotenv::load ( getenv ( 'HOME' ) );
65
+        }
66
+    }
67
+    private static function getPaths() {
68
+        if (file_exists ( getcwd () . "/src/Entities" )) {
69
+            return array (
70
+                    getcwd () . "/src/Entities" 
71
+            );
72
+        } else {
73
+            return array (
74
+                    getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" 
75
+            );
76
+        }
77
+    }
78 78
 	
79
-	/**
80
-	 *
81
-	 * @return entityManager EntityManager
82
-	 */
83
-	private static function _getInstance() {
84
-		$isDevMode = true;
85
-		$config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode );
86
-		self::_loadEnv ();
87
-		$conn = array (
88
-				'dbname' => getenv ( 'DB_NAME' ),
89
-				'user' => getenv ( 'DB_USER' ),
90
-				'password' => getenv ( 'DB_PASSWORD' ),
91
-				'host' => getenv ( 'DB_HOST' ),
92
-				'driver' => 'pdo_mysql',
93
-				'charset' => 'utf8',
94
-				'driverOptions' => array (
95
-						1002 => 'SET NAMES utf8' 
96
-				),
97
-				'mapping_types' => 'enum:string' 
98
-		);
99
-		return EntityManager::create ( $conn, $config );
100
-	}
79
+    /**
80
+     *
81
+     * @return entityManager EntityManager
82
+     */
83
+    private static function _getInstance() {
84
+        $isDevMode = true;
85
+        $config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode );
86
+        self::_loadEnv ();
87
+        $conn = array (
88
+                'dbname' => getenv ( 'DB_NAME' ),
89
+                'user' => getenv ( 'DB_USER' ),
90
+                'password' => getenv ( 'DB_PASSWORD' ),
91
+                'host' => getenv ( 'DB_HOST' ),
92
+                'driver' => 'pdo_mysql',
93
+                'charset' => 'utf8',
94
+                'driverOptions' => array (
95
+                        1002 => 'SET NAMES utf8' 
96
+                ),
97
+                'mapping_types' => 'enum:string' 
98
+        );
99
+        return EntityManager::create ( $conn, $config );
100
+    }
101 101
 	
102
-	/**
103
-	 * returns enitytManager
104
-	 *
105
-	 * @return EntityManager
106
-	 */
107
-	public static function getEntityManager() {
108
-		if (self::$_entityManager == null) {
109
-			self::$_entityManager = self::_getInstance ();
110
-		}
111
-		return self::$_entityManager;
112
-	}
113
-	public static function getCli() {
114
-		$em = DoctrineBootstrap::getEntityManager ();
115
-		$em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' );
116
-		return ConsoleRunner::createHelperSet ( $em );
117
-	}
102
+    /**
103
+     * returns enitytManager
104
+     *
105
+     * @return EntityManager
106
+     */
107
+    public static function getEntityManager() {
108
+        if (self::$_entityManager == null) {
109
+            self::$_entityManager = self::_getInstance ();
110
+        }
111
+        return self::$_entityManager;
112
+    }
113
+    public static function getCli() {
114
+        $em = DoctrineBootstrap::getEntityManager ();
115
+        $em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' );
116
+        return ConsoleRunner::createHelperSet ( $em );
117
+    }
118 118
 }
119 119
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
 	 * loading envs
56 56
 	 */
57 57
 	private static function _loadEnv() {
58
-		if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") {
58
+		if (getenv('DB_NAME') != null && getenv('DB_NAME') != "") {
59 59
 			return;
60 60
 		}
61
-		if (defined ( 'ABSPATH' )) {
62
-			\Dotenv::load ( ABSPATH );
61
+		if (defined('ABSPATH')) {
62
+			\Dotenv::load(ABSPATH);
63 63
 		} else {
64
-			\Dotenv::load ( getenv ( 'HOME' ) );
64
+			\Dotenv::load(getenv('HOME'));
65 65
 		}
66 66
 	}
67 67
 	private static function getPaths() {
68
-		if (file_exists ( getcwd () . "/src/Entities" )) {
69
-			return array (
70
-					getcwd () . "/src/Entities" 
68
+		if (file_exists(getcwd()."/src/Entities")) {
69
+			return array(
70
+					getcwd()."/src/Entities" 
71 71
 			);
72 72
 		} else {
73
-			return array (
74
-					getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" 
73
+			return array(
74
+					getcwd()."/vendor/amarcinkowski/hospitalplugin/src/Entities" 
75 75
 			);
76 76
 		}
77 77
 	}
@@ -82,21 +82,21 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	private static function _getInstance() {
84 84
 		$isDevMode = true;
85
-		$config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode );
86
-		self::_loadEnv ();
87
-		$conn = array (
88
-				'dbname' => getenv ( 'DB_NAME' ),
89
-				'user' => getenv ( 'DB_USER' ),
90
-				'password' => getenv ( 'DB_PASSWORD' ),
91
-				'host' => getenv ( 'DB_HOST' ),
85
+		$config = Setup::createAnnotationMetadataConfiguration(self::getPaths(), $isDevMode);
86
+		self::_loadEnv();
87
+		$conn = array(
88
+				'dbname' => getenv('DB_NAME'),
89
+				'user' => getenv('DB_USER'),
90
+				'password' => getenv('DB_PASSWORD'),
91
+				'host' => getenv('DB_HOST'),
92 92
 				'driver' => 'pdo_mysql',
93 93
 				'charset' => 'utf8',
94
-				'driverOptions' => array (
94
+				'driverOptions' => array(
95 95
 						1002 => 'SET NAMES utf8' 
96 96
 				),
97 97
 				'mapping_types' => 'enum:string' 
98 98
 		);
99
-		return EntityManager::create ( $conn, $config );
99
+		return EntityManager::create($conn, $config);
100 100
 	}
101 101
 	
102 102
 	/**
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public static function getEntityManager() {
108 108
 		if (self::$_entityManager == null) {
109
-			self::$_entityManager = self::_getInstance ();
109
+			self::$_entityManager = self::_getInstance();
110 110
 		}
111 111
 		return self::$_entityManager;
112 112
 	}
113 113
 	public static function getCli() {
114
-		$em = DoctrineBootstrap::getEntityManager ();
115
-		$em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' );
116
-		return ConsoleRunner::createHelperSet ( $em );
114
+		$em = DoctrineBootstrap::getEntityManager();
115
+		$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
116
+		return ConsoleRunner::createHelperSet($em);
117 117
 	}
118 118
 }
119 119
 
Please login to merge, or discard this patch.