@@ -9,5 +9,8 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | interface TableNameResolverInterface |
| 11 | 11 | { |
| 12 | + /** |
|
| 13 | + * @return string |
|
| 14 | + */ |
|
| 12 | 15 | public function getTableName($instance); |
| 13 | 16 | } |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | |
| 9 | 9 | namespace ntentan\nibii; |
| 10 | 10 | |
| 11 | +use ntentan\config\Config; |
|
| 11 | 12 | use ntentan\nibii\interfaces\ClassResolverInterface; |
| 12 | 13 | use ntentan\nibii\interfaces\ModelJoinerInterface; |
| 13 | 14 | use ntentan\nibii\interfaces\TableNameResolverInterface; |
| 14 | -use ntentan\config\Config; |
|
| 15 | 15 | use ntentan\utils\Text; |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $arrayed = explode('\\', $className); |
| 33 | 33 | $class = array_pop($arrayed); |
| 34 | - if($arrayed[0] == '') { |
|
| 34 | + if ($arrayed[0] == '') { |
|
| 35 | 35 | array_shift($arrayed); |
| 36 | 36 | } |
| 37 | 37 | return ['class' => $class, 'namespace' => implode('\\', $arrayed)]; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $classA = $this->getClassFileDetails($classA); |
| 43 | 43 | $classB = $this->getClassFileDetails($classB); |
| 44 | - if($classA['namespace'] != $classB['namespace']) { |
|
| 44 | + if ($classA['namespace'] != $classB['namespace']) { |
|
| 45 | 45 | throw new NibiiException( |
| 46 | 46 | "Cannot automatically join two classes of different " |
| 47 | 47 | . "namespaces. Please provide a model joiner or " |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | $classes = [$classA['class'], $classB['class']]; |
| 52 | 52 | sort($classes); |
| 53 | - return "{$classA['namespace']}\\" . implode('', $classes); |
|
| 53 | + return "{$classA['namespace']}\\".implode('', $classes); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function getTableName($instance) |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | public static function getDriverAdapterClassName() |
| 64 | 64 | { |
| 65 | 65 | $driver = Config::get('ntentan:db.driver', false); |
| 66 | - if($driver) { |
|
| 67 | - return __NAMESPACE__ . '\adapters\\' . Text::ucamelize(Config::get('ntentan:db.driver')) . 'Adapter'; |
|
| 66 | + if ($driver) { |
|
| 67 | + return __NAMESPACE__.'\adapters\\'.Text::ucamelize(Config::get('ntentan:db.driver')).'Adapter'; |
|
| 68 | 68 | } |
| 69 | 69 | throw new NibiiException("Please specify a driver"); |
| 70 | 70 | } |