Completed
Push — master ( dd6d00...52e4ba )
by Aimeos
03:58
created

Tcpdf::setFooterFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
nc 1
nop 1
dl 0
loc 4
c 1
b 0
f 0
cc 1
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2020
6
 * @package Client
7
 * @subpackage Html
8
 */
9
10
11
namespace Aimeos\Client\Html\Email\Payment\Pdf;
12
13
14
/**
15
 * Extended TCPDF class
16
 *
17
 * @package Client
18
 * @subpackage Html
19
 */
20
class Tcpdf extends \TCPDF
21
{
22
	private $headerFcn;
23
	private $footerFcn;
24
25
26
	/**
27
	 * Adds the footer to each page
28
	 */
29
	public function Footer()
30
	{
31
		if( $fcn = $this->footerFcn ) {
32
			$fcn( $this );
33
		}
34
	}
35
36
37
	/**
38
	 * Adds the header to each page
39
	 */
40
	public function Header()
41
	{
42
		if( $fcn = $this->headerFcn ) {
43
			$fcn( $this );
44
		}
45
	}
46
47
48
	/**
49
	 * Sets the anonymous function which adds the page footer
50
	 *
51
	 * @param \Closure $fcn Function that adds the page footer
52
	 * @return \Aimeos\Client\Html\Email\Payment\Pdf\Tcpdf Same object for method chaining
53
	 */
54
	public function setFooterFunction( \Closure $fcn )
55
	{
56
		$this->footerFcn = $fcn;
57
		return $this;
58
	}
59
60
61
	/**
62
	 * Sets the anonymous function which adds the page header
63
	 *
64
	 * @param \Closure $fcn Function that adds the page header
65
	 * @return \Aimeos\Client\Html\Email\Payment\Pdf\Tcpdf Same object for method chaining
66
	 */
67
	public function setHeaderFunction( \Closure $fcn )
68
	{
69
		$this->headerFcn = $fcn;
70
		return $this;
71
	}
72
}
73