-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation generation (#591)
* Update doc gen * Update code parser to include inherit docs, fix internal links * Update generation with heirarchy * Update traits, extends, link to implementation * Update external classes
- v0.270.0
- v0.269.0
- v0.268.0
- v0.267.0
- v0.266.0
- v0.265.0
- v0.264.0
- v0.263.0
- v0.262.0
- v0.261.0
- v0.260.0
- v0.259.0
- v0.258.0
- v0.257.0
- v0.256.0
- v0.255.0
- v0.254.0
- v0.253.0
- v0.252.0
- v0.251.0
- v0.250.0
- v0.249.0
- v0.248.0
- v0.247.0
- v0.246.0
- v0.245.0
- v0.244.0
- v0.243.0
- v0.242.0
- v0.241.0
- v0.240.0
- v0.239.0
- v0.238.0
- v0.237.0
- v0.236.0
- v0.235.0
- v0.234.0
- v0.233.0
- v0.232.0
- v0.231.0
- v0.230.0
- v0.229.0
- v0.228.0
- v0.227.0
- v0.226.0
- v0.225.0
- v0.224.0
- v0.223.0
- v0.222.0
- v0.221.0
- v0.220.0
- v0.219.0
- v0.218.0
- v0.217.0
- v0.216.0
- v0.215.0
- v0.214.0
- v0.213.0
- v0.212.0
- v0.211.0
- v0.210.0
- v0.209.1
- v0.209.0
- v0.208.0
- v0.207.0
- v0.206.0
- v0.205.0
- v0.204.0
- v0.203.2
- v0.203.1
- v0.203.0
- v0.202.0
- v0.201.0
- v0.200.0
- v0.199.0
- v0.198.0
- v0.197.0
- v0.196.0
- v0.195.0
- v0.194.0
- v0.193.0
- v0.192.0
- v0.191.0
- v0.190.0
- v0.189.0
- v0.188.0
- v0.187.0
- v0.186.0
- v0.185.0
- v0.184.0
- v0.183.0
- v0.182.0
- v0.181.0
- v0.180.0
- v0.179.0
- v0.178.0
- v0.177.0
- v0.176.0
- v0.175.0
- v0.174.0
- v0.173.1
- v0.173.0
- v0.172.0
- v0.171.1
- v0.171.0
- v0.170.0
- v0.169.0
- v0.168.0
- v0.167.1
- v0.167.0
- v0.166.0
- v0.165.0
- v0.164.0
- v0.163.1
- v0.163.0
- v0.162.0
- v0.161.0
- v0.160.0
- v0.159.1
- v0.159.0
- v0.158.0
- v0.157.0
- v0.156.0
- v0.155.1
- v0.155.0
- v0.154.0
- v0.153.0
- v0.152.0
- v0.151.0
- v0.150.0
- v0.149.0
- v0.148.0
- v0.147.0
- v0.146.0
- v0.145.0
- v0.144.0
- v0.143.0
- v0.142.0
- v0.141.0
- v0.140.0
- v0.139.0
- v0.138.0
- v0.137.0
- v0.136.0
- v0.135.0
- v0.134.0
- v0.133.1
- v0.133.0
- v0.132.0
- v0.131.0
- v0.130.0
- v0.129.0
- v0.128.0
- v0.127.0
- v0.126.0
- v0.125.0
- v0.124.0
- v0.123.0
- v0.122.0
- v0.121.0
- v0.120.0
- v0.119.0
- v0.118.0
- v0.117.0
- v0.116.0
- v0.115.0
- v0.114.0
- v0.113.0
- v0.112.0
- v0.111.0
- v0.110.0
- v0.109.0
- v0.108.0
- v0.107.1
- v0.107.0
- v0.106.1
- v0.106.0
- v0.105.0
- v0.104.0
- v0.103.0
- v0.102.0
- v0.101.1
- v0.101.0
- v0.100.0
- v0.99.0
- v0.98.0
- v0.97.0
- v0.96.0
- v0.95.0
- v0.94.0
- v0.93.0
- v0.92.0
- v0.91.0
- v0.90.0
- v0.89.0
- v0.88.0
- v0.87.0
- v0.86.0
- v0.85.0
- v0.84.1
- v0.84.0
- v0.83.0
- v0.82.0
- v0.81.0
- v0.80.0
- v0.79.0
- v0.78.0
- v0.77.0
- v0.76.1
- v0.76.0
- v0.75.0
- v0.74.1
- v0.74.0
- v0.73.0
- v0.72.0
- v0.71.0
- v0.70.0
- v0.69.1
- v0.69.0
- v0.68.0
- v0.67.0
- v0.66.1
- v0.66.0
- v0.65.0
- v0.64.0
- v0.63.0
- v0.62.0
- v0.61.0
- v0.60.0
- v0.59.0
- v0.58.1
- v0.58.0
- v0.57.1
- v0.57.0
- v0.56.0
- v0.55.0
- v0.54.0
- v0.53.0
- v0.52.1
- v0.52.0
- v0.51.0
- v0.50.1
- v0.50.0
- v0.49.0
- v0.48.0
- v0.47.0
- v0.46.0
- v0.45.2
- v0.45.1
- v0.45.0
- v0.44.0
- v0.43.1
- v0.43.0
- v0.42.0
- v0.41.0
- v0.40.0
- v0.39.2
- v0.39.1
- v0.39.0
- v0.38.0
- v0.37.0
- v0.36.0
- v0.35.0
1 parent
5a437c8
commit 71de21d
Showing
4 changed files
with
382 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
/** | ||
* Copyright 2017 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Google\Cloud\Dev\DocGenerator; | ||
|
||
use Google\Cloud\Dev\DocGenerator\Parser\CodeParser; | ||
use Google\Cloud\Dev\DocGenerator\Parser\MarkdownParser; | ||
use phpDocumentor\Reflection\ClassReflector; | ||
use phpDocumentor\Reflection\FileReflector; | ||
use phpDocumentor\Reflection\InterfaceReflector; | ||
use phpDocumentor\Reflection\TraitReflector; | ||
|
||
class ReflectorRegister | ||
{ | ||
private $fileReflectors = []; | ||
private $nameFileMap = []; | ||
|
||
/** | ||
* @param string $name The name of a class, trait or interface | ||
* @return array [$fileReflector, $reflector] | ||
*/ | ||
public function getReflectors($name) | ||
{ | ||
$fileName = $this->getFileForName($name); | ||
return $this->getReflectorsFromFileName($fileName); | ||
} | ||
|
||
/** | ||
* @param string $fileName The file name containing a single class, trait or interface | ||
* @return array [$fileReflector, $reflector] | ||
*/ | ||
public function getReflectorsFromFileName($fileName) | ||
{ | ||
$fileReflector = $this->getFileReflector($fileName); | ||
$reflector = $this->getReflectorFromFileReflector($fileReflector); | ||
return [$fileReflector, $reflector]; | ||
} | ||
|
||
/** | ||
* @param $fileName | ||
* @return FileReflector|null | ||
*/ | ||
private function getFileReflector($fileName) | ||
{ | ||
if (empty($fileName)) { | ||
return null; | ||
} | ||
|
||
if (!isset($this->fileReflectors[$fileName])) { | ||
$this->fileReflectors[$fileName] = new FileReflector($fileName); | ||
$this->fileReflectors[$fileName]->process(); | ||
} | ||
return $this->fileReflectors[$fileName]; | ||
} | ||
|
||
/** | ||
* @param FileReflector $fileReflector | ||
* @return InterfaceReflector|ClassReflector|TraitReflector|null | ||
*/ | ||
private function getReflectorFromFileReflector($fileReflector) | ||
{ | ||
if (is_null($fileReflector)) { | ||
return null; | ||
} | ||
|
||
if (isset($fileReflector->getClasses()[0])) { | ||
return $fileReflector->getClasses()[0]; | ||
} | ||
|
||
if (isset($fileReflector->getInterfaces()[0])) { | ||
return $fileReflector->getInterfaces()[0]; | ||
} | ||
|
||
if (isset($fileReflector->getTraits()[0])) { | ||
return $fileReflector->getTraits()[0]; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* @param $name | ||
* @return string|null | ||
*/ | ||
private function getFileForName($name) | ||
{ | ||
if (empty($name)) { | ||
return null; | ||
} | ||
if (!array_key_exists($name, $this->nameFileMap)) { | ||
if (class_exists($name) || interface_exists($name) || trait_exists($name)) { | ||
$refClass = new \ReflectionClass((string)$name); | ||
$fileName = $refClass->getFileName(); | ||
if (empty($fileName)) { | ||
echo "Could not find file for $name\n"; | ||
} | ||
} else { | ||
$fileName = null; | ||
echo "Could not find class, trait or interface for $name\n"; | ||
} | ||
$this->nameFileMap[$name] = $fileName; | ||
} | ||
return $this->nameFileMap[$name]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters