Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/diff/PhabricatorDocumentEngineBlocks.php
<?php | <?php | ||||
final class PhabricatorDocumentEngineBlocks | final class PhabricatorDocumentEngineBlocks | ||||
extends Phobject { | extends Phobject { | ||||
private $lists = array(); | private $lists = array(); | ||||
private $messages = array(); | |||||
public function addMessage($message) { | |||||
$this->messages[] = $message; | |||||
return $this; | |||||
} | |||||
public function getMessages() { | |||||
return $this->messages; | |||||
} | |||||
public function addBlockList(PhabricatorDocumentRef $ref, array $blocks) { | public function addBlockList(PhabricatorDocumentRef $ref, array $blocks) { | ||||
assert_instances_of($blocks, 'PhabricatorDocumentEngineBlock'); | assert_instances_of($blocks, 'PhabricatorDocumentEngineBlock'); | ||||
$this->lists[] = array( | $this->lists[] = array( | ||||
'ref' => $ref, | 'ref' => $ref, | ||||
'blocks' => array_values($blocks), | 'blocks' => array_values($blocks), | ||||
); | ); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function newTwoUpLayout() { | public function newTwoUpLayout() { | ||||
$rows = array(); | $rows = array(); | ||||
$lists = $this->lists; | $lists = $this->lists; | ||||
if (count($lists) != 2) { | |||||
return array(); | |||||
} | |||||
$specs = array(); | $specs = array(); | ||||
foreach ($this->lists as $list) { | foreach ($this->lists as $list) { | ||||
$specs[] = $this->newDiffSpec($list['blocks']); | $specs[] = $this->newDiffSpec($list['blocks']); | ||||
} | } | ||||
$old_map = $specs[0]['map']; | $old_map = $specs[0]['map']; | ||||
$new_map = $specs[1]['map']; | $new_map = $specs[1]['map']; | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |