Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit 59443cd

Browse files
Comment and LICENCE attachment
1 parent 539f115 commit 59443cd

14 files changed

+193
-28
lines changed

src/LinkShrink/Exception/EmptyResponse.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class EmptyResponse extends \RuntimeException implements Exception

src/LinkShrink/Exception/Exception.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
interface Exception

src/LinkShrink/Exception/InvalidArgument.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class InvalidArgument extends \RuntimeException implements Exception

src/LinkShrink/Exception/InvalidCredentials.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class InvalidCredentials extends \RuntimeException implements Exception

src/LinkShrink/Exception/MethodNotImplemented.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class MethodNotImplemented extends \RuntimeException implements Exception

src/LinkShrink/Exception/ProviderNotRegistered.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class ProviderNotRegistered extends \RuntimeException implements Exception

src/LinkShrink/Exception/QuotaExceeded.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class QuotaExceeded extends \RuntimeException implements Exception

src/LinkShrink/Exception/UnknownError.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Exception;
415

516
class UnknownError extends \RuntimeException implements Exception

src/LinkShrink/LinkShrink.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink;
415

516
use LinkShrink\Exception\ProviderNotRegistered;
@@ -13,7 +24,7 @@ class LinkShrink
1324
protected $provider;
1425

1526
/**
16-
* @var array[Provider]
27+
* @var array [Provider]
1728
*/
1829
protected $providers;
1930

src/LinkShrink/Provider/AbstractProvider.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Provider;
415

516
use Ivory\HttpAdapter\HttpAdapterInterface;

src/LinkShrink/Provider/Bitly.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Provider;
415

516
use Ivory\HttpAdapter\HttpAdapterInterface;

src/LinkShrink/Provider/GenericResolver.php

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Provider;
415

516
use Ivory\HttpAdapter\HttpAdapterException;
@@ -16,7 +27,7 @@ public function getName()
1627
}
1728

1829
/**
19-
* @param string$url
30+
* @param string $url
2031
*
2132
* @return void
2233
* @throws MethodNotImplemented
@@ -27,9 +38,7 @@ public function getShortenedUrl($url)
2738
}
2839

2940
/**
30-
* @param string $url
31-
*
32-
* @return string
41+
* @inheritdoc
3342
*/
3443
public function getExpandedUrl($url)
3544
{

src/LinkShrink/Provider/Google.php

+34-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Provider;
415

516
use Ivory\HttpAdapter\HttpAdapterInterface;
@@ -38,15 +49,16 @@ public function __construct(HttpAdapterInterface $adapter, $apiKey = null)
3849
$this->apiKey = $apiKey;
3950
}
4051

52+
/**
53+
* @inheritdoc
54+
*/
4155
public function getName()
4256
{
4357
return 'google';
4458
}
4559

4660
/**
47-
* @param $url
48-
*
49-
* @return mixed
61+
* @inheritdoc
5062
*/
5163
public function getShortenedUrl($url)
5264
{
@@ -57,9 +69,7 @@ public function getShortenedUrl($url)
5769
}
5870

5971
/**
60-
* @param $url
61-
*
62-
* @return mixed
72+
* @inheritdoc
6373
*/
6474
public function getExpandedUrl($url)
6575
{
@@ -68,6 +78,9 @@ public function getExpandedUrl($url)
6878
return $this->executeExpandUrlQuery($apiUrl);
6979
}
7080

81+
/**
82+
* @return string
83+
*/
7184
protected function buildShortenUrl()
7285
{
7386
$url = static::SHORTEN_ENDPOINT_URL;
@@ -79,7 +92,7 @@ protected function buildShortenUrl()
7992
}
8093

8194
/**
82-
* @param $url
95+
* @param string $url
8396
*
8497
* @return string
8598
*/
@@ -92,7 +105,13 @@ protected function buildShortenUrlParameters($url)
92105
return json_encode($parameters);
93106
}
94107

95-
protected function executeShortenUrlQuery($query, $parameters)
108+
/**
109+
* @param string $query
110+
* @param array|string $parameters
111+
*
112+
* @return string
113+
*/
114+
protected function executeShortenUrlQuery($query, $parameters = array())
96115
{
97116
$content = (string) $this->getAdapter()->post($query, array('Content-Type: application/json'),
98117
$parameters)->getBody();
@@ -113,7 +132,7 @@ protected function executeShortenUrlQuery($query, $parameters)
113132
}
114133

115134
/**
116-
* @param $url
135+
* @param string$url
117136
*
118137
* @return string
119138
*/
@@ -129,6 +148,11 @@ protected function buildExpandedUrl($url)
129148
return static::EXPAND_ENDPOINT_URL . '?' . http_build_query($parameters);
130149
}
131150

151+
/**
152+
* @param string $query
153+
*
154+
* @return string
155+
*/
132156
protected function executeExpandUrlQuery($query)
133157
{
134158
$content = (string) $this->getAdapter()->get($query)->getBody();

src/LinkShrink/Provider/Provider.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
2-
2+
/**
3+
* Link Shrink
4+
*
5+
* Licensed under The MIT License
6+
* For full copyright and license information, please see the LICENSE file
7+
* Redistributions of files must retain the above copyright notice.
8+
*
9+
* @author Matthew Nessworthy <[email protected]>
10+
* @copyright Copyright (c) Matthew Nessworthy
11+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
12+
* @link https://github.com/devmatt/link-shrink
13+
*/
314
namespace LinkShrink\Provider;
415

516
interface Provider

0 commit comments

Comments
 (0)