Skip to content

Commit b6c33c8

Browse files
author
Gabriel Bull
committed
Formatted PHP code toward PSR-2 compliance
1 parent 3f7ed20 commit b6c33c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+10016
-9510
lines changed

src/PHPWord.php

Lines changed: 195 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727

2828
/** PHPWORD_BASE_PATH */
29-
if(!defined('PHPWORD_BASE_PATH')) {
29+
if (!defined('PHPWORD_BASE_PATH')) {
3030
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/');
3131
require PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php';
3232
PHPWord_Autoloader::Register();
@@ -40,191 +40,207 @@
4040
* @package PHPWord
4141
* @copyright Copyright (c) 2011 PHPWord
4242
*/
43-
class PHPWord {
44-
45-
/**
46-
* Document properties
47-
*
48-
* @var PHPWord_DocumentProperties
49-
*/
50-
private $_properties;
51-
52-
/**
53-
* Default Font Name
54-
*
55-
* @var string
56-
*/
57-
private $_defaultFontName;
58-
59-
/**
60-
* Default Font Size
61-
*
62-
* @var int
63-
*/
64-
private $_defaultFontSize;
65-
66-
/**
67-
* Collection of section elements
68-
*
69-
* @var array
70-
*/
71-
private $_sectionCollection = array();
72-
73-
74-
/**
75-
* Create a new PHPWord Document
76-
*/
77-
public function __construct() {
78-
$this->_properties = new PHPWord_DocumentProperties();
79-
$this->_defaultFontName = 'Arial';
80-
$this->_defaultFontSize = 20;
81-
}
82-
83-
/**
84-
* Get properties
85-
* @return PHPWord_DocumentProperties
86-
*/
87-
public function getProperties() {
88-
return $this->_properties;
89-
}
90-
91-
/**
92-
* Set properties
93-
*
94-
* @param PHPWord_DocumentProperties $value
95-
* @return PHPWord
96-
*/
97-
public function setProperties(PHPWord_DocumentProperties $value) {
98-
$this->_properties = $value;
99-
return $this;
100-
}
101-
102-
/**
103-
* Create a new Section
104-
*
105-
* @param PHPWord_Section_Settings $settings
106-
* @return PHPWord_Section
107-
*/
108-
public function createSection($settings = null) {
109-
$sectionCount = $this->_countSections() + 1;
110-
111-
$section = new PHPWord_Section($sectionCount, $settings);
112-
$this->_sectionCollection[] = $section;
113-
return $section;
114-
}
115-
116-
/**
117-
* Get default Font name
118-
* @return string
119-
*/
120-
public function getDefaultFontName() {
121-
return $this->_defaultFontName;
122-
}
123-
124-
/**
125-
* Set default Font name
126-
* @param string $pValue
127-
*/
128-
public function setDefaultFontName($pValue) {
129-
$this->_defaultFontName = $pValue;
130-
}
131-
132-
/**
133-
* Get default Font size
134-
* @return string
135-
*/
136-
public function getDefaultFontSize() {
137-
return $this->_defaultFontSize;
138-
}
139-
140-
/**
141-
* Set default Font size
142-
* @param int $pValue
143-
*/
144-
public function setDefaultFontSize($pValue) {
145-
$pValue = $pValue * 2;
146-
$this->_defaultFontSize = $pValue;
147-
}
148-
149-
/**
150-
* Adds a paragraph style definition to styles.xml
151-
*
152-
* @param $styleName string
153-
* @param $styles array
154-
*/
155-
public function addParagraphStyle($styleName, $styles) {
156-
PHPWord_Style::addParagraphStyle($styleName, $styles);
157-
}
158-
159-
/**
160-
* Adds a font style definition to styles.xml
161-
*
162-
* @param $styleName string
163-
* @param $styles array
164-
*/
165-
public function addFontStyle($styleName, $styleFont, $styleParagraph = null) {
166-
PHPWord_Style::addFontStyle($styleName, $styleFont, $styleParagraph);
167-
}
168-
169-
/**
170-
* Adds a table style definition to styles.xml
171-
*
172-
* @param $styleName string
173-
* @param $styles array
174-
*/
175-
public function addTableStyle($styleName, $styleTable, $styleFirstRow = null) {
176-
PHPWord_Style::addTableStyle($styleName, $styleTable, $styleFirstRow);
177-
}
178-
179-
/**
180-
* Adds a heading style definition to styles.xml
181-
*
182-
* @param $titleCount int
183-
* @param $styles array
184-
*/
185-
public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null) {
186-
PHPWord_Style::addTitleStyle($titleCount, $styleFont, $styleParagraph);
187-
}
188-
189-
/**
190-
* Adds a hyperlink style to styles.xml
191-
*
192-
* @param $styleName string
193-
* @param $styles array
194-
*/
195-
public function addLinkStyle($styleName, $styles) {
196-
PHPWord_Style::addLinkStyle($styleName, $styles);
197-
}
198-
199-
/**
200-
* Get sections
201-
* @return PHPWord_Section[]
202-
*/
203-
public function getSections() {
204-
return $this->_sectionCollection;
205-
}
206-
207-
/**
208-
* Get section count
209-
* @return int
210-
*/
211-
private function _countSections() {
212-
return count($this->_sectionCollection);
213-
}
214-
43+
class PHPWord
44+
{
45+
46+
/**
47+
* Document properties
48+
*
49+
* @var PHPWord_DocumentProperties
50+
*/
51+
private $_properties;
52+
53+
/**
54+
* Default Font Name
55+
*
56+
* @var string
57+
*/
58+
private $_defaultFontName;
59+
60+
/**
61+
* Default Font Size
62+
*
63+
* @var int
64+
*/
65+
private $_defaultFontSize;
66+
67+
/**
68+
* Collection of section elements
69+
*
70+
* @var array
71+
*/
72+
private $_sectionCollection = array();
73+
74+
75+
/**
76+
* Create a new PHPWord Document
77+
*/
78+
public function __construct()
79+
{
80+
$this->_properties = new PHPWord_DocumentProperties();
81+
$this->_defaultFontName = 'Arial';
82+
$this->_defaultFontSize = 20;
83+
}
84+
85+
/**
86+
* Get properties
87+
* @return PHPWord_DocumentProperties
88+
*/
89+
public function getProperties()
90+
{
91+
return $this->_properties;
92+
}
93+
94+
/**
95+
* Set properties
96+
*
97+
* @param PHPWord_DocumentProperties $value
98+
* @return PHPWord
99+
*/
100+
public function setProperties(PHPWord_DocumentProperties $value)
101+
{
102+
$this->_properties = $value;
103+
return $this;
104+
}
105+
106+
/**
107+
* Create a new Section
108+
*
109+
* @param PHPWord_Section_Settings $settings
110+
* @return PHPWord_Section
111+
*/
112+
public function createSection($settings = null)
113+
{
114+
$sectionCount = $this->_countSections() + 1;
115+
116+
$section = new PHPWord_Section($sectionCount, $settings);
117+
$this->_sectionCollection[] = $section;
118+
return $section;
119+
}
120+
121+
/**
122+
* Get default Font name
123+
* @return string
124+
*/
125+
public function getDefaultFontName()
126+
{
127+
return $this->_defaultFontName;
128+
}
129+
130+
/**
131+
* Set default Font name
132+
* @param string $pValue
133+
*/
134+
public function setDefaultFontName($pValue)
135+
{
136+
$this->_defaultFontName = $pValue;
137+
}
138+
139+
/**
140+
* Get default Font size
141+
* @return string
142+
*/
143+
public function getDefaultFontSize()
144+
{
145+
return $this->_defaultFontSize;
146+
}
147+
148+
/**
149+
* Set default Font size
150+
* @param int $pValue
151+
*/
152+
public function setDefaultFontSize($pValue)
153+
{
154+
$pValue = $pValue * 2;
155+
$this->_defaultFontSize = $pValue;
156+
}
157+
158+
/**
159+
* Adds a paragraph style definition to styles.xml
160+
*
161+
* @param $styleName string
162+
* @param $styles array
163+
*/
164+
public function addParagraphStyle($styleName, $styles)
165+
{
166+
PHPWord_Style::addParagraphStyle($styleName, $styles);
167+
}
168+
169+
/**
170+
* Adds a font style definition to styles.xml
171+
*
172+
* @param $styleName string
173+
* @param $styles array
174+
*/
175+
public function addFontStyle($styleName, $styleFont, $styleParagraph = null)
176+
{
177+
PHPWord_Style::addFontStyle($styleName, $styleFont, $styleParagraph);
178+
}
179+
180+
/**
181+
* Adds a table style definition to styles.xml
182+
*
183+
* @param $styleName string
184+
* @param $styles array
185+
*/
186+
public function addTableStyle($styleName, $styleTable, $styleFirstRow = null)
187+
{
188+
PHPWord_Style::addTableStyle($styleName, $styleTable, $styleFirstRow);
189+
}
190+
191+
/**
192+
* Adds a heading style definition to styles.xml
193+
*
194+
* @param $titleCount int
195+
* @param $styles array
196+
*/
197+
public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null)
198+
{
199+
PHPWord_Style::addTitleStyle($titleCount, $styleFont, $styleParagraph);
200+
}
201+
202+
/**
203+
* Adds a hyperlink style to styles.xml
204+
*
205+
* @param $styleName string
206+
* @param $styles array
207+
*/
208+
public function addLinkStyle($styleName, $styles)
209+
{
210+
PHPWord_Style::addLinkStyle($styleName, $styles);
211+
}
212+
213+
/**
214+
* Get sections
215+
* @return PHPWord_Section[]
216+
*/
217+
public function getSections()
218+
{
219+
return $this->_sectionCollection;
220+
}
221+
222+
/**
223+
* Get section count
224+
* @return int
225+
*/
226+
private function _countSections()
227+
{
228+
return count($this->_sectionCollection);
229+
}
230+
215231
/**
216232
* Load a Template File
217-
*
233+
*
218234
* @param string $strFilename
219235
* @return PHPWord_Template
220236
*/
221-
public function loadTemplate($strFilename) {
222-
if(file_exists($strFilename)) {
237+
public function loadTemplate($strFilename)
238+
{
239+
if (file_exists($strFilename)) {
223240
$template = new PHPWord_Template($strFilename);
224241
return $template;
225242
} else {
226-
trigger_error('Template file '.$strFilename.' not found.', E_ERROR);
243+
trigger_error('Template file ' . $strFilename . ' not found.', E_ERROR);
227244
}
228245
}
229-
}
230-
?>
246+
}

0 commit comments

Comments
 (0)