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
Show 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;
use
TokenReflection\ReflectionFile
;
use
yii\apidoc\templates\BaseRenderer
;
use
yii\console\Controller
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\Console
;
use
yii\helpers\FileHelper
;
use
yii\apidoc\components\OfflineRenderer
;
...
...
@@ -105,6 +106,7 @@ class RenderController extends Controller
// render models
$renderer
->
renderApi
(
$context
,
$this
);
ArrayHelper
::
multisort
(
$context
->
errors
,
'file'
);
print_r
(
$context
->
errors
);
// render guide if specified
...
...
extensions/apidoc/models/ClassDoc.php
View file @
193bc501
...
...
@@ -22,6 +22,9 @@ class ClassDoc extends TypeDoc
public
$isAbstract
;
public
$isFinal
;
/**
* @var string[]
*/
public
$interfaces
=
[];
public
$traits
=
[];
// will be set by Context::updateReferences()
...
...
extensions/apidoc/models/Context.php
View file @
193bc501
...
...
@@ -88,11 +88,6 @@ class Context extends Component
}
// update implementedBy and usedBy for interfaces and traits
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
)
{
if
(
isset
(
$this
->
traits
[
$trait
]))
{
$trait
=
$this
->
traits
[
$trait
];
...
...
@@ -101,6 +96,19 @@ class Context extends Component
$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
foreach
(
$this
->
classes
as
$class
)
{
...
...
@@ -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
*/
protected
function
handlePropertyFeature
(
$class
)
...
...
extensions/apidoc/models/InterfaceDoc.php
View file @
193bc501
...
...
@@ -37,6 +37,10 @@ class InterfaceDoc extends TypeDoc
$this
->
parentInterfaces
[]
=
ltrim
(
$interface
,
'\\'
);
}
foreach
(
$this
->
methods
as
$method
)
{
$method
->
isAbstract
=
true
;
}
// interface can not have properties
$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