-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AlvaroRosado/master
Some refactors in classes model
- Loading branch information
Showing
16 changed files
with
347 additions
and
537 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 |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
|
||
namespace Cluster28\TeamShareDocumentation\Extractor; | ||
|
||
use Cluster28\TeamShareDocumentation\Annotation\ShareAnnotation; | ||
use Cluster28\TeamShareDocumentation\Configuration\Configuration; | ||
use Cluster28\TeamShareDocumentation\Model\Collection\Annotations; | ||
use Cluster28\TeamShareDocumentation\Model\ExtractionResult; | ||
use Cluster28\TeamShareDocumentation\Model\ClassInfo; | ||
use Cluster28\TeamShareDocumentation\Model\ResultInfo; | ||
use Cluster28\TeamShareDocumentation\Parser\ParserInterface; | ||
use Reflector; | ||
|
||
/** | ||
* @author Jordi Rejas <[email protected]> | ||
|
@@ -22,30 +22,19 @@ public function __construct( | |
ParserInterface $parser, | ||
AnnotationExtractorInterface $annotationExtractor | ||
) { | ||
$this->configuration = $configuration; | ||
$this->parser = $parser; | ||
$this->annotationExtractor = $annotationExtractor; | ||
} | ||
|
||
public function extractAnnotations(): Annotations | ||
public function execute(): ExtractionResult | ||
{ | ||
$classes = $this->parser->parseFiles(); | ||
$annotations = new Annotations(); | ||
$extractionResult = new ExtractionResult(); | ||
|
||
foreach ($classes->toArray() as $class) { | ||
foreach ( | ||
array_merge( | ||
$this->annotationExtractor->extractClassAnnotations($class), | ||
$this->annotationExtractor->extractMethodsAnnotations($class) | ||
) as $array) { | ||
/** @var Reflector $reflector */ | ||
$reflector = $array[0]; | ||
/** @var ShareAnnotation $shareAnnotation */ | ||
$shareAnnotation = $array[1]; | ||
$annotations->addAnnotation($reflector, $shareAnnotation); | ||
} | ||
foreach ($this->parser->parseFiles() as $reflectionClass) { | ||
$extractionResult->addClassAnnotations($this->annotationExtractor->extractClassAnnotations($reflectionClass)); | ||
$extractionResult->addMethodAnnotations($this->annotationExtractor->extractMethodsAnnotations($reflectionClass)); | ||
} | ||
|
||
return $annotations; | ||
return $extractionResult; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,12 +2,12 @@ | |
|
||
namespace Cluster28\TeamShareDocumentation\Extractor; | ||
|
||
use Cluster28\TeamShareDocumentation\Model\Collection\Annotations; | ||
use Cluster28\TeamShareDocumentation\Model\ExtractionResult; | ||
|
||
/** | ||
* @author Jordi Rejas <[email protected]> | ||
*/ | ||
interface ExtractorInterface | ||
{ | ||
public function extractAnnotations(): Annotations; | ||
public function execute(): ExtractionResult; | ||
} |
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,69 @@ | ||
<?php | ||
|
||
namespace Cluster28\TeamShareDocumentation\Model; | ||
|
||
use Cluster28\TeamShareDocumentation\Annotation\ShareAnnotation; | ||
|
||
class AnnotationData | ||
{ | ||
private ShareAnnotation $annotation; | ||
private bool $isInClass = false; | ||
private bool $isInMethod = false; | ||
private string $className = ''; | ||
private string $methodName = ''; | ||
|
||
public function getAnnotation(): ShareAnnotation | ||
{ | ||
return $this->annotation; | ||
} | ||
|
||
public function setAnnotation(ShareAnnotation $annotation): self | ||
{ | ||
$this->annotation = $annotation; | ||
return $this; | ||
} | ||
|
||
public function isInClass(): bool | ||
{ | ||
return $this->isInClass; | ||
} | ||
|
||
public function setIsInClass(bool $isInClass): self | ||
{ | ||
$this->isInClass = $isInClass; | ||
return $this; | ||
} | ||
|
||
public function isInMethod(): bool | ||
{ | ||
return $this->isInMethod; | ||
} | ||
|
||
public function setIsInMethod(bool $isInMethod): self | ||
{ | ||
$this->isInMethod = $isInMethod; | ||
return $this; | ||
} | ||
|
||
public function getClassName(): string | ||
{ | ||
return $this->className; | ||
} | ||
|
||
public function setClassName(string $className): self | ||
{ | ||
$this->className = $className; | ||
return $this; | ||
} | ||
|
||
public function getMethodName(): string | ||
{ | ||
return $this->methodName; | ||
} | ||
|
||
public function setMethodName(string $methodName): self | ||
{ | ||
$this->methodName = $methodName; | ||
return $this; | ||
} | ||
} |
Oops, something went wrong.