Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
603da3f6
Commit
603da3f6
authored
Sep 24, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #904 from yiisoft/interface-rename
Fixes #823: consistent interface naming
parents
e1061f19
e19d0dac
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
49 additions
and
49 deletions
+49
-49
User.php
apps/advanced/common/models/User.php
+3
-3
User.php
apps/basic/models/User.php
+1
-1
upgrade-from-v1.md
docs/guide/upgrade-from-v1.md
+3
-3
classes.php
framework/yii/classes.php
+4
-4
DataProvider.php
framework/yii/data/DataProvider.php
+2
-2
DataProviderInterface.php
framework/yii/data/DataProviderInterface.php
+2
-2
AssetConverter.php
framework/yii/web/AssetConverter.php
+1
-1
AssetConverterInterface.php
framework/yii/web/AssetConverterInterface.php
+2
-2
AssetManager.php
framework/yii/web/AssetManager.php
+4
-4
IdentityInterface.php
framework/yii/web/IdentityInterface.php
+4
-4
Response.php
framework/yii/web/Response.php
+2
-2
ResponseFormatterInterface.php
framework/yii/web/ResponseFormatterInterface.php
+2
-2
User.php
framework/yii/web/User.php
+15
-15
UserEvent.php
framework/yii/web/UserEvent.php
+1
-1
XmlResponseFormatter.php
framework/yii/web/XmlResponseFormatter.php
+1
-1
ListViewBase.php
framework/yii/widgets/ListViewBase.php
+1
-1
phpunit.xml.dist
phpunit.xml.dist
+1
-1
No files found.
apps/advanced/common/models/User.php
View file @
603da3f6
...
...
@@ -3,7 +3,7 @@ namespace common\models;
use
yii\db\ActiveRecord
;
use
yii\helpers\Security
;
use
yii\web\Identity
;
use
yii\web\Identity
Interface
;
/**
* Class User
...
...
@@ -20,7 +20,7 @@ use yii\web\Identity;
* @property integer $create_time
* @property integer $update_time
*/
class
User
extends
ActiveRecord
implements
Identity
class
User
extends
ActiveRecord
implements
Identity
Interface
{
/**
* @var string the raw password. Used to collect password input and isn't saved in database
...
...
@@ -49,7 +49,7 @@ class User extends ActiveRecord implements Identity
* Finds an identity by the given ID.
*
* @param string|integer $id the ID to be looked for
* @return Identity|null the identity object that matches the given ID.
* @return Identity
Interface
|null the identity object that matches the given ID.
*/
public
static
function
findIdentity
(
$id
)
{
...
...
apps/basic/models/User.php
View file @
603da3f6
...
...
@@ -2,7 +2,7 @@
namespace
app\models
;
class
User
extends
\yii\base\Object
implements
\yii\web\Identity
class
User
extends
\yii\base\Object
implements
\yii\web\Identity
Interface
{
public
$id
;
public
$username
;
...
...
docs/guide/upgrade-from-v1.md
View file @
603da3f6
...
...
@@ -450,11 +450,11 @@ This feature is especially useful if you are developing an application that supp
different DBMS.
User and Identity
-----------------
User and Identity
Interface
-----------------
---------
The
`CWebUser`
class in 1.1 is now replaced by
`\yii\Web\User`
, and there is no more
`CUserIdentity`
class. Instead, you should implement the
`Identity
`
interface
which
`CUserIdentity`
class. Instead, you should implement the
`Identity
Interface`
which
is much more straightforward to implement. The bootstrap application provides such an example.
...
...
framework/yii/classes.php
View file @
603da3f6
...
...
@@ -86,7 +86,7 @@ return array(
'yii\data\ActiveDataProvider'
=>
YII_PATH
.
'/data/ActiveDataProvider.php'
,
'yii\data\ArrayDataProvider'
=>
YII_PATH
.
'/data/ArrayDataProvider.php'
,
'yii\data\DataProvider'
=>
YII_PATH
.
'/data/DataProvider.php'
,
'yii\data\
IDataProvider'
=>
YII_PATH
.
'/data/IDataProvider
.php'
,
'yii\data\
DataProviderInterface'
=>
YII_PATH
.
'/data/DataProviderInterface
.php'
,
'yii\data\Pagination'
=>
YII_PATH
.
'/data/Pagination.php'
,
'yii\data\Sort'
=>
YII_PATH
.
'/data/Sort.php'
,
'yii\db\ActiveQuery'
=>
YII_PATH
.
'/db/ActiveQuery.php'
,
...
...
@@ -204,15 +204,15 @@ return array(
'yii\web\HeaderCollection'
=>
YII_PATH
.
'/web/HeaderCollection.php'
,
'yii\web\HttpCache'
=>
YII_PATH
.
'/web/HttpCache.php'
,
'yii\web\HttpException'
=>
YII_PATH
.
'/web/HttpException.php'
,
'yii\web\
IAssetConverter'
=>
YII_PATH
.
'/web/IAssetConverter
.php'
,
'yii\web\Identity
'
=>
YII_PATH
.
'/web/Identity
.php'
,
'yii\web\
AssetConverterInterface'
=>
YII_PATH
.
'/web/AssetConverterInterface
.php'
,
'yii\web\Identity
Interface'
=>
YII_PATH
.
'/web/IdentityInterface
.php'
,
'yii\web\JqueryAsset'
=>
YII_PATH
.
'/web/JqueryAsset.php'
,
'yii\web\JsExpression'
=>
YII_PATH
.
'/web/JsExpression.php'
,
'yii\web\PageCache'
=>
YII_PATH
.
'/web/PageCache.php'
,
'yii\web\Request'
=>
YII_PATH
.
'/web/Request.php'
,
'yii\web\Response'
=>
YII_PATH
.
'/web/Response.php'
,
'yii\web\ResponseEvent'
=>
YII_PATH
.
'/web/ResponseEvent.php'
,
'yii\web\ResponseFormatter
'
=>
YII_PATH
.
'/web/ResponseFormatter
.php'
,
'yii\web\ResponseFormatter
Interface'
=>
YII_PATH
.
'/web/ResponseFormatterInterface
.php'
,
'yii\web\Session'
=>
YII_PATH
.
'/web/Session.php'
,
'yii\web\SessionIterator'
=>
YII_PATH
.
'/web/SessionIterator.php'
,
'yii\web\UploadedFile'
=>
YII_PATH
.
'/web/UploadedFile.php'
,
...
...
framework/yii/data/DataProvider.php
View file @
603da3f6
...
...
@@ -14,7 +14,7 @@ use yii\base\InvalidParamException;
/**
* DataProvider is the base class of data provider classes.
*
* It implements the [[getPagination()]] and [[getSort()]] methods as specified by the [[
IDataProvider]] interface
.
* It implements the [[getPagination()]] and [[getSort()]] methods as specified by the [[
DataProviderInterface]]
.
*
* @property integer $count The number of data models in the current page. This property is read-only.
* @property Pagination|boolean $pagination The pagination object. If this is false, it means the pagination
...
...
@@ -26,7 +26,7 @@ use yii\base\InvalidParamException;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
abstract
class
DataProvider
extends
Component
implements
IDataProvider
abstract
class
DataProvider
extends
Component
implements
DataProviderInterface
{
/**
* @var string an ID that uniquely identifies the data provider among all data providers.
...
...
framework/yii/data/
IDataProvider
.php
→
framework/yii/data/
DataProviderInterface
.php
View file @
603da3f6
...
...
@@ -8,7 +8,7 @@
namespace
yii\data
;
/**
*
IDataProvider
is the interface that must be implemented by data provider classes.
*
DataProviderInterface
is the interface that must be implemented by data provider classes.
*
* Data providers are components that sort and paginate data, and provide them to widgets
* such as [[GridView]], [[ListView]].
...
...
@@ -16,7 +16,7 @@ namespace yii\data;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
interface
IDataProvider
interface
DataProviderInterface
{
/**
* Returns the number of data models in the current page.
...
...
framework/yii/web/AssetConverter.php
View file @
603da3f6
...
...
@@ -16,7 +16,7 @@ use yii\base\Component;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
AssetConverter
extends
Component
implements
IAssetConverter
class
AssetConverter
extends
Component
implements
AssetConverterInterface
{
/**
* @var array the commands that are used to perform the asset conversion.
...
...
framework/yii/web/
IAssetConverter
.php
→
framework/yii/web/
AssetConverterInterface
.php
View file @
603da3f6
...
...
@@ -8,12 +8,12 @@
namespace
yii\web
;
/**
* The
IAssetConverter i
nterface must be implemented by asset converter classes.
* The
AssetConverterI
nterface must be implemented by asset converter classes.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
interface
IAssetConverter
interface
AssetConverterInterface
{
/**
* Converts a given asset file into a CSS or JS file.
...
...
framework/yii/web/AssetManager.php
View file @
603da3f6
...
...
@@ -16,7 +16,7 @@ use yii\helpers\FileHelper;
/**
* AssetManager manages asset bundles and asset publishing.
*
* @property
IAssetConverter
$converter The asset converter. Note that the type of this property differs in
* @property
AssetConverterInterface
$converter The asset converter. Note that the type of this property differs in
* getter and setter. See [[getConverter()]] and [[setConverter()]] for details.
*
* @author Qiang Xue <qiang.xue@gmail.com>
...
...
@@ -116,7 +116,7 @@ class AssetManager extends Component
/**
* Returns the asset converter.
* @return
IAssetConverter
the asset converter.
* @return
AssetConverterInterface
the asset converter.
*/
public
function
getConverter
()
{
...
...
@@ -130,8 +130,8 @@ class AssetManager extends Component
/**
* Sets the asset converter.
* @param array|
IAssetConverter
$value the asset converter. This can be either
* an object implementing the [[
IAssetConverter]] interface
, or a configuration
* @param array|
AssetConverterInterface
$value the asset converter. This can be either
* an object implementing the [[
AssetConverterInterface]]
, or a configuration
* array that can be used to create the asset converter object.
*/
public
function
setConverter
(
$value
)
...
...
framework/yii/web/Identity.php
→
framework/yii/web/Identity
Interface
.php
View file @
603da3f6
...
...
@@ -8,13 +8,13 @@
namespace
yii\web
;
/**
* Identity is the interface that should be implemented by a class providing identity information.
* Identity
Interface
is the interface that should be implemented by a class providing identity information.
*
* This interface can typically be implemented by a user model class. For example, the following
* code shows how to implement this interface by a User ActiveRecord class:
*
* ~~~
* class User extends ActiveRecord implements Identity
* class User extends ActiveRecord implements Identity
Interface
* {
* public static function findIdentity($id)
* {
...
...
@@ -41,12 +41,12 @@ namespace yii\web;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
interface
Identity
interface
Identity
Interface
{
/**
* Finds an identity by the given ID.
* @param string|integer $id the ID to be looked for
* @return Identity the identity object that matches the given ID.
* @return Identity
Interface
the identity object that matches the given ID.
* Null should be returned if such an identity cannot be found
* or the identity is not in an active state (disabled, deleted, etc.)
*/
...
...
framework/yii/web/Response.php
View file @
603da3f6
...
...
@@ -766,10 +766,10 @@ class Response extends \yii\base\Response
if
(
!
is_object
(
$formatter
))
{
$formatter
=
Yii
::
createObject
(
$formatter
);
}
if
(
$formatter
instanceof
ResponseFormatter
)
{
if
(
$formatter
instanceof
ResponseFormatter
Interface
)
{
$formatter
->
format
(
$this
);
}
else
{
throw
new
InvalidConfigException
(
"The '
{
$this
->
format
}
' response formatter is invalid. It must implement the ResponseFormatter
i
nterface."
);
throw
new
InvalidConfigException
(
"The '
{
$this
->
format
}
' response formatter is invalid. It must implement the ResponseFormatter
I
nterface."
);
}
}
else
{
switch
(
$this
->
format
)
{
...
...
framework/yii/web/ResponseFormatter.php
→
framework/yii/web/ResponseFormatter
Interface
.php
View file @
603da3f6
...
...
@@ -8,12 +8,12 @@
namespace
yii\web
;
/**
* ResponseFormatter specifies the interface needed to format a response before it is sent out.
* ResponseFormatter
Interface
specifies the interface needed to format a response before it is sent out.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
interface
ResponseFormatter
interface
ResponseFormatter
Interface
{
/**
* Formats the specified response.
...
...
framework/yii/web/User.php
View file @
603da3f6
...
...
@@ -18,12 +18,12 @@ use yii\base\InvalidParamException;
* In particular, [[User::isGuest]] returns a value indicating whether the current user is a guest or not.
* Through methods [[login()]] and [[logout()]], you can change the user authentication status.
*
* User works with a class implementing the [[Identity
]] interface
. This class implements
* User works with a class implementing the [[Identity
Interface]]
. This class implements
* the actual user authentication logic and is often backed by a user database table.
*
* @property string|integer $id The unique identifier for the user. If null, it means the user is a guest.
* This property is read-only.
* @property Identity $identity The identity object associated with the currently logged user. Null is
* @property Identity
Interface
$identity The identity object associated with the currently logged user. Null is
* returned if the user is not logged in (not authenticated).
* @property boolean $isGuest Whether the current user is a guest. This property is read-only.
* @property string $returnUrl The URL that the user should be redirected to after login. Note that the type
...
...
@@ -128,7 +128,7 @@ class User extends Component
/**
* Returns the identity object associated with the currently logged user.
* @return Identity the identity object associated with the currently logged user.
* @return Identity
Interface
the identity object associated with the currently logged user.
* Null is returned if the user is not logged in (not authenticated).
* @see login
* @see logout
...
...
@@ -140,7 +140,7 @@ class User extends Component
if
(
$id
===
null
)
{
$this
->
_identity
=
null
;
}
else
{
/** @var $class Identity */
/** @var $class Identity
Interface
*/
$class
=
$this
->
identityClass
;
$this
->
_identity
=
$class
::
findIdentity
(
$id
);
}
...
...
@@ -156,7 +156,7 @@ class User extends Component
* You should normally update the user identity via methods [[login()]], [[logout()]]
* or [[switchIdentity()]].
*
* @param Identity $identity the identity object associated with the currently logged user.
* @param Identity
Interface
$identity the identity object associated with the currently logged user.
*/
public
function
setIdentity
(
$identity
)
{
...
...
@@ -171,7 +171,7 @@ class User extends Component
* and [[enableAutoLogin]] is true, it will also send out an identity
* cookie to support cookie-based login.
*
* @param Identity $identity the user identity (which should already be authenticated)
* @param Identity
Interface
$identity the user identity (which should already be authenticated)
* @param integer $duration number of seconds that the user can remain in logged-in status.
* Defaults to 0, meaning login till the user closes the browser or the session is manually destroyed.
* If greater than 0 and [[enableAutoLogin]] is true, cookie-based login will be supported.
...
...
@@ -200,7 +200,7 @@ class User extends Component
$data
=
json_decode
(
$value
,
true
);
if
(
count
(
$data
)
===
3
&&
isset
(
$data
[
0
],
$data
[
1
],
$data
[
2
]))
{
list
(
$id
,
$authKey
,
$duration
)
=
$data
;
/** @var $class Identity */
/** @var $class Identity
Interface
*/
$class
=
$this
->
identityClass
;
$identity
=
$class
::
findIdentity
(
$id
);
if
(
$identity
!==
null
&&
$identity
->
validateAuthKey
(
$authKey
))
{
...
...
@@ -318,7 +318,7 @@ class User extends Component
* The default implementation will trigger the [[EVENT_BEFORE_LOGIN]] event.
* If you override this method, make sure you call the parent implementation
* so that the event is triggered.
* @param Identity $identity the user identity information
* @param Identity
Interface
$identity the user identity information
* @param boolean $cookieBased whether the login is cookie-based
* @return boolean whether the user should continue to be logged in
*/
...
...
@@ -337,7 +337,7 @@ class User extends Component
* The default implementation will trigger the [[EVENT_AFTER_LOGIN]] event.
* If you override this method, make sure you call the parent implementation
* so that the event is triggered.
* @param Identity $identity the user identity information
* @param Identity
Interface
$identity the user identity information
* @param boolean $cookieBased whether the login is cookie-based
*/
protected
function
afterLogin
(
$identity
,
$cookieBased
)
...
...
@@ -353,7 +353,7 @@ class User extends Component
* The default implementation will trigger the [[EVENT_BEFORE_LOGOUT]] event.
* If you override this method, make sure you call the parent implementation
* so that the event is triggered.
* @param Identity $identity the user identity information
* @param Identity
Interface
$identity the user identity information
* @return boolean whether the user should continue to be logged out
*/
protected
function
beforeLogout
(
$identity
)
...
...
@@ -370,7 +370,7 @@ class User extends Component
* The default implementation will trigger the [[EVENT_AFTER_LOGOUT]] event.
* If you override this method, make sure you call the parent implementation
* so that the event is triggered.
* @param Identity $identity the user identity information
* @param Identity
Interface
$identity the user identity information
*/
protected
function
afterLogout
(
$identity
)
{
...
...
@@ -402,9 +402,9 @@ class User extends Component
/**
* Sends an identity cookie.
* This method is used when [[enableAutoLogin]] is true.
* It saves [[id]], [[Identity::getAuthKey()|auth key]], and the duration of cookie-based login
* It saves [[id]], [[Identity
Interface
::getAuthKey()|auth key]], and the duration of cookie-based login
* information in the cookie.
* @param Identity $identity
* @param Identity
Interface
$identity
* @param integer $duration number of seconds that the user can remain in logged-in status.
* @see loginByCookie
*/
...
...
@@ -430,7 +430,7 @@ class User extends Component
* This method is mainly called by [[login()]], [[logout()]] and [[loginByCookie()]]
* when the current user needs to be associated with the corresponding identity information.
*
* @param Identity $identity the identity information to be associated with the current user.
* @param Identity
Interface
$identity the identity information to be associated with the current user.
* If null, it means switching to be a guest.
* @param integer $duration number of seconds that the user can remain in logged-in status.
* This parameter is used only when `$identity` is not null.
...
...
@@ -444,7 +444,7 @@ class User extends Component
$this
->
setIdentity
(
$identity
);
$session
->
remove
(
$this
->
idVar
);
$session
->
remove
(
$this
->
authTimeoutVar
);
if
(
$identity
instanceof
Identity
)
{
if
(
$identity
instanceof
Identity
Interface
)
{
$session
->
set
(
$this
->
idVar
,
$identity
->
getId
());
if
(
$this
->
authTimeout
!==
null
)
{
$session
->
set
(
$this
->
authTimeoutVar
,
time
()
+
$this
->
authTimeout
);
...
...
framework/yii/web/UserEvent.php
View file @
603da3f6
...
...
@@ -18,7 +18,7 @@ use yii\base\Event;
class
UserEvent
extends
Event
{
/**
* @var Identity the identity object associated with this event
* @var Identity
Interface
the identity object associated with this event
*/
public
$identity
;
/**
...
...
framework/yii/web/XmlResponseFormatter.php
View file @
603da3f6
...
...
@@ -20,7 +20,7 @@ use yii\helpers\StringHelper;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
XmlResponseFormatter
extends
Component
implements
ResponseFormatter
class
XmlResponseFormatter
extends
Component
implements
ResponseFormatter
Interface
{
/**
* @var string the Content-Type header for the response
...
...
framework/yii/widgets/ListViewBase.php
View file @
603da3f6
...
...
@@ -25,7 +25,7 @@ abstract class ListViewBase extends Widget
*/
public
$options
=
array
();
/**
* @var \yii\data\
IDataProvider
the data provider for the view. This property is required.
* @var \yii\data\
DataProviderInterface
the data provider for the view. This property is required.
*/
public
$dataProvider
;
/**
...
...
phpunit.xml.dist
View file @
603da3f6
...
...
@@ -21,7 +21,7 @@
<file>
framework/yii/helpers/ArrayHelper.php
</file>
<file>
framework/yii/helpers/Console.php
</file>
<file>
framework/yii/i18n/GettextFile.php
</file>
<file>
framework/yii/web/ResponseFormatter
.php
</file>
<file>
framework/yii/web/ResponseFormatter
Interface.php
</file>
<directory
suffix=
"Exception.php"
>
framework/yii/base
</directory>
<directory
suffix=
".php"
>
framework/yii/db/mssql
</directory>
<directory
suffix=
".php"
>
framework/yii/bootstrap
</directory>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment