1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\DataDefinition\Definition\View;
14:
15: /**
16: * Format a model and create a listing child record.
17: *
18: * @package DcGeneral\DataDefinition\Definition\View
19: */
20: class DefaultModelFormatterConfig implements ModelFormatterConfigInterface
21: {
22: /**
23: * The used property names.
24: *
25: * @var array
26: */
27: protected $propertyNames = array();
28:
29: /**
30: * The format string.
31: *
32: * @var string
33: */
34: protected $format = '%s';
35:
36: /**
37: * The maximum length of the formatted string.
38: *
39: * @var int|null
40: */
41: protected $maxLength = null;
42:
43: /**
44: * {@inheritDoc}
45: */
46: public function setPropertyNames(array $propertyNames)
47: {
48: $this->propertyNames = $propertyNames;
49:
50: return $this;
51: }
52:
53: /**
54: * {@inheritDoc}
55: */
56: public function getPropertyNames()
57: {
58: return $this->propertyNames;
59: }
60:
61: /**
62: * {@inheritDoc}
63: */
64: public function setFormat($format)
65: {
66: $this->format = (string)$format;
67:
68: return $this;
69: }
70:
71: /**
72: * {@inheritDoc}
73: */
74: public function getFormat()
75: {
76: return $this->format;
77: }
78:
79: /**
80: * {@inheritDoc}
81: */
82: public function setMaxLength($maxLength)
83: {
84: $this->maxLength = ($maxLength !== null) ? (int)$maxLength : null;
85:
86: return $this;
87: }
88:
89: /**
90: * {@inheritDoc}
91: */
92: public function getMaxLength()
93: {
94: return $this->maxLength;
95: }
96: }
97: