/** * Adds one (or multiple) constants found in a source code line to the classObject * * @param array $constantMatches as returned from preg_match_all */ protected function addConstant($constantMatches) { for ($i = 0; $i < count($constantMatches[0]); $i++) { try { $constantName = $constantMatches[1][$i]; // the constant has to exist in the classReflection $reflectionConstantValue = $this->classReflection->getConstant($constantName); $this->classObject->setConstant($constantName, json_encode($reflectionConstantValue)); } catch (ReflectionException $e) { // ReflectionClass throws an exception if a property was not found t3lib_div::devlog('Exception in line : ' . $e->getMessage() . ' Constant ' . $constantName . ' found in line ' . $this->lineCount, 'extension_builder'); } } }