| author | cavaliet |
| Wed, 16 May 2012 12:46:58 +0200 | |
| changeset 89 | 8175fa8d5812 |
| parent 39 | 03b14b0fe101 |
| permissions | -rw-r--r-- |
|
39
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
/* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
* This software consists of voluntary contributions made by many individuals |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
* and is licensed under the LGPL. For more information, see |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
* <http://www.doctrine-project.org>. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
*/ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
|
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
namespace Doctrine\DBAL\Migrations; |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
|
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
/** |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
* Simple class for outputting information from migrations. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
* @link www.doctrine-project.org |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
* @since 2.0 |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
* @author Jonathan H. Wage <jonwage@gmail.com> |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
*/ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
class OutputWriter |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
{ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
private $closure; |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
|
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
public function __construct(\Closure $closure = null) |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
{ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
if ($closure === null) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
$closure = function($message) {}; |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
$this->closure = $closure; |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
|
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
/** |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
* Write output using the configured closure. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
* @param string $message The message to write. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
*/ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
public function write($message) |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
{ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
$closure = $this->closure; |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
$closure($message); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
} |