本文整理汇总了PHP中Report::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::start方法的具体用法?PHP Report::start怎么用?PHP Report::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
public function report()
{
$errors = count($this->errors['sku']) + count($this->errors['name']);
$success = count($this->products) - $errors;
$tab = new Tabs();
$report = new Report();
$tab->start();
$tab->start("buttons");
$tab->button("info", false, true);
$success > 0 ? $tab->button("success", $success) : $tab->button("success");
$errors > 0 ? $tab->button("errors", $errors) : $tab->button("errors");
$tab->end("buttons");
$tab->start("entries");
$tab->entry("info", true);
$report->start("import data");
$report->entry("info", "info", "Products to be added: " . count($this->products));
$report->entry($errors > 0 ? "warning" : "success", $errors > 0 ? "warning" : "success", "Products added: {$success}");
$report->entry($errors > 0 ? "warning" : "info", $errors > 0 ? "warning" : "info", "Errors: {$errors}");
$report->entry("info", "info", "Clearing parsed data and import file");
if (unlink($_SESSION['upload_file'])) {
unset($_SESSION['upload_file']);
unset($_SESSION['products']);
$report->entry("success", "success", "Cleared parsed data");
}
if ($errors == 0) {
$report->entry("success", "success", "Import completed without errors");
} else {
$report->entry("warning", "warning", "Import completed with errors please review");
}
$report->end();
$tab->entry("end");
$tab->entry("success");
$report->start("Successful product creation");
foreach ($this->products as $key => $product) {
if (!in_array($product['sku'], $this->errors['sku']) && !in_array($product['name'], $this->errors['name'])) {
$report->entry("success", "product: {$key}", "Added: " . $product['name']);
}
}
if ($success == 0) {
$report->entry("info", "info", "No products we're added");
}
$report->end();
$tab->entry("end");
$tab->entry("errors");
if (count($this->errors['sku']) > 0) {
$report->start("Sku duplicates");
foreach ($this->products as $key => $product) {
if (in_array($product['sku'], $this->errors['sku'])) {
$report->entry("warning", "product: {$key}", "Failed to add product: " . $product['name'] . "<br />Due to duplicated sku: " . $product['sku'] . "<br/>Existing product: " . $this->duplicates[$product['sku']]);
}
}
$report->end();
}
if (count($this->errors['name']) > 0) {
$report->start("Name duplicates");
foreach ($this->products as $key => $product) {
if (in_array($product['name'], $this->errors['name'])) {
$report->entry("warning", "product: {$key}", "Failed to add product: " . $product['name'] . "<br />Due to not having a valid sku and provided name already exists<br/>Existing product: " . $product['sku']);
}
}
$report->end();
}
if ($errors == 0) {
$report->start("Import errors");
$report->entry("info", "info", "No products have errors");
$report->end();
}
$tab->entry("end");
$tab->end("entries");
$tab->end();
}
示例2: testReportTimerReturnsMilliSeconds
/**
* Tests that the timer method returns the expected result.
*
* @return void
*/
public function testReportTimerReturnsMilliSeconds()
{
$start = microtime(true);
$report = new Report();
$report->start();
usleep(50000);
// 50 Milli Seconds
$report->end();
$time = ceil((microtime(true) - $start) * 1000.0);
$this->assertGreaterThanOrEqual(50.0, $report->getElapsedTimeInMillis());
$this->assertLessThanOrEqual($time, $report->getElapsedTimeInMillis());
}
示例3: processFiles
/**
* This method will process all files that can be found in the given input
* path. It will apply rules defined in the comma-separated <b>$ruleSets</b>
* argument. The result will be passed to all given renderer instances.
*
* @param string $inputPath
* @param string $ruleSets
* @param \PHPMD\AbstractRenderer[] $renderers
* @param \PHPMD\RuleSetFactory $ruleSetFactory
* @return void
*/
public function processFiles($inputPath, $ruleSets, array $renderers, RuleSetFactory $ruleSetFactory)
{
// Merge parsed excludes
$this->ignorePatterns = array_merge($this->ignorePatterns, $ruleSetFactory->getIgnorePattern($ruleSets));
$this->input = $inputPath;
$report = new Report();
$factory = new ParserFactory();
$parser = $factory->create($this);
foreach ($ruleSetFactory->createRuleSets($ruleSets) as $ruleSet) {
$parser->addRuleSet($ruleSet);
}
$report->start();
$parser->parse($report);
$report->end();
foreach ($renderers as $renderer) {
$renderer->start();
}
foreach ($renderers as $renderer) {
$renderer->renderReport($report);
}
foreach ($renderers as $renderer) {
$renderer->end();
}
$this->violations = !$report->isEmpty();
}
示例4: check_flux
public function check_flux()
{
$report = new Report();
$report->start("flux files");
$report->entry("info", "Flux Settings", "Off");
$report->entry("info", "Flux Settings", "Checking for existing files");
$files['Up'] = "../var/magmi-import/flux-up/Flux - {$this->collection_name}.csv";
$files['Down'] = "../var/magmi-import/flux-down/Flux - {$this->collection_name}.csv";
foreach ($files as $key => $file) {
if (is_file($file)) {
$report->entry("success", "{$key} File", "File exists, deleting file");
unlink($file);
} else {
$report->entry("default", "{$key} File", "File does not exist, doing nothing");
}
}
$report->end();
}
示例5: manage
public function manage()
{
global $db;
$blacklist = $db->select("blacklist");
$report = new Report();
$report->start("words & phrases", 3);
if ($blacklist) {
foreach ($blacklist as $phrase) {
if (strpos($phrase['word'], " ") !== false) {
$format = "phrase";
} else {
$format = "word";
}
$report->entry("default", $format, $phrase['word'] . "||<a class='btn btn-xs btn-danger' href='blacklist.php?d=" . $phrase['id'] . "' role='button'>delete</a>");
}
} else {
$report->entry("danger", "error", "You seriously need to sit down and think about your life.");
}
$report->end();
}
示例6: MageDB
///////////////////
// Start Script //
///////////////////
$mage_db = new MageDB();
$results = $mage_db->select("catalog_product_entity", null, "entity_id,sku");
if ($results) {
foreach ($results as $result) {
$mp[$result['entity_id']] = $result['sku'];
}
} else {
$mp = $results;
}
$ai = $mage_db->select("m2epro_amazon_listing_product", null, "listing_product_id,sku");
if ($mp and $ai) {
if ($_SESSION['display']) {
$report->start("Comparing Amazon Item Sku's to Products", 3);
}
foreach ($ai as $si) {
$result = $mage_db->select("m2epro_listing_product", $si['listing_product_id'], "product_id", 1);
$si['product_id'] = $result['product_id'];
if ($mp[$si['product_id']] !== $si['sku']) {
if ($_SESSION['display']) {
$entry = $mp[$si['product_id']] . "||" . $si['sku'];
$report->entry("warning", $si['product_id'], $entry);
} else {
$mage_db->delete("m2epro_amazon_listing_product", "`listing_product_id` = " . $si['listing_product_id']);
$mage_db->delete("m2epro_listing_product", $si['listing_product_id']);
$html->redirection("../scripts.php");
}
}
// else if($_SESSION['display']) {
示例7: isset
}
}
$_SESSION['display'] = isset($display) ? $display : true;
if ($_SESSION['display']) {
echo '<div class="container-fluid"><div class="row"><div class="col-xs-12 text-center"><h3>Running Redundant Category Cleanse</h3></div></div><hr /><div class="row"><div class="col-xs-6 col-xs-offset-3">';
}
///////////////////
// Start Script //
///////////////////
require "../../app/Mage.php";
Mage::register('isSecureArea', true);
umask(0);
Mage::app();
$categoryCollection = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('level', array('gteq' => 2));
//greater than root category id
$report->start("Deleting Empty Categories");
$deleted = 0;
foreach ($categoryCollection as $category) {
$cname = strtolower($category->getName());
if ($cname !== "ebay listings" and $cname !== "amazon listings") {
if ($category->getProductCount() === 0) {
$deleted++;
if (!$disable) {
$report->entry("success", $category->getName(), "Deleted");
$category->delete();
} else {
$report->entry("info", $category->getName(), $category->getProductCount());
}
} else {
$report->entry("info", $category->getName(), $category->getProductCount());
}