Commit 7a4c1cd3 by Paul Klimov

Trait "ClientTrait" converted into "BaseClient" class.

parent 8abd201b
......@@ -8,11 +8,12 @@
namespace yii\authclient;
use Yii;
use yii\base\Component;
use yii\base\NotSupportedException;
use yii\helpers\StringHelper;
/**
* ProviderTrait can be used to satisfy [[ClientInterface]] interface.
* BaseClient is a base Auth Client class.
*
* @see ClientInterface
*
......@@ -27,7 +28,7 @@ use yii\helpers\StringHelper;
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
trait ClientTrait
abstract class BaseClient extends Component implements ClientInterface
{
/**
* @var string auth service id.
......
......@@ -7,7 +7,6 @@
namespace yii\authclient;
use yii\base\Component;
use yii\base\Exception;
use yii\base\InvalidParamException;
use Yii;
......@@ -21,10 +20,8 @@ use yii\helpers\Json;
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
abstract class BaseOAuth extends Component implements ClientInterface
abstract class BaseOAuth extends BaseClient implements ClientInterface
{
use ClientTrait;
const CONTENT_TYPE_JSON = 'json'; // JSON format
const CONTENT_TYPE_URLENCODED = 'urlencoded'; // urlencoded query string, like name1=value1&name2=value2
const CONTENT_TYPE_XML = 'xml'; // XML format
......
......@@ -7,7 +7,6 @@
namespace yii\authclient;
use yii\base\Component;
use yii\base\Exception;
use yii\base\NotSupportedException;
......@@ -25,10 +24,8 @@ use yii\base\NotSupportedException;
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
class OpenId extends Component implements ClientInterface
class OpenId extends BaseClient implements ClientInterface
{
use ClientTrait;
/**
* @var array list of attributes, which should be requested from server.
*/
......
......@@ -2,11 +2,9 @@
namespace yiiunit\extensions\authclient;
use yii\authclient\ClientInterface;
use yii\authclient\ClientTrait;
use yii\base\Object;
use yii\authclient\BaseClient;
class ClientTraitTest extends TestCase
class BaseClientTest extends TestCase
{
public function testSetGet()
{
......@@ -79,7 +77,6 @@ class ClientTraitTest extends TestCase
}
}
class Client extends Object implements ClientInterface
class Client extends BaseClient
{
use ClientTrait;
}
\ No newline at end of file
......@@ -3,9 +3,7 @@
namespace yiiunit\extensions\authclient;
use yii\authclient\Collection;
use yii\authclient\ClientInterface;
use yii\authclient\ClientTrait;
use yii\base\Object;
use yii\authclient\BaseClient;
use yiiunit\extensions\authclient\TestCase;
class CollectionTest extends TestCase
......@@ -82,9 +80,6 @@ class CollectionTest extends TestCase
}
}
class TestClient extends Object implements ClientInterface
class TestClient extends BaseClient
{
use ClientTrait;
public function authenticate() {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment