Skip to content

Commit ea9f500

Browse files
author
bryanadamloh97
committed
Add facade for URLShortener and enabled static functions
1 parent efacb55 commit ea9f500

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/Facades/UrlShortener.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace CodeOfDigital\LaravelUrlShortener\Facades;
4+
5+
use GuzzleHttp\Promise\PromiseInterface;
6+
use Illuminate\Support\Facades\Facade;
7+
8+
/**
9+
* @method static string shorten($url, array $options = [])
10+
* @method static PromiseInterface shortenAsync($url, array $options = [])
11+
*
12+
* @see \CodeOfDigital\LaravelUrlShortener\UrlShortener
13+
*/
14+
class UrlShortener extends Facade
15+
{
16+
/**
17+
* Get the registered name of the component.
18+
*
19+
* @return string
20+
*
21+
* @throws \RuntimeException
22+
*/
23+
protected static function getFacadeAccessor()
24+
{
25+
return 'url.shortener';
26+
}
27+
}

src/UrlShortener.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66
use CodeOfDigital\LaravelUrlShortener\Drivers\BitLyDriverShortener;
77
use CodeOfDigital\LaravelUrlShortener\Drivers\TinyUrlDriverShortener;
88
use GuzzleHttp\ClientInterface;
9+
use GuzzleHttp\Promise\PromiseInterface;
910
use http\Exception\InvalidArgumentException;
1011
use Illuminate\Foundation\Application;
1112
use Illuminate\Support\Arr;
1213
use Illuminate\Support\Str;
1314

15+
/**
16+
* @method string shorten($url, array $options = [])
17+
* @method PromiseInterface shortenAsync($url, array $options = [])
18+
*/
1419
class UrlShortener implements UrlFactory
1520
{
1621
protected $app;

0 commit comments

Comments
 (0)