public function applyClassHeaders(CompilationContext $compilationContext)
{
$classDefinition = $this->_classDefinition;
$separators = str_repeat('../', count(explode('\\', $classDefinition->getCompleteName())) - 1);
$code = '' . PHP_EOL;
$code .= '#ifdef HAVE_CONFIG_H' . PHP_EOL;
$code .= '#include "' . $separators . 'ext_config.h"' . PHP_EOL;
$code .= '#endif' . PHP_EOL;
$code .= '' . PHP_EOL;
$code .= '#include <php.h>' . PHP_EOL;
$code .= '#include "' . $separators . 'php_ext.h"' . PHP_EOL;
$code .= '#include "' . $separators . 'ext.h"' . PHP_EOL;
$code .= '' . PHP_EOL;
if ($classDefinition->getType() == 'class') {
$code .= '#include <Zend/zend_operators.h>' . PHP_EOL;
$code .= '#include <Zend/zend_exceptions.h>' . PHP_EOL;
$code .= '#include <Zend/zend_interfaces.h>' . PHP_EOL;
} else {
$code .= '#include <Zend/zend_exceptions.h>' . PHP_EOL;
}
$code .= '' . PHP_EOL;
$code .= '#include "kernel/main.h"' . PHP_EOL;
if ($classDefinition->getType() == 'class') {
foreach ($compilationContext->headersManager->get() as $header => $one) {
$code .= '#include "' . $header . '.h"' . PHP_EOL;
}
}
if (count($this->_headerCBlocks) > 0) {
$code .= implode($this->_headerCBlocks, PHP_EOL) . PHP_EOL;
}
/**
* Prepend the required files to the header
*/
$compilationContext->codePrinter->preOutput($code);
}