src/Utility/MetadataExtractor.php
private function extractVarValueFromComment($text)
    {
        $matches = array();
        $result = preg_match_all(self::REGULAR_GET_VAR, $text, $matches);
         //handle errors
         if (false === $result) {
             // get one of PREG_INTERNAL_ERROR, PREG_BACKTRACK_LIMIT_ERROR etc
            $constants = get_defined_constants(true);
             $text = array_search(preg_last_error(), $constants['pcre']);
             throw new RuntimeException("Regular expression failed on $text with error code: "
                    . (false === $text ? preg_last_error() : $text)); //push text or error code
         }
         //handle multiple entries in a hard way
         if ($result > 1) {
             throw new UnexpectedValueException("Following comment: $text \ncontains more than one @var definition, which is unexpected");
         }

         // no result, stop here if no group match
         if (empty($result) || empty($matches[1]) || empty($matches[1][0])) {
             return null;
         }

         // return first result (0-index) of the first group match
         return $matches[1][0];
    }
private function extractVarValueFromComment($text)
    {
        $matches = array();
        $result = preg_match_all(self::REGULAR_GET_VAR, $text, $matches);
         //handle errors
         if (false === $result) {
             // get one of PREG_INTERNAL_ERROR, PREG_BACKTRACK_LIMIT_ERROR etc
            $constants = get_defined_constants(true);
             $text = array_search(preg_last_error(), $constants['pcre']);
             throw new RuntimeException("Regular expression failed on $text with error code: "
                    . (false === $text ? preg_last_error() : $text)); //push text or error code
         }
         //handle multiple entries in a hard way
         if ($result > 1) {
             throw new UnexpectedValueException("Following comment: $text \ncontains more than one @var definition, which is unexpected");
         }

         // no result, stop here if no group match
         if (empty($result) || empty($matches[1]) || empty($matches[1][0])) {
             return null;
         }

         // return first result (0-index) of the first group match
         return $matches[1][0];
    }
Returns value of @var from text. It also returns last part (class name) of path-like value

TODO Move this function into separate object outside of this class.
Domain Entity builder doesn't care about how values are parsed.
It's better to apply dependecy-injection pattern here.

The only reason this function is here is for initial implementation.

@param string $text