Bläddra i källkod

refractor

develop
Robin Thoni 8 år sedan
förälder
incheckning
36b0e7e892

+ 6
- 3
src/Utils/Business/LuBusiness.php Visa fil

@@ -56,7 +56,8 @@ abstract class LuBusiness {
56 56
     }
57 57
 
58 58
     /**
59
-     * @param string
59
+     * @param string $reason
60
+     * @throws LuBusinessException
60 61
      */
61 62
     public static function unauthorized($reason = 'Unauthorized')
62 63
     {
@@ -64,7 +65,8 @@ abstract class LuBusiness {
64 65
     }
65 66
 
66 67
     /**
67
-     * @param string
68
+     * @param string $reason
69
+     * @throws LuBusinessException
68 70
      */
69 71
     public static function notFound($reason = 'Resource not found')
70 72
     {
@@ -72,7 +74,8 @@ abstract class LuBusiness {
72 74
     }
73 75
 
74 76
     /**
75
-     * @param string
77
+     * @param string $reason
78
+     * @throws LuBusinessException
76 79
      */
77 80
     public static function badInput($reason = 'Invalid user input')
78 81
     {

src/Utils/Business/LuDocParser.php → src/Utils/Business/LuMethodDocParser.php Visa fil

@@ -11,7 +11,7 @@ namespace Luticate\Utils\Business;
11 11
 use Luticate\Utils\Dbo\LuParameterConstraintDbo;
12 12
 use Luticate\Utils\Dbo\LuParameterDbo;
13 13
 
14
-class LuDocParser
14
+class LuMethodDocParser
15 15
 {
16 16
     /**
17 17
      * @var string

+ 3
- 3
src/Utils/Controller/LuRoute.php Visa fil

@@ -4,7 +4,7 @@ namespace Luticate\Utils\Controller;
4 4
 
5 5
 use FastRoute\Dispatcher;
6 6
 use Luticate\Utils\Business\LuBusinessException;
7
-use Luticate\Utils\Business\LuDocParser;
7
+use Luticate\Utils\Business\LuMethodDocParser;
8 8
 use Luticate\Utils\Dbo\LuDboConstraintException;
9 9
 use Luticate\Utils\Dbo\LuDboDeserializeException;
10 10
 use FastRoute\DataGenerator\GroupCountBased as DataGeneratorGroupCountBased;
@@ -12,7 +12,7 @@ use FastRoute\Dispatcher\GroupCountBased as DispatcherGroupCountBased;
12 12
 use FastRoute\RouteCollector;
13 13
 use FastRoute\RouteParser\Std;
14 14
 use Luticate\Utils\Dbo\LuRouteDbo;
15
-use Luticate\Utils\LuAbstractMiddleware;
15
+use Luticate\Utils\Middleware\LuAbstractMiddleware;
16 16
 
17 17
 class LuRoute {
18 18
 
@@ -81,7 +81,7 @@ class LuRoute {
81 81
 
82 82
         $reflect = new \ReflectionMethod($route->getControllerClass(), $route->getControllerMethod());
83 83
         $params = $reflect->getParameters();
84
-        $doc = new LuDocParser($reflect->getDocComment());
84
+        $doc = new LuMethodDocParser($reflect->getDocComment());
85 85
         $doc->parse();
86 86
 
87 87
         $args = array();

+ 0
- 1
src/Utils/Controller/LuticateApplication.php Visa fil

@@ -10,7 +10,6 @@ namespace Luticate\Utils\Controller;
10 10
 
11 11
 use Luticate\Utils\Business\LuBusinessException;
12 12
 use Luticate\Utils\Business\LuLog;
13
-use Luticate\Utils\Dbo\LuDbo;
14 13
 use Luticate\Utils\Dbo\LuRequestDbo;
15 14
 use Ratchet\ConnectionInterface;
16 15
 use Ratchet\MessageComponentInterface;

+ 5
- 3
src/Utils/DataAccess/LuDataAccess.php Visa fil

@@ -3,6 +3,8 @@
3 3
 namespace Luticate\Utils;
4 4
 
5 5
 use DB;
6
+use Luticate\Utils\Dbo\LuDbo;
7
+use Luticate\Utils\Dbo\LuMultipleDbo;
6 8
 
7 9
 abstract class LuDataAccess {
8 10
 
@@ -66,7 +68,7 @@ abstract class LuDataAccess {
66 68
      */
67 69
     public static function addId($data)
68 70
     {
69
-        $data = static::getModel()->fromDBO($data);
71
+        $data = static::getModel()->fromDbo($data);
70 72
         unset($data->id);
71 73
         $data->save();
72 74
         return $data->id;
@@ -77,7 +79,7 @@ abstract class LuDataAccess {
77 79
      */
78 80
     public static function add($data)
79 81
     {
80
-        $data = static::getModel()->fromDBO($data);
82
+        $data = static::getModel()->fromDbo($data);
81 83
         $data->save();
82 84
     }
83 85
 
@@ -88,7 +90,7 @@ abstract class LuDataAccess {
88 90
      */
89 91
     public static function editById($id, $data)
90 92
     {
91
-        return static::getModel()->fromDBO($data, self::_getModelById($id))->save();
93
+        return static::getModel()->fromDbo($data, self::_getModelById($id))->save();
92 94
     }
93 95
 
94 96
     /**

+ 1
- 0
src/Utils/DataAccess/LuModel.php Visa fil

@@ -4,6 +4,7 @@ namespace Luticate\Utils;
4 4
 
5 5
 use Illuminate\Database\Eloquent\Collection;
6 6
 use Illuminate\Database\Eloquent\Model;
7
+use Luticate\Utils\Dbo\LuDbo;
7 8
 
8 9
 /**
9 10
  * LuModel

+ 2
- 0
src/Utils/DataAccess/LuRequest.php Visa fil

@@ -12,6 +12,8 @@ namespace Luticate\Utils;
12 12
 use GuzzleHttp\Client;
13 13
 use GuzzleHttp\Exception\ClientException;
14 14
 use GuzzleHttp\Exception\RequestException;
15
+use Luticate\Utils\Business\LuLog;
16
+use Luticate\Utils\Dbo\LuRequestDbo;
15 17
 
16 18
 class LuRequest
17 19
 {

+ 28
- 0
src/Utils/Dbo/LuMiddlewareDbo.php Visa fil

@@ -0,0 +1,28 @@
1
+<?php
2
+/**
3
+ * Created by PhpStorm.
4
+ * User: robin
5
+ * Date: 6/5/16
6
+ * Time: 6:24 PM
7
+ */
8
+
9
+namespace Luticate\Utils\Dbo;
10
+
11
+
12
+class LuMiddlewareDbo extends LuDbo
13
+{
14
+    function jsonSerialize()
15
+    {
16
+        // TODO: Implement jsonSerialize() method.
17
+    }
18
+
19
+    /**
20
+     * @var $_name string
21
+     */
22
+    private $_middleware;
23
+
24
+    /**
25
+     * @var $_parameters mixed[]
26
+     */
27
+    private $_parameters;
28
+}

tests/LuDocParserTest.php → tests/LuMethodDocParserTest.php Visa fil

@@ -1,5 +1,5 @@
1 1
 <?php
2
-use Luticate\Utils\Business\LuDocParser;
2
+use Luticate\Utils\Business\LuMethodDocParser;
3 3
 
4 4
 /**
5 5
  * Created by PhpStorm.
@@ -11,7 +11,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
11 11
 {
12 12
     public function testSimpleSummary()
13 13
     {
14
-        $doc = new LuDocParser("/**
14
+        $doc = new LuMethodDocParser("/**
15 15
      * Get all data
16 16
      */");
17 17
         $doc->parse();
@@ -20,7 +20,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
20 20
     
21 21
     public function testSimpleSummaryMultiLine()
22 22
     {
23
-        $doc = new LuDocParser("/**
23
+        $doc = new LuMethodDocParser("/**
24 24
      * Get all data
25 25
      * Using the database
26 26
      */");
@@ -30,7 +30,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
30 30
 
31 31
     public function testSimpleParam()
32 32
     {
33
-        $doc = new LuDocParser('/**
33
+        $doc = new LuMethodDocParser('/**
34 34
      * Get all data
35 35
      * @param $myvar MyType some doc
36 36
      * @param MyType $myvar2 some other doc
@@ -55,7 +55,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
55 55
 
56 56
     public function testSimpleParamMultiLine()
57 57
     {
58
-        $doc = new LuDocParser('/**
58
+        $doc = new LuMethodDocParser('/**
59 59
      * Get all data
60 60
      * @param $myvar MyType some doc
61 61
      * @param MyType $myvar2 some other doc
@@ -81,7 +81,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
81 81
 
82 82
     public function testAll()
83 83
     {
84
-        $doc = new LuDocParser('/**
84
+        $doc = new LuMethodDocParser('/**
85 85
      * Get all data
86 86
      * On another line
87 87
      * @param $myvar MyType some doc

Laddar…
Avbryt
Spara