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
193bc501
Commit
193bc501
authored
Jan 28, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added interface methods to abstract classes
parent
26218953
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
RenderController.php
extensions/apidoc/commands/RenderController.php
+2
-0
ClassDoc.php
extensions/apidoc/models/ClassDoc.php
+3
-0
Context.php
extensions/apidoc/models/Context.php
+14
-6
InterfaceDoc.php
extensions/apidoc/models/InterfaceDoc.php
+4
-0
No files found.
extensions/apidoc/commands/RenderController.php
View file @
193bc501
...
@@ -11,6 +11,7 @@ use phpDocumentor\Reflection\FileReflector;
...
@@ -11,6 +11,7 @@ use phpDocumentor\Reflection\FileReflector;
use
TokenReflection\ReflectionFile
;
use
TokenReflection\ReflectionFile
;
use
yii\apidoc\templates\BaseRenderer
;
use
yii\apidoc\templates\BaseRenderer
;
use
yii\console\Controller
;
use
yii\console\Controller
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\Console
;
use
yii\helpers\Console
;
use
yii\helpers\FileHelper
;
use
yii\helpers\FileHelper
;
use
yii\apidoc\components\OfflineRenderer
;
use
yii\apidoc\components\OfflineRenderer
;
...
@@ -105,6 +106,7 @@ class RenderController extends Controller
...
@@ -105,6 +106,7 @@ class RenderController extends Controller
// render models
// render models
$renderer
->
renderApi
(
$context
,
$this
);
$renderer
->
renderApi
(
$context
,
$this
);
ArrayHelper
::
multisort
(
$context
->
errors
,
'file'
);
print_r
(
$context
->
errors
);
print_r
(
$context
->
errors
);
// render guide if specified
// render guide if specified
...
...
extensions/apidoc/models/ClassDoc.php
View file @
193bc501
...
@@ -22,6 +22,9 @@ class ClassDoc extends TypeDoc
...
@@ -22,6 +22,9 @@ class ClassDoc extends TypeDoc
public
$isAbstract
;
public
$isAbstract
;
public
$isFinal
;
public
$isFinal
;
/**
* @var string[]
*/
public
$interfaces
=
[];
public
$interfaces
=
[];
public
$traits
=
[];
public
$traits
=
[];
// will be set by Context::updateReferences()
// will be set by Context::updateReferences()
...
...
extensions/apidoc/models/Context.php
View file @
193bc501
...
@@ -88,11 +88,6 @@ class Context extends Component
...
@@ -88,11 +88,6 @@ class Context extends Component
}
}
// update implementedBy and usedBy for interfaces and traits
// update implementedBy and usedBy for interfaces and traits
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$class
->
interfaces
as
$interface
)
{
if
(
isset
(
$this
->
interfaces
[
$interface
]))
{
$this
->
interfaces
[
$interface
]
->
implementedBy
[]
=
$class
->
name
;
}
}
foreach
(
$class
->
traits
as
$trait
)
{
foreach
(
$class
->
traits
as
$trait
)
{
if
(
isset
(
$this
->
traits
[
$trait
]))
{
if
(
isset
(
$this
->
traits
[
$trait
]))
{
$trait
=
$this
->
traits
[
$trait
];
$trait
=
$this
->
traits
[
$trait
];
...
@@ -101,6 +96,19 @@ class Context extends Component
...
@@ -101,6 +96,19 @@ class Context extends Component
$class
->
methods
=
array_merge
(
$trait
->
methods
,
$class
->
methods
);
$class
->
methods
=
array_merge
(
$trait
->
methods
,
$class
->
methods
);
}
}
}
}
foreach
(
$class
->
interfaces
as
$interface
)
{
if
(
isset
(
$this
->
interfaces
[
$interface
]))
{
$this
->
interfaces
[
$interface
]
->
implementedBy
[]
=
$class
->
name
;
if
(
$class
->
isAbstract
)
{
// add not implemented interface methods
foreach
(
$this
->
interfaces
[
$interface
]
->
methods
as
$method
)
{
if
(
!
isset
(
$class
->
methods
[
$method
->
name
]))
{
$class
->
methods
[
$method
->
name
]
=
$method
;
}
}
}
}
}
}
}
// inherit properties, methods, contants and events to subclasses
// inherit properties, methods, contants and events to subclasses
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
...
@@ -145,7 +153,7 @@ class Context extends Component
...
@@ -145,7 +153,7 @@ class Context extends Component
}
}
/**
/**
* Add properties for getters and setters if class is subclass of [[yii\base\Object]].
* Add properties for getters and setters if class is subclass of [[
\
yii\base\Object]].
* @param ClassDoc $class
* @param ClassDoc $class
*/
*/
protected
function
handlePropertyFeature
(
$class
)
protected
function
handlePropertyFeature
(
$class
)
...
...
extensions/apidoc/models/InterfaceDoc.php
View file @
193bc501
...
@@ -37,6 +37,10 @@ class InterfaceDoc extends TypeDoc
...
@@ -37,6 +37,10 @@ class InterfaceDoc extends TypeDoc
$this
->
parentInterfaces
[]
=
ltrim
(
$interface
,
'\\'
);
$this
->
parentInterfaces
[]
=
ltrim
(
$interface
,
'\\'
);
}
}
foreach
(
$this
->
methods
as
$method
)
{
$method
->
isAbstract
=
true
;
}
// interface can not have properties
// interface can not have properties
$this
->
properties
=
null
;
$this
->
properties
=
null
;
}
}
...
...
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