Skip to content

Commit aff112a

Browse files
committed
Method name & code format for PSR/phpdoc compliance
1 parent d7a66ca commit aff112a

Some content is hidden

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

85 files changed

+1162
-71
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ This release marked the transformation to namespaces (PHP 5.3+).
88

99
### Features
1010

11-
None yet
11+
None yet.
1212

1313
### Bugfixes
1414

1515
- Preserve text doesn't render correctly when the text is not the first word, e.g. 'Page {PAGE}' - @ivanlanin
1616

1717
### Miscellaneous
1818

19-
- Documentation - @Progi1984
19+
- Move documentation to [Read The Docs](http://phpword.readthedocs.org/en/develop/) - @Progi1984 @ivanlanin GH-82
20+
- Reorganize and redesign samples folder - @ivanlanin GH-137
21+
- Use `PhpOffice\PhpWord` namespace for PSR compliance - @RomanSyroeshko @gabrielbull GH-159 GH-58
22+
- Restructure folders and change folder name `Classes` to `src` and `Tests` to `test` for PSR compliance - @RomanSyroeshko @gabrielbull
23+
- Compliance to phpDocumentor - @ivanlanin
2024

2125
## 0.8.1 - 17 Mar 2014
2226

docs/setup.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ Manual install
4747
To install manually, `download PHPWord package from
4848
github <https://github.com/PHPOffice/PHPWord/archive/master.zip>`__.
4949
Extract the package and put the contents to your machine. To use the
50-
library, include ``src/PhpWord/PhpWord.php`` in your script like below.
50+
library, include ``src/PhpWord/Autoloader.php`` in your script and
51+
invoke ``Autoloader::register``.
5152

5253
.. code-block:: php
5354
54-
require_once '/path/to/src/PhpWord/PhpWord.php';
55+
require_once '/path/to/src/PhpWord/Autoloader.php';
56+
PhpOffice\PhpWord\Autoloader::register();
5557
5658
Using samples
5759
-------------

samples/Sample_07_TemplateCloneRow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
$document->setValue('userName#3', 'Ray');
5454
$document->setValue('userPhone#3', '+1 428 889 775');
5555

56-
$name = 'Sample_07_TemplateCloneRow_result.docx';
56+
$name = 'Sample_07_TemplateCloneRow.docx';
5757
echo date('H:i:s'), " Write to Word2007 format", \EOL;
5858
$document->saveAs($name);
5959
rename($name, "results/{$name}");

samples/Sample_Header.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
error_reporting(E_ALL);
66
define('CLI', (PHP_SAPI == 'cli') ? true : false);
77
define('EOL', CLI ? PHP_EOL : '<br />');
8-
require_once '../src/PhpWord/PhpWord.php';
8+
9+
require_once '../src/PhpWord/Autoloader.php';
10+
PhpOffice\PhpWord\Autoloader::register();
11+
912
// Return to the caller script when runs by CLI
1013
if (CLI) {
1114
return;

src/PhpWord/Autoloader.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@
2525

2626
namespace PhpOffice\PhpWord;
2727

28+
/**
29+
* Autoloader
30+
*/
2831
class Autoloader
2932
{
3033
const NAMESPACE_PREFIX = 'PhpOffice\\PhpWord\\';
3134

3235
/**
36+
* Register
37+
*
3338
* @return void
3439
*/
3540
public static function register()
@@ -38,6 +43,8 @@ public static function register()
3843
}
3944

4045
/**
46+
* Autoload
47+
*
4148
* @param string $class
4249
*/
4350
public static function autoload($class)
@@ -51,4 +58,4 @@ public static function autoload($class)
5158
}
5259
}
5360
}
54-
}
61+
}

src/PhpWord/DocumentProperties.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace PhpOffice\PhpWord;
2727

28+
/**
29+
* Document properties
30+
*/
2831
class DocumentProperties
2932
{
3033
/** Constants */

src/PhpWord/Exceptions/Exception.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
namespace PhpOffice\PhpWord\Exceptions;
2828

29+
/**
30+
* General exception
31+
*/
2932
class Exception extends \Exception
3033
{
3134
}

src/PhpWord/Footnote.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace PhpOffice\PhpWord;
2727

28+
/**
29+
* Footnote
30+
*/
2831
class Footnote
2932
{
3033
/**

src/PhpWord/HashTable.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
use PhpOffice\PhpWord\Exceptions\Exception;
2929

3030
/**
31+
* Hash table
32+
*
3133
* @codeCoverageIgnore Legacy from PHPExcel
3234
*/
3335
class HashTable
@@ -47,6 +49,8 @@ class HashTable
4749
public $_keyMap = array();
4850

4951
/**
52+
* Create new
53+
*
5054
* @param \PhpOffice\PhpWord\IComparable[] $pSource Optional source array to create HashTable from
5155
*/
5256
public function __construct($pSource = null)
@@ -140,6 +144,8 @@ public function clear()
140144
}
141145

142146
/**
147+
* Get item count
148+
*
143149
* @return int
144150
*/
145151
public function count()
@@ -148,6 +154,8 @@ public function count()
148154
}
149155

150156
/**
157+
* Get hash code index
158+
*
151159
* @param string $pHashCode
152160
* @return int Index
153161
*/
@@ -157,6 +165,8 @@ public function getIndexForHashCode($pHashCode = '')
157165
}
158166

159167
/**
168+
* Get by index
169+
*
160170
* @param int $pIndex
161171
* @return \PhpOffice\PhpWord\IComparable
162172
*/
@@ -170,6 +180,7 @@ public function getByIndex($pIndex = 0)
170180
}
171181

172182
/**
183+
* Get by hashcode
173184
* @param string $pHashCode
174185
* @return \PhpOffice\PhpWord\IComparable
175186
*
@@ -184,6 +195,8 @@ public function getByHashCode($pHashCode = '')
184195
}
185196

186197
/**
198+
* Convert to array
199+
*
187200
* @return \PhpOffice\PhpWord\IComparable[]
188201
*/
189202
public function toArray()

src/PhpWord/IOFactory.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@
2727

2828
use PhpOffice\PhpWord\Exceptions\Exception;
2929

30+
/**
31+
* IO factory
32+
*/
3033
abstract class IOFactory
3134
{
3235
/**
36+
* Create new writer
37+
*
3338
* @param \PhpOffice\PhpWord\PhpWord $phpWord
3439
* @param string $name
3540
* @return \PhpOffice\PhpWord\Writer\IWriter
@@ -46,6 +51,8 @@ public static function createWriter(PhpWord $phpWord, $name)
4651
}
4752

4853
/**
54+
* Create new reader
55+
*
4956
* @param string $name
5057
* @return \PhpOffice\PhpWord\Reader\IReader
5158
* @throws \PhpOffice\PhpWord\Exceptions\Exception

0 commit comments

Comments
 (0)