| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package dompdf |
| 4 |
* @link https://github.com/dompdf/dompdf |
| 5 |
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
| 6 |
*/ |
| 7 |
namespace Dompdf\Positioner; |
| 8 |
|
| 9 |
use Dompdf\FrameDecorator\AbstractFrameDecorator; |
| 10 |
|
| 11 |
/** |
| 12 |
* Base AbstractPositioner class |
| 13 |
* |
| 14 |
* Defines positioner interface |
| 15 |
* |
| 16 |
* @package dompdf |
| 17 |
*/ |
| 18 |
abstract class AbstractPositioner |
| 19 |
{ |
| 20 |
|
| 21 |
/** |
| 22 |
* @param AbstractFrameDecorator $frame |
| 23 |
*/ |
| 24 |
abstract function position(AbstractFrameDecorator $frame): void; |
| 25 |
|
| 26 |
/** |
| 27 |
* @param AbstractFrameDecorator $frame |
| 28 |
* @param float $offset_x |
| 29 |
* @param float $offset_y |
| 30 |
* @param bool $ignore_self |
| 31 |
*/ |
| 32 |
function move( |
| 33 |
AbstractFrameDecorator $frame, |
| 34 |
float $offset_x, |
| 35 |
float $offset_y, |
| 36 |
bool $ignore_self = false |
| 37 |
): void { |
| 38 |
[$x, $y] = $frame->get_position(); |
| 39 |
|
| 40 |
if (!$ignore_self) { |
| 41 |
$frame->set_position($x + $offset_x, $y + $offset_y); |
| 42 |
} |
| 43 |
|
| 44 |
foreach ($frame->get_children() as $child) { |
| 45 |
$child->move($offset_x, $offset_y); |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
|