Passed
Push — master ( 1227c2...8eadee )
by Ako
02:15
created
src/drivers/BaseDriver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 		 *
11 11
 		 * @return mixed
12 12
 		 */
13
-		function shorten (string $url) :string;
13
+		function shorten(string $url) :string;
14 14
 		
15 15
 		/**
16 16
 		 * @param string $url
17 17
 		 *
18 18
 		 * @return mixed
19 19
 		 */
20
-		function expand (string $url) :string;
20
+		function expand(string $url) :string;
21 21
 	}
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/ShorturlServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function register()
15 15
     {
16
-        $this->app->singleton('shorturl', function ($app) {
16
+        $this->app->singleton('shorturl', function($app) {
17 17
             return resolve("Ako\Shorturl\Shorturl");
18 18
         });
19 19
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
     public function boot()
24 24
     {
25 25
         $this->publishes([
26
-            __DIR__.'/../config/shorturl.php' => config_path('shorturl.php')
26
+            __DIR__ . '/../config/shorturl.php' => config_path('shorturl.php')
27 27
         ]);
28 28
 
29
-        $this->loadMigrationsFrom(__DIR__.'/../migrations');
29
+        $this->loadMigrationsFrom(__DIR__ . '/../migrations');
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
migrations/2019_01_02_192950_create_links_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     public function up()
13 13
     {
14 14
         $local_conf = config('shorturl.drivers.local');
15
-        Schema::create($local_conf['table_name'], function (Blueprint $table) use ($local_conf) {
15
+        Schema::create($local_conf['table_name'], function(Blueprint $table) use ($local_conf) {
16 16
             $table->charset = $local_conf['charset'] ?? "utf8";
17 17
             $table->collation = $local_conf['collation'] ?? "utf8_bin";
18 18
             $table->increments('id');
Please login to merge, or discard this patch.
src/drivers/LocalDriver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
 		protected  $props = [];
10 10
 		protected $config, $main_str, $head, $tail, $base_url, $path;
11 11
 		
12
-		public function __construct ()
12
+		public function __construct()
13 13
 		{
14 14
 			$this->config = config('shorturl.drivers.local');
15 15
 			$this->main_str = $this->config['str_shuffled'];
16 16
 			$this->head = $this->main_str[0];
17 17
 			$this->tail = $this->main_str[strlen($this->main_str) - 1];
18
-            $this->checkCaseSensitive ();
18
+            $this->checkCaseSensitive();
19 19
 		}
20 20
 
21 21
         /**
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
          *
24 24
          * @return string
25 25
          */
26
-		public function  expand (string $url) :string
26
+		public function  expand(string $url) :string
27 27
 		{
28 28
 		    $this->parseUrl($url);
29 29
 		    $link = Link::where("short_path", $this->path)->first();
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
          * @return string
41 41
          * @throws \Exception
42 42
          */
43
-		public function shorten (string $url) :string
43
+		public function shorten(string $url) :string
44 44
 		{
45
-            $this->parseUrl ($url);
45
+            $this->parseUrl($url);
46 46
 
47 47
             // Check if given url has been shorten previously
48 48
             $duplicate = Link::where(['long_path' => $this->path])->first();
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
          *
74 74
          * @return string
75 75
          */
76
-        private function getFirstUrl () : string
76
+        private function getFirstUrl() : string
77 77
         {
78 78
             $min_length = $this->config['min_length'];
79 79
             $short_path = "";
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
          * @param string $current_perm
90 90
          * @return string
91 91
          */
92
-        private function findNextPerm (string $current_perm) :string
92
+        private function findNextPerm(string $current_perm) :string
93 93
 		{
94 94
 			if (!strlen($current_perm))
95 95
 			    return $this->head;
96 96
 
97 97
 			$arr = array_reverse(str_split($current_perm));
98
-			foreach($arr as $key => $current_char) {
98
+			foreach ($arr as $key => $current_char) {
99 99
 				if ($current_char == $this->tail) {
100 100
 					$current_perm = Str::replaceLast($current_char, "", $current_perm);
101 101
 					return $this->findNextPerm($current_perm) . $this->head;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 		 *
111 111
 		 * @return LocalDriver
112 112
 		 */
113
-		public function withProperties (array $props = []) :LocalDriver
113
+		public function withProperties(array $props = []) :LocalDriver
114 114
 		{
115 115
 			$this->props = array_merge($this->props, $props);
116 116
 			return $this;
117 117
 		}
118 118
 
119
-        private function parseUrl (string $url)
119
+        private function parseUrl(string $url)
120 120
         {
121 121
             $parse = parse_url($url);
122 122
             $path = "";
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $this->path = $path;
132 132
         }
133 133
 
134
-        private function checkCaseSensitive ()
134
+        private function checkCaseSensitive()
135 135
         {
136 136
             if ((!$this->config['case_sensitive'] ?? null)) {
137 137
                 // Remove upper cases from main string
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         /**
143 143
          * @return string
144 144
          */
145
-        private function getNextShortpath () : string
145
+        private function getNextShortpath() : string
146 146
         {
147 147
             $tbl = (new Link)->getTable();
148 148
             // Get latest short_path(s)
Please login to merge, or discard this patch.
src/Shorturl.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		protected $driver;
11 11
 		private $driver_instance;
12 12
 
13
-		public function __construct (DriverFactory $factory)
13
+		public function __construct(DriverFactory $factory)
14 14
 		{
15 15
 			$this->factory = $factory;
16 16
 		}
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		 *
21 21
 		 * @return Shorturl
22 22
 		 */
23
-		public function onDriver (string $driver)
23
+		public function onDriver(string $driver)
24 24
 		{
25 25
 			$this->driver = $driver;
26 26
 			$this->setDriverInstance();
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		/**
31 31
 		 * @return void
32 32
 		 */
33
-		private function setDriverInstance ()
33
+		private function setDriverInstance()
34 34
 		{
35 35
 			$this->driver_instance = $this->factory->make($this->getDriver());
36 36
 		}
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 		 *
42 42
 		 * @return string
43 43
 		 */
44
-		public function getDriver (): string
44
+		public function getDriver(): string
45 45
 		{
46 46
 			return $this->driver ?: config("shorturl.drivers.default");
47 47
 		}
48 48
 		
49
-		public function __call ($method, $args)
49
+		public function __call($method, $args)
50 50
 		{
51
-			return call_user_func_array(array ($this->getDriverInstance(), $method), $args);
51
+			return call_user_func_array(array($this->getDriverInstance(), $method), $args);
52 52
 		}
53 53
 		
54
-		private function getDriverInstance ()
54
+		private function getDriverInstance()
55 55
 		{
56 56
 			if (!$this->driver_instance)
57 57
 				$this->setDriverInstance();
Please login to merge, or discard this patch.
src/DriverFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 		 *
11 11
 		 * @return LocalDriver
12 12
 		 */
13
-		public function make (string $driver)
13
+		public function make(string $driver)
14 14
 		{
15 15
 			switch ($driver) {
16 16
 				case "local":
Please login to merge, or discard this patch.