Get the class doccomment from the reflector or from the source file.
@return str
556328
private function getDocComment($classReflector)
    {
        $commentString = $classReflector->getDocComment();

        if (!$commentString) {
            $startline = $classReflector->getStartLine();
            $fileLines = file($classReflector->getFileName());
            $lineNumber = $startline - 1;
            while (isset($fileLines[$lineNumber]) && substr($fileLines[$lineNumber], 0, 3) != '/**') {
                $lineNumber--;
            }
            $commentString = join(array_slice($fileLines, $lineNumber));
        }

        return $commentString;
    }
1054471
function readComment()
    {
        $str    = substr($this->source, $this->index);
        $result = preg_match('/^(.*?)(?:\r\n|\n|$)/', $str, $matches);

        $this->index += ($result) ? strlen($matches[0]) : 0;

        return substr($matches[1], 1); // ignore # character and EOL
    }
405845
protected function GetCommentTypeId()
    {
        if (false === $this->sPkgCommentTypeId) {
            $sQuery = "SELECT * FROM `pkg_comment_type` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview'";
            $oRes = MySqlLegacySupport::getInstance()->query($sQuery);
            if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) {
                $aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes);
                $this->sPkgCommentTypeId = $aRow['id'];
            } else {
                $this->sPkgCommentTypeId = '';
            }
        }

        return $this->sPkgCommentTypeId;
    }
538371
public function getMethodDescription(): ?string
    {
        // Remove the comment markers
        $description = preg_replace('~\*/$~', '', $this->comment);
        $description = preg_replace('~^\s*(/\*\*|\* ?|\*/)~m', '', $description);

        // Keep everything before the first annotation
        $description = trim(explode('@', $description)[0]);

        // Drop common "Get" or "Return" in front of comment
        $description = ucfirst(preg_replace('~^(set|get|return)s? ~i', '', $description));

        return $description ?: null;
    }
1193231
public String getComment() {
        synchronized (this) {
            ensureOpen();
            byte[] bcomm = getCommentBytes(jzfile);
            if (bcomm == null)
                return null;
            return zc.toString(bcomm, bcomm.length);
        }
    }
396839
public function getDeclaringClass()
    {
        $parent = $this->class;

        // Since we don't have real reflection constants, we can't see where
        // it's actually defined. Let's check for a constant that is also
        // available on the parent class which has exactly the same value.
        //
        // While this isn't _technically_ correct, it's prolly close enough.
        do {
            $class  = $parent;
            $parent = $class->getParentClass();
        } while ($parent && $parent->hasConstant($this->name) && $parent->getConstant($this->name) === $this->value);

        return $class;
    }
118080
protected function getComment() {
		$comment_body = elgg_view('output/longtext', array(
			'value' => $this->comment->description,
		));
//		if (elgg_view_exists('output/linkify')) {
//			$comment_body = elgg_view('output/linkify', array(
//				'value' => $comment_body
//			));
//		}
		$comment_body .= elgg_view('output/attached', array(
			'entity' => $this->comment,
		));

		$attachments = $this->comment->getAttachments(array('limit' => 0));
		if ($attachments && count($attachments)) {
			$attachments = array_map(__NAMESPACE__ . '\\get_linked_entity_name', $attachments);
			$attachments_text = implode(', ', array_filter($attachments));
			if ($attachments_text) {
				$comment_body .= elgg_echo('interactions:attachments:labelled', array($attachments_text));
			}
		}

		return strip_tags($comment_body, '<p><strong><em><span><ul><li><ol><blockquote><img><a>');
	}
444028
public function getDocComment(): ?Doc
    {
        $docComment = $this->property->props[$this->index]->getDocComment();
        if ($docComment === null) {
            $docComment = $this->property->getDocComment();
        }

        return $docComment;
    }
322668
public function getClass()
    {
        try {
            $class = parent::getClass();
        } catch (\Exception $e) {
            return null;
        }
        return is_object($class) ? new ClassReflection($class->getName()) : null;
    }
647045
public function phpdocContent()
    {
        $comment = preg_split('/(\n|\r\n)/', $this->comment);
        $comment[0] = preg_replace('/[ \t]*\\/\*\*/', '', $comment[0]); // strip '/**'
        $i = count($comment) - 1;
        $comment[$i] = preg_replace('/\*\/[ \t]*$/', '', $comment[$i]); // strip '*/'
        $lines = [];
        $append = false;
        foreach ($comment as $line) {
            $line = ltrim($line, "\t *");
            if (substr($line, 0, 1) === '@') {
                break;
            }
            if ($append) {
                $i = count($lines) - 1;
                $lines[$i] = substr($lines[$i], 0, -1) . $line;
            } else {
                $lines[] = $line;
            }
            $append = (substr($line, -1) === '\\');
        }
        $description = trim(implode("\n", $lines));
        if ($description === '') {
            return UNDEFINED;
        }

        return $description;
    }
278882
public function getExportDocumentClass_v2() {
		$class = new StdClass;

		// Standard-Export-Stuff
		if($this->getInvoiceNumber() !== null)
			$class->invoiceNumber = $this->getInvoiceNumber();

		$class->exportType = $this->getExportType();

		if($this->getExportTypeDescription() !== null)
			$class->exportTypeDescription = $this->getExportTypeDescription();
		else if($this->getExportType() === self::EXPORT_TYPE_OTHER)
			throw new Exception('ExportTypeDescription must filled out if Export-Type is OTHER! - ' .
				'Export-Class will not generated now');

		if($this->getTermsOfTrade() !== null)
			$class->termsOfTrade = $this->getTermsOfTrade();

		$class->placeOfCommital = $this->getPlaceOfCommittal();
		$class->additionalFee = $this->getAdditionalFee();

		if($this->getPermitNumber() !== null)
			$class->permitNumber = $this->getPermitNumber();

		if($this->getAttestationNumber() !== null)
			$class->attestationNumber = $this->getAttestationNumber();

		// Add rest (Elements)
		if($this->getWithElectronicExportNotification() !== null) {
			$class->WithElectronicExportNtfctn = new StdClass;
			$class->WithElectronicExportNtfctn->active = (int) $this->getWithElectronicExportNotification();
		}

		// Check if child-class is being used
		if($this->getExportDocPosition() !== null) {
			// Handle non-arrays... (Backward compatibility)
			if(! is_array($this->getExportDocPosition()))
				$class->ExportDocPosition = $this->getExportDocPosition()->getExportDocPositionClass_v2();
			else {
				$pos = $this->getExportDocPosition();
				foreach($pos as $key => &$exportDoc)
					$class->ExportDocPosition[$key] = $exportDoc->getExportDocPositionClass_v2();
			}
		}

		return $class;
	}
1204121
public function toString() {
        $documentation = preg_replace_callback(
            '@\r?\n@',
            function ($matches) {
                return $matches[0] . '	 * ';
            },
            trim($this->getDescription())
        );
        if($documentation == '') {
            $documentation = $this->getName();
        }
        $buffer = '
	/**
	 * ' . $documentation . '
';
        foreach($this->getParameters() as $parameter) {
            $buffer .= $parameter->toDocTypeString($this);
        }
        if($this->getName() != '__construct') {
            $buffer .= '	 * @return ' . $this->getReturnType() . '
';
        }
        foreach($this->getThrows() as $throw) {
            $buffer .= '	 * @throws ' . $throw . '
';
        }
        $buffer .= '	 */
	' . ($this->isFinal() ? 'final ' : '') . $this->getAccess() . ' ' . ($this->isStatic() ? 'static ' : '') . 'function ' . $this->getName() . '(';
        foreach($this->getParameters() as $key => $parameter) {
            if($key != 0) {
                $buffer .= ', ';
            }
            if($parameter->isStrictType()) {
                if(!is_null($parameter->getStrictClass())) {
                    $buffer .= $parameter->getStrictClass() . ' ';
                } else {
                    $buffer .= $parameter->getType() . ' ';
                }
            }
            $buffer .= '$' . $parameter->getName();
            if(!is_null($parameter->getDefaultValue())) {
                $buffer .= '=' . $parameter->getDefaultValue();
            }
        }
        $buffer .= ') {
		' . trim($this->getContent()) . '
	}
';
        return $buffer;
    }
172279
public function getClassAnnotations()
    {
        $reflector = new ReflectionClass($this->className);
        $doc = $reflector->getDocComment();
        if (!$doc) {
            return;
        }

        $annotations = [];
        foreach ($this->filteringList as $filter) {
            preg_match_all('#@' . $filter . '(.*?)\n#s', $doc, $annotation);
            if (count($annotation[1]) > 0) {
                $annotations[$filter] = $annotation[1];
            }
        }
        $this->annotationObject->mergeClassAnnotations($annotations);
    }
1078379
protected function getReferenceComment()
    {
        $referenceComment = null;
        $commentSections = $this->getCommentSections();
        $lastLine = end($commentSections);

        if (preg_match('/^\s*Styleguide \w/i', $lastLine) ||
            preg_match('/^\s*No styleguide reference/i', $lastLine)
        ) {
            $referenceComment = $lastLine;
        }

        return $referenceComment;
    }
885542
public function getCodeFromDocComment(string $docComment): string
    {
        $startExampleKeyword = strpos($docComment, Constants::EXAMPLE_KEYWORD);
        $startCodeKeyword = strpos($docComment, Constants::CODE_KEYWORD);

        if ($startExampleKeyword !== false) {
            $matches = $this->getCodeWithExampleKeyword($docComment, $startExampleKeyword);
        } elseif ($startCodeKeyword !== false) {
            $matches = $this->getCodeWithCodeKeyword($docComment, $startCodeKeyword);
        } else {
            // None of the keywords was found
            return '';
        }

        if (!$matches) {
            return '';
        }

        $codeLines = array_filter(
            array_map(
                function ($line) {
                    return ltrim(trim($line, " \t\n\r\0\x0B"), '*');
                },
                // TODO: Check what type $matches has
                is_array($matches) ? $matches : explode("\n", (string)$matches)
            )
        );

        return rtrim(implode("\n", $codeLines) . ';');
    }
1253371
protected function getElementClassString()
    {
        $elementClass = $this->getElementClass();

        if (Arr::isAssoc($elementClass)) {
            $classes = [];

            foreach ($elementClass as $index => $class) {
                $classes[$index] = is_array($class) ? implode(' ', $class) : $class;
            }

            return $classes;
        }

        return implode(' ', $elementClass);
    }
932568
protected function getResourceClass()
    {
        if (array_key_exists('class', $this->options)) {
            if ($this->options['class'] === false) {
                return $this->getName();
            } elseif (is_string($this->options['class'])) {
                return studly_case($this->options['class']);
            }
        }

        return studly_case($this->getNamespacedName());
    }