本文整理汇总了PHP中Project::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::log方法的具体用法?PHP Project::log怎么用?PHP Project::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::log方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* @param string $msg
*/
public static function log($msg)
{
if (!self::$_project) {
echo "{$msg}\n";
return;
}
self::$_project->log($msg);
}
示例2: parseFiles
/**
* Build a list of files (from the fileset elements)
* and call the phpDocumentor parser
*
* @return string
*/
private function parseFiles()
{
$parser = $this->app['parser'];
$builder = $this->app['descriptor.builder'];
$builder->createProjectDescriptor();
$projectDescriptor = $builder->getProjectDescriptor();
$projectDescriptor->setName($this->title);
$paths = array();
// filesets
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($this->project);
$dir = $fs->getDir($this->project);
$srcFiles = $ds->getIncludedFiles();
foreach ($srcFiles as $file) {
$paths[] = $dir . FileSystem::getFileSystem()->getSeparator() . $file;
}
}
$this->project->log("Will parse " . count($paths) . " file(s)", Project::MSG_VERBOSE);
$files = new \phpDocumentor\Fileset\Collection();
$files->addFiles($paths);
$mapper = new \phpDocumentor\Descriptor\Cache\ProjectDescriptorMapper($this->app['descriptor.cache']);
$mapper->garbageCollect($files);
$mapper->populate($projectDescriptor);
$parser->setPath($files->getProjectRoot());
$parser->setDefaultPackageName($this->defaultPackageName);
$parser->parse($builder, $files);
$mapper->save($projectDescriptor);
return $mapper;
}
示例3: run
/**
* Runs phpDocumentor 2
*/
public function run()
{
$this->initializePhpDocumentor();
$cache = $this->app['descriptor.cache'];
$cache->getOptions()->setCacheDir($this->destDir->getAbsolutePath());
$this->parseFiles();
$this->project->log("Transforming...", Project::MSG_VERBOSE);
$this->transformFiles();
}
示例4: run
/**
* Runs phpDocumentor 2
*/
public function run()
{
$this->initializePhpDocumentor();
$xml = $this->parseFiles();
$this->project->log("Transforming...", Project::MSG_VERBOSE);
$transformer = new phpDocumentor\Transformer\Transformer();
$transformer->setTemplatesPath($this->phpDocumentorPath . '/../data/templates');
$transformer->setTemplates($this->template);
$transformer->setSource($xml);
$transformer->setTarget($this->destDir->getAbsolutePath());
$transformer->execute();
}
示例5: main
/**
* The entry point for this class. Does some checking, then processes and
* performs the tasks for this target.
*/
public function main()
{
if ($this->testIfCondition() && $this->testUnlessCondition()) {
foreach ($this->children as $o) {
if ($o instanceof Task) {
// child is a task
$o->perform();
} else {
// child is a RuntimeConfigurable
$o->maybeConfigure($this->project);
}
}
} elseif (!$this->testIfCondition()) {
$this->project->log("Skipped target '" . $this->name . "' because property '" . $this->ifCondition . "' not set.", Project::MSG_VERBOSE);
} else {
$this->project->log("Skipped target '" . $this->name . "' because property '" . $this->unlessCondition . "' set.", Project::MSG_VERBOSE);
}
}
示例6: parse
/**
*
* @throws BuildException
* @return array
*/
public function parse()
{
$this->properties = array();
$contents = @file_get_contents($this->file);
if ($contents === false) {
$message = sprintf('Could not read file [%s].', $this->file);
throw new BuildException($message);
}
$lines = explode("\n", $contents);
$count = count($lines);
$isMultiLine = false;
for ($i = 0; $i < $count; $i++) {
$line = $lines[$i];
if ($isMultiLine) {
$isMultiLine = $this->extractContinuedValue($line);
} else {
$this->name = null;
$this->value = '';
$isMultiLine = $this->extractNameAndValue($line);
}
if ($this->name !== null && !$isMultiLine) {
if (array_key_exists($this->name, $this->properties)) {
$message = sprintf('Property [%s] overwritten: old value [%s], new value [%s].', $this->name, $this->properties[$this->name], $this->value);
$this->project->log($message, Project::MSG_WARN);
}
// Unescape backslashes.
$this->value = str_replace('\\\\', '\\', $this->value);
$this->properties[$this->name] = $this->value;
}
}
if ($isMultiLine) {
$message = sprintf('Last property looks like a multi-lined value, but end of file found. Name = [%s].', $this->name);
throw new BuildException($message);
}
return $this->properties;
}
示例7: createElement
/**
* Creates a named nested element.
*
* Valid creators can be in the form createFoo() or addFoo(Bar).
* @return object Returns the nested element.
* @throws BuildException
*/
function createElement(Project $project, $element, $elementName)
{
$addMethod = "add" . strtolower($elementName);
$createMethod = "create" . strtolower($elementName);
$nestedElement = null;
if (isset($this->nestedCreators[$createMethod])) {
$method = $this->nestedCreators[$createMethod];
try {
// try to invoke the creator method on object
$project->log(" -calling creator " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()", PROJECT_MSG_DEBUG);
$nestedElement = $method->invoke($element);
} catch (Exception $exc) {
throw new BuildException($exc);
}
} elseif (isset($this->nestedCreators[$addMethod])) {
$method = $this->nestedCreators[$addMethod];
// project components must use class hints to support the add methods
try {
// try to invoke the adder method on object
$project->log(" -calling adder " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()", PROJECT_MSG_DEBUG);
// we've already assured that correct num of params
// exist and that method is using class hints
$params = $method->getParameters();
$classname = null;
if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
// create a new instance of the object and add it via $addMethod
$nestedElement = new $classname();
$method->invoke($element, $nestedElement);
} catch (Exception $exc) {
throw new BuildException($exc);
}
} else {
$msg = $this->getElementName($project, $element) . " doesn't support the '{$elementName}' creator/adder.";
throw new BuildException($msg);
}
if ($nestedElement instanceof ProjectComponent) {
$nestedElement->setProject($project);
}
return $nestedElement;
}
示例8: log
/**
* Utility function for logging
*/
function log($level, $msg)
{
$this->project->log($level, $msg);
}
示例9: storeElement
/**
* Creates a named nested element.
*
* @param Project $project
* @param string $element
* @param string $child
* @param string|null $elementName
* @return void
* @throws BuildException
*/
public function storeElement($project, $element, $child, $elementName = null)
{
if ($elementName === null) {
return;
}
$storer = "addconfigured" . strtolower($elementName);
if (isset($this->nestedStorers[$storer])) {
$method = $this->nestedStorers[$storer];
try {
$project->log(" -calling storer " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()", Project::MSG_DEBUG);
$method->invoke($element, $child);
} catch (Exception $exc) {
throw new BuildException($exc);
}
}
}
示例10: log
/**
* Logs a message with the given priority.
*
* @param string $msg The message to be logged.
* @param integer $level The message's priority at this message should have
*
* @return void
*/
public function log($msg, $level = Project::MSG_INFO)
{
if ($this->project !== null) {
$this->project->log($msg, $level);
}
}