X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fconsolidation%2Fannotated-command%2Fsrc%2FParser%2FInternal%2FTagFactory.php;fp=vendor%2Fconsolidation%2Fannotated-command%2Fsrc%2FParser%2FInternal%2FTagFactory.php;h=4c48679d5aae635a850ae82df9468eaee471b877;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/consolidation/annotated-command/src/Parser/Internal/TagFactory.php b/vendor/consolidation/annotated-command/src/Parser/Internal/TagFactory.php new file mode 100644 index 000000000..4c48679d5 --- /dev/null +++ b/vendor/consolidation/annotated-command/src/Parser/Internal/TagFactory.php @@ -0,0 +1,67 @@ +current = null; + $this->tags = []; + } + + public function parseLine($line) + { + if (DocblockTag::isTag($line)) { + return $this->createTag($line); + } + if (empty($line)) { + return $this->storeCurrentTag(); + } + return $this->accumulateContent($line); + } + + public function getTags() + { + $this->storeCurrentTag(); + return $this->tags; + } + + protected function createTag($line) + { + DocblockTag::splitTagAndContent($line, $matches); + $this->storeCurrentTag(); + $this->current = new DocblockTag($matches['tag'], $matches['description']); + return true; + } + + protected function storeCurrentTag() + { + if (!$this->current) { + return false; + } + $this->tags[] = $this->current; + $this->current = false; + return true; + } + + protected function accumulateContent($line) + { + if (!$this->current) { + return false; + } + $this->current->appendContent($line); + return true; + } +}