Browse Source

refractor

develop
Robin Thoni 8 years ago
parent
commit
36b0e7e892

+ 6
- 3
src/Utils/Business/LuBusiness.php View File

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

src/Utils/Business/LuDocParser.php → src/Utils/Business/LuMethodDocParser.php View File

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

+ 3
- 3
src/Utils/Controller/LuRoute.php View File

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

+ 0
- 1
src/Utils/Controller/LuticateApplication.php View File

10
 
10
 
11
 use Luticate\Utils\Business\LuBusinessException;
11
 use Luticate\Utils\Business\LuBusinessException;
12
 use Luticate\Utils\Business\LuLog;
12
 use Luticate\Utils\Business\LuLog;
13
-use Luticate\Utils\Dbo\LuDbo;
14
 use Luticate\Utils\Dbo\LuRequestDbo;
13
 use Luticate\Utils\Dbo\LuRequestDbo;
15
 use Ratchet\ConnectionInterface;
14
 use Ratchet\ConnectionInterface;
16
 use Ratchet\MessageComponentInterface;
15
 use Ratchet\MessageComponentInterface;

+ 5
- 3
src/Utils/DataAccess/LuDataAccess.php View File

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

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

+ 2
- 0
src/Utils/DataAccess/LuRequest.php View File

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

+ 28
- 0
src/Utils/Dbo/LuMiddlewareDbo.php View File

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 View File

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

Loading…
Cancel
Save