Skip to content

Commit

Permalink
PHP CS Fixer (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Feb 27, 2017
1 parent 83020d9 commit 82cf6c1
Show file tree
Hide file tree
Showing 191 changed files with 148 additions and 391 deletions.
7 changes: 3 additions & 4 deletions packages/migration_tool/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public function uninstall()
$db = \Database::connection();
$db->Execute('SET foreign_key_checks = 0');
$tables = $db->GetCol("show tables like 'MigrationImport%'");
foreach($tables as $table) {
foreach ($tables as $table) {
$db->Execute('drop table ' . $table);
}
$tables = $db->GetCol("show tables like 'MigrationExport%'");
foreach($tables as $table) {
foreach ($tables as $table) {
$db->Execute('drop table ' . $table);
}
$db->Execute('SET foreign_key_checks = 1');
Expand Down Expand Up @@ -122,9 +122,8 @@ protected function installSinglePages($pkg)

public function on_start()
{

require $this->getPackagePath() . '/helpers.php';

\Core::bind('migration/batch/page/validator', function ($app, $batch) {
if (isset($batch[0])) {
$v = new Validator($batch[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function export_batch_xml($id = null)
} else {
header('Content-type: text/xml');
}
print $exporter->getElement()->asXML();
echo $exporter->getElement()->asXML();
exit;
} else {
$this->view();
Expand Down Expand Up @@ -216,7 +216,7 @@ public function add_to_batch($id = null)
}
}
$drivers = $exporters->getDrivers();
usort($drivers, function($a, $b) {
usort($drivers, function ($a, $b) {
return strcasecmp($a->getPluralDisplayName(), $b->getPluralDisplayName());
});
$this->set('drivers', $drivers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\PublisherRoutineProcessor;
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\Target;
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\TargetItemProcessor;
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\Task\MapContentTypesTask;
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\Task\NormalizePagePathsTask;
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\Task\TransformContentTypesTask;
use PortlandLabs\Concrete5\MigrationTool\Batch\Processor\UntransformedItemProcessor;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Publisher;
use PortlandLabs\Concrete5\MigrationTool\Entity\Import\Batch;
use PortlandLabs\Concrete5\MigrationTool\Importer\FileParser as Parser;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down Expand Up @@ -156,14 +153,12 @@ public function add_content_to_batch()
$this->entityManager->flush();

return new JsonResponse($batch);

} else {
return $this->app->make('helper/ajax')->sendError($this->error);
}
$this->app->shutdown();
}


public function run_batch_content_normalize_page_paths_task()
{
if (!$this->token->validate('run_batch_content_normalize_page_paths_task')) {
Expand All @@ -180,6 +175,7 @@ public function run_batch_content_normalize_page_paths_task()
$processor->registerTask(new NormalizePagePathsTask());
$processor->process();
$this->entityManager->flush();

return new JsonResponse($batch);
}
$this->view();
Expand Down Expand Up @@ -216,6 +212,7 @@ public function run_batch_content_map_content_types_task()
$response = ob_get_contents();
ob_end_clean();
$response = new \Concrete\Core\Http\Response($response);

return $response;
}
$this->view();
Expand Down Expand Up @@ -252,12 +249,12 @@ public function run_batch_content_transform_content_types_task()
$response = ob_get_contents();
ob_end_clean();
$response = new \Concrete\Core\Http\Response($response);

return $response;
}
$this->view();
}


public function create_content_from_batch()
{
if (!$this->token->validate('create_content_from_batch')) {
Expand Down Expand Up @@ -289,6 +286,7 @@ public function create_content_from_batch()
$response = ob_get_contents();
ob_end_clean();
$response = new \Concrete\Core\Http\Response($response);

return $response;
}
$this->view();
Expand All @@ -302,7 +300,6 @@ protected function clearQueues()
$queue->deleteQueue();
$queue = \Concrete\Core\Foundation\Queue\Queue::get('target_item_processor');
$queue->deleteQueue();

}

public function view()
Expand Down Expand Up @@ -370,7 +367,7 @@ public function upload_files()
$response = $ih->import($_FILES['file']['tmp_name'], $_FILES['file']['name']);
if (!($response instanceof \Concrete\Core\File\Version) && !compat_is_version_8()) {
throw new \Exception(Importer::getErrorMessage($response));
} else if (!($response instanceof \Concrete\Core\Entity\File\Version) && compat_is_version_8()) {
} elseif (!($response instanceof \Concrete\Core\Entity\File\Version) && compat_is_version_8()) {
throw new \Exception(Importer::getErrorMessage($response));
} else {
$file = $response->getFile();
Expand Down Expand Up @@ -413,7 +410,7 @@ public function save_mapping()

$mappers = \Core::make('migration/manager/mapping');
/**
* @var $mappers MapperManagerInterface
* @var MapperManagerInterface
*/
$mapper = $mappers->driver($this->request->request->get('mapper'));
if (!is_object($mapper)) {
Expand Down
19 changes: 11 additions & 8 deletions packages/migration_tool/elements/batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,20 @@
<div class="ccm-tab-content" id="ccm-tab-content-batch-content">

<?php foreach ($batch->getObjectCollections() as $collection) {
if ($collection->hasRecords()) {
$formatter = $collection->getFormatter();
?>
if ($collection->hasRecords()) {
$formatter = $collection->getFormatter();
?>

<h3><?=$formatter->getPluralDisplayName()?></h3>
<?php print $formatter->displayObjectCollection()?>
<?php echo $formatter->displayObjectCollection()?>
<?php
}
?>

}
?>
<?php
}
?>

}
?>

</div>

Expand All @@ -80,6 +82,7 @@
?>
<p><?=t('This content batch is empty.')?></p>
<?php

}
?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<td><?=$group->getName()?></td>
<td><?=$group->getPath()?></td>
<?php

} ?>
</tbody>
</table>
9 changes: 6 additions & 3 deletions packages/migration_tool/helpers.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
<?php

defined('C5_EXECUTE') or die("Access Denied.");

if (!function_exists('compat_is_version_8')) {
function compat_is_version_8() {
function compat_is_version_8()
{
return interface_exists('\Concrete\Core\Export\ExportableInterface');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</div>


<?php print $formatter->displaySearchResults();
<?php echo $formatter->displaySearchResults();
?>

<?php
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date');
/** @var \Concrete\Core\Localization\Service\Date $dh */
/* @var \Concrete\Core\Localization\Service\Date $dh */
?>
<div class="ccm-dashboard-header-buttons btn-group">
<a href="<?=$view->action('view_batch', $batch->getID())?>" class="btn btn-default"><i class="fa fa-angle-double-left"></i> <?=t('Back to Batch')?></a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
<?php

defined('C5_EXECUTE') or die("Access Denied.");
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date');
/** @var \Concrete\Core\Localization\Service\Date $dh */
/* @var \Concrete\Core\Localization\Service\Date $dh */

?>
<div class="ccm-dashboard-header-buttons">
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
<?php

defined('C5_EXECUTE') or die("Access Denied.");
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date');
/** @var \Concrete\Core\Localization\Service\Date $dh */
/* @var \Concrete\Core\Localization\Service\Date $dh */
?>
<div class="ccm-dashboard-header-buttons">
<a href="<?=$view->action('view_batch', $batch->getID())?>" class="btn btn-default"><i class="fa fa-angle-double-left"></i> <?=t('Back to Batch')?></a>
Expand Down Expand Up @@ -46,18 +46,20 @@
?>

<?php if (count($targetItemList->getMapperCorePropertyTargetItems())) {
?>
?>
<optgroup label="** <?=t('Installed %s', $mapper->getMappedItemPluralName())?>"></optgroup>
<?php foreach ($targetItemList->getMapperCorePropertyTargetItems() as $targetItem) {
?>
?>
<option <?php if (is_object($selectedTargetItem) && $selectedTargetItem->matches($targetItem)) {
?>selected="selected" <?php
}
?> value="<?=$targetItem->getItemID()?>"><?=$targetItem->getItemName()?></option>
?>selected="selected" <?php

}
?> value="<?=$targetItem->getItemID()?>"><?=$targetItem->getItemName()?></option>
<?php
}
}
?>

}
}
?>


<?php if (count($targetItemList->getMapperInstalledTargetItems())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
<?php

defined('C5_EXECUTE') or die("Access Denied.");
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date');
/** @var \Concrete\Core\Localization\Service\Date $dh */
/* @var \Concrete\Core\Localization\Service\Date $dh */
?>
<div class="ccm-dashboard-header-buttons">
<div class="btn-group" role="group" aria-label="...">
Expand All @@ -17,6 +17,7 @@
?>
<li><a href="<?=$view->action('map_content', $batch->getId(), $mapper->getHandle())?>"><?=$mapper->getMappedItemPluralName()?></a></li>
<?php

} ?>
<?php /*
<li><a href="<?=$view->action('find_and_replace', $batch->getID())?>"><?=t("Find and Replace")?></a></li>
Expand Down Expand Up @@ -135,15 +136,19 @@
<h2><?=t('Batch')?>
<small><?=$dh->formatDateTime($batch->getDate(), true)?></small></h2>

<?php if ($batch->getNotes()) { ?>
<?php if ($batch->getNotes()) {
?>
<p><?=$batch->getNotes()?></p>
<?php
}

}
?>

<?php Loader::element('batch', array('batch' => $batch), 'migration_tool'); ?>
<?php Loader::element('batch', array('batch' => $batch), 'migration_tool');
?>

<?php } ?>
<?php
} ?>


<script type="text/javascript">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date');
/** @var \Concrete\Core\Localization\Service\Date $dh */
/* @var \Concrete\Core\Localization\Service\Date $dh */
?>

<div class="ccm-dashboard-header-buttons">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date');
/** @var \Concrete\Core\Localization\Service\Date $dh */
/* @var \Concrete\Core\Localization\Service\Date $dh */
?>
<div class="ccm-dashboard-header-buttons">
<div class="btn-group" role="group">
Expand Down Expand Up @@ -56,7 +56,7 @@
?>

<h3><?=$itemType->getPluralDisplayName()?></h3>
<?php print $formatter->displayBatchResults()?>
<?php echo $formatter->displayBatchResults()?>
<?php
}
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

interface BatchInterface
{

function getObjectCollections();
function getObjectCollection($collection);

public function getObjectCollections();
public function getObjectCollection($collection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

class EmptyMapper implements MapperInterface, TransformableEntityMapperInterface
{

public function getMappedItemPluralName()
{
return t('Empty');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

class Manager extends CoreManager implements MapperManagerInterface
{

public function createTargetItemList(BatchInterface $batch, MapperInterface $mapper)
{
return new TargetItemList($batch, $mapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

interface MapperManagerInterface
{
function createTargetItemList(BatchInterface $batch, MapperInterface $mapper);
function createBatchTargetItem();
public function createTargetItemList(BatchInterface $batch, MapperInterface $mapper);
public function createBatchTargetItem();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public function __construct(BatchInterface $batch, MapperInterface $mapper)
$this->repository = 'PortlandLabs\Concrete5\MigrationTool\Entity\Import\BatchTargetItem';
}


public function getMapperCorePropertyTargetItems()
{
return $this->mapper->getCorePropertyTargetItems($this->batch);
Expand All @@ -33,7 +32,6 @@ public function getMapperInstalledTargetItems()
return $this->mapper->getInstalledTargetItems($this->batch);
}


public function getMapperBatchTargetItems()
{
return $this->mapper->getBatchTargetItems($this->batch);
Expand Down
Loading

0 comments on commit 82cf6c1

Please sign in to comment.