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
edc48dc9
Commit
edc48dc9
authored
Jan 20, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed ApplicationComponent.
parent
41ba44b7
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
27 additions
and
56 deletions
+27
-56
ApplicationComponent.php
framework/base/ApplicationComponent.php
+0
-32
Behavior.php
framework/base/Behavior.php
+6
-5
Component.php
framework/base/Component.php
+6
-5
ErrorHandler.php
framework/base/ErrorHandler.php
+1
-1
Module.php
framework/base/Module.php
+5
-5
Request.php
framework/base/Request.php
+1
-1
Response.php
framework/base/Response.php
+1
-1
SecurityManager.php
framework/base/SecurityManager.php
+1
-1
Theme.php
framework/base/Theme.php
+1
-1
UrlManager.php
framework/base/UrlManager.php
+2
-2
Connection.php
framework/db/Connection.php
+3
-2
No files found.
framework/base/ApplicationComponent.php
deleted
100644 → 0
View file @
41ba44b7
<?php
/**
* ApplicationComponent class file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\base
;
/**
* ApplicationComponent is the base class for application component classes.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
ApplicationComponent
extends
Component
{
/**
* @var string unique ID of this application component
*/
public
$id
;
public
function
init
()
{
parent
::
init
();
if
(
$this
->
id
===
null
)
{
$this
->
id
=
get_class
(
$this
);
}
}
}
framework/base/Behavior.php
View file @
edc48dc9
...
@@ -80,13 +80,14 @@ class Behavior extends \yii\base\Object
...
@@ -80,13 +80,14 @@ class Behavior extends \yii\base\Object
* The default implementation will unset the [[owner]] property
* The default implementation will unset the [[owner]] property
* and detach event handlers declared in [[events]].
* and detach event handlers declared in [[events]].
* Make sure you call the parent implementation if you override this method.
* Make sure you call the parent implementation if you override this method.
* @param Component $owner the component that this behavior is to be detached from.
*/
*/
public
function
detach
(
$owner
)
public
function
detach
()
{
{
foreach
(
$this
->
events
()
as
$event
=>
$handler
)
{
if
(
$this
->
owner
)
{
$owner
->
off
(
$event
,
is_string
(
$handler
)
?
array
(
$this
,
$handler
)
:
$handler
);
foreach
(
$this
->
events
()
as
$event
=>
$handler
)
{
$this
->
owner
->
off
(
$event
,
is_string
(
$handler
)
?
array
(
$this
,
$handler
)
:
$handler
);
}
$this
->
owner
=
null
;
}
}
$this
->
owner
=
null
;
}
}
}
}
framework/base/Component.php
View file @
edc48dc9
...
@@ -76,7 +76,8 @@ class Component extends \yii\base\Object
...
@@ -76,7 +76,8 @@ class Component extends \yii\base\Object
* will be implicitly called when executing `$component->property = $value;`.
* will be implicitly called when executing `$component->property = $value;`.
* @param string $name the property name or the event name
* @param string $name the property name or the event name
* @param mixed $value the property value
* @param mixed $value the property value
* @throws UnknownPropertyException if the property is not defined or read-only.
* @throws UnknownPropertyException if the property is not defined
* @throws InvalidCallException if the property is read-only.
* @see __get
* @see __get
*/
*/
public
function
__set
(
$name
,
$value
)
public
function
__set
(
$name
,
$value
)
...
@@ -151,7 +152,7 @@ class Component extends \yii\base\Object
...
@@ -151,7 +152,7 @@ class Component extends \yii\base\Object
* Do not call this method directly as it is a PHP magic method that
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when executing `unset($component->property)`.
* will be implicitly called when executing `unset($component->property)`.
* @param string $name the property name
* @param string $name the property name
* @throws
UnknownProperty
Exception if the property is read only.
* @throws
InvalidCall
Exception if the property is read only.
*/
*/
public
function
__unset
(
$name
)
public
function
__unset
(
$name
)
{
{
...
@@ -421,7 +422,7 @@ class Component extends \yii\base\Object
...
@@ -421,7 +422,7 @@ class Component extends \yii\base\Object
public
function
trigger
(
$name
,
$event
=
null
)
public
function
trigger
(
$name
,
$event
=
null
)
{
{
$this
->
ensureBehaviors
();
$this
->
ensureBehaviors
();
if
(
isset
(
$this
->
_e
[
$name
]))
{
if
(
isset
(
$this
->
_e
[
$name
])
&&
$this
->
_e
[
$name
]
->
getCount
()
)
{
if
(
$event
===
null
)
{
if
(
$event
===
null
)
{
$event
=
new
Event
(
$this
);
$event
=
new
Event
(
$this
);
}
}
...
@@ -505,7 +506,7 @@ class Component extends \yii\base\Object
...
@@ -505,7 +506,7 @@ class Component extends \yii\base\Object
if
(
isset
(
$this
->
_b
[
$name
]))
{
if
(
isset
(
$this
->
_b
[
$name
]))
{
$behavior
=
$this
->
_b
[
$name
];
$behavior
=
$this
->
_b
[
$name
];
unset
(
$this
->
_b
[
$name
]);
unset
(
$this
->
_b
[
$name
]);
$behavior
->
detach
(
$this
);
$behavior
->
detach
();
return
$behavior
;
return
$behavior
;
}
else
{
}
else
{
return
null
;
return
null
;
...
@@ -550,7 +551,7 @@ class Component extends \yii\base\Object
...
@@ -550,7 +551,7 @@ class Component extends \yii\base\Object
$behavior
=
\Yii
::
createObject
(
$behavior
);
$behavior
=
\Yii
::
createObject
(
$behavior
);
}
}
if
(
isset
(
$this
->
_b
[
$name
]))
{
if
(
isset
(
$this
->
_b
[
$name
]))
{
$this
->
_b
[
$name
]
->
detach
(
$this
);
$this
->
_b
[
$name
]
->
detach
();
}
}
$behavior
->
attach
(
$this
);
$behavior
->
attach
(
$this
);
return
$this
->
_b
[
$name
]
=
$behavior
;
return
$this
->
_b
[
$name
]
=
$behavior
;
...
...
framework/base/ErrorHandler.php
View file @
edc48dc9
...
@@ -20,7 +20,7 @@ namespace yii\base;
...
@@ -20,7 +20,7 @@ namespace yii\base;
*/
*/
use
yii\util\VarDumper
;
use
yii\util\VarDumper
;
class
ErrorHandler
extends
Application
Component
class
ErrorHandler
extends
Component
{
{
/**
/**
* @var integer maximum number of source code lines to be displayed. Defaults to 25.
* @var integer maximum number of source code lines to be displayed. Defaults to 25.
...
...
framework/base/Module.php
View file @
edc48dc9
...
@@ -427,14 +427,14 @@ abstract class Module extends Component
...
@@ -427,14 +427,14 @@ abstract class Module extends Component
* Retrieves the named application component.
* Retrieves the named application component.
* @param string $id application component ID (case-sensitive)
* @param string $id application component ID (case-sensitive)
* @param boolean $load whether to load the component if it is not yet loaded.
* @param boolean $load whether to load the component if it is not yet loaded.
* @return
Application
Component|null the application component instance, null if the application component
* @return Component|null the application component instance, null if the application component
* does not exist.
* does not exist.
* @see hasComponent()
* @see hasComponent()
*/
*/
public
function
getComponent
(
$id
,
$load
=
true
)
public
function
getComponent
(
$id
,
$load
=
true
)
{
{
if
(
isset
(
$this
->
_components
[
$id
]))
{
if
(
isset
(
$this
->
_components
[
$id
]))
{
if
(
$this
->
_components
[
$id
]
instanceof
Application
Component
)
{
if
(
$this
->
_components
[
$id
]
instanceof
Component
)
{
return
$this
->
_components
[
$id
];
return
$this
->
_components
[
$id
];
}
elseif
(
$load
)
{
}
elseif
(
$load
)
{
\Yii
::
trace
(
"Loading
\"
$id
\"
application component"
,
__CLASS__
);
\Yii
::
trace
(
"Loading
\"
$id
\"
application component"
,
__CLASS__
);
...
@@ -447,10 +447,10 @@ abstract class Module extends Component
...
@@ -447,10 +447,10 @@ abstract class Module extends Component
/**
/**
* Registers an application component in this module.
* Registers an application component in this module.
* @param string $id component ID
* @param string $id component ID
* @param
Application
Component|array|null $component the component to be added to the module. This can
* @param Component|array|null $component the component to be added to the module. This can
* be one of the followings:
* be one of the followings:
*
*
* - a
n [[Application
Component]] object
* - a
[[
Component]] object
* - a configuration array: when [[getComponent()]] is called initially for this component, the array
* - a configuration array: when [[getComponent()]] is called initially for this component, the array
* will be used to instantiate the component
* will be used to instantiate the component
* - null: the named component will be removed from the module
* - null: the named component will be removed from the module
...
@@ -476,7 +476,7 @@ abstract class Module extends Component
...
@@ -476,7 +476,7 @@ abstract class Module extends Component
if
(
$loadedOnly
)
{
if
(
$loadedOnly
)
{
$components
=
array
();
$components
=
array
();
foreach
(
$this
->
_components
as
$component
)
{
foreach
(
$this
->
_components
as
$component
)
{
if
(
$component
instanceof
Application
Component
)
{
if
(
$component
instanceof
Component
)
{
$components
[]
=
$component
;
$components
[]
=
$component
;
}
}
}
}
...
...
framework/base/Request.php
View file @
edc48dc9
...
@@ -13,7 +13,7 @@ namespace yii\base;
...
@@ -13,7 +13,7 @@ namespace yii\base;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Request
extends
Application
Component
class
Request
extends
Component
{
{
private
$_scriptFile
;
private
$_scriptFile
;
private
$_isConsoleRequest
;
private
$_isConsoleRequest
;
...
...
framework/base/Response.php
View file @
edc48dc9
...
@@ -13,7 +13,7 @@ namespace yii\base;
...
@@ -13,7 +13,7 @@ namespace yii\base;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Response
extends
Application
Component
class
Response
extends
Component
{
{
public
function
beginOutput
()
public
function
beginOutput
()
{
{
...
...
framework/base/SecurityManager.php
View file @
edc48dc9
...
@@ -15,7 +15,7 @@ namespace yii\base;
...
@@ -15,7 +15,7 @@ namespace yii\base;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
SecurityManager
extends
Application
Component
class
SecurityManager
extends
Component
{
{
const
STATE_VALIDATION_KEY
=
'Yii.SecurityManager.validationkey'
;
const
STATE_VALIDATION_KEY
=
'Yii.SecurityManager.validationkey'
;
const
STATE_ENCRYPTION_KEY
=
'Yii.SecurityManager.encryptionkey'
;
const
STATE_ENCRYPTION_KEY
=
'Yii.SecurityManager.encryptionkey'
;
...
...
framework/base/Theme.php
View file @
edc48dc9
...
@@ -17,7 +17,7 @@ use yii\base\InvalidConfigException;
...
@@ -17,7 +17,7 @@ use yii\base\InvalidConfigException;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Theme
extends
Application
Component
class
Theme
extends
Component
{
{
public
$basePath
;
public
$basePath
;
public
$baseUrl
;
public
$baseUrl
;
...
...
framework/base/UrlManager.php
View file @
edc48dc9
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
namespace
yii\base
;
namespace
yii\base
;
use
\yii\base\
Application
Component
;
use
\yii\base\Component
;
/**
/**
* UrlManager manages the URLs of Yii applications.
* UrlManager manages the URLs of Yii applications.
...
@@ -123,7 +123,7 @@ use \yii\base\ApplicationComponent;
...
@@ -123,7 +123,7 @@ use \yii\base\ApplicationComponent;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
UrlManager
extends
Application
Component
class
UrlManager
extends
Component
{
{
const
CACHE_KEY
=
'Yii.UrlManager.rules'
;
const
CACHE_KEY
=
'Yii.UrlManager.rules'
;
const
GET_FORMAT
=
'get'
;
const
GET_FORMAT
=
'get'
;
...
...
framework/db/Connection.php
View file @
edc48dc9
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
namespace
yii\db
;
namespace
yii\db
;
use
yii\base\Component
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
use
yii\base\NotSupportedException
;
use
yii\base\NotSupportedException
;
...
@@ -70,7 +71,7 @@ use yii\base\NotSupportedException;
...
@@ -70,7 +71,7 @@ use yii\base\NotSupportedException;
* }
* }
* ~~~
* ~~~
*
*
* Connection is often used as an
[[\yii\base\ApplicationComponent|application component]]
and configured in the application
* Connection is often used as an
application component
and configured in the application
* configuration like the following:
* configuration like the following:
*
*
* ~~~
* ~~~
...
@@ -98,7 +99,7 @@ use yii\base\NotSupportedException;
...
@@ -98,7 +99,7 @@ use yii\base\NotSupportedException;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Connection
extends
\yii\base\Application
Component
class
Connection
extends
Component
{
{
/**
/**
* @event Event an event that is triggered after a DB connection is established
* @event Event an event that is triggered after a DB connection is established
...
...
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