Skip to content

Commit

Permalink
Merge pull request #20 from zzgab/3.x
Browse files Browse the repository at this point in the history
split adhoc parts in attr
  • Loading branch information
zzgab committed Feb 27, 2017
2 parents 21dd041 + 5059430 commit f0b7b2e
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 168 deletions.
11 changes: 11 additions & 0 deletions src/figdice/classes/AdHoc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
namespace figdice\classes;

class AdHoc
{
public $string;
public function __construct($string)
{
$this->string = $string;
}
}
37 changes: 8 additions & 29 deletions src/figdice/classes/Iteration.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
<?php
/**
* @author Gabriel Zerbib <gabriel@figdice.org>
* @copyright 2004-2014, Gabriel Zerbib.
* @version 2.0.4
* @package FigDice
*
* This file is part of FigDice.
*
* FigDice is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* FigDice is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FigDice. If not, see <http://www.gnu.org/licenses/>.
*/

namespace figdice\classes;
Expand All @@ -41,19 +24,15 @@ public function __construct($count) {
$this->count = $count;
$this->position = 0;
}

/**
* To be called before each iteration,
* including for first element of collection.
*/
public function iterate($key = null) {

/**
* To be called before each iteration,
* including for first element of collection.
* @param mixed $key
*/
public function iterate($key) {
++ $this->position;
if( null !== $key) {
$this->key = $key;
}
else {
$this->key = $this->position;
}
$this->key = $key;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/figdice/classes/ViewElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,6 @@ public function getLineNumber() {
* @return string
*/
abstract public function render(Context $context);

abstract public function appendCDataSibling($cdata);
}
17 changes: 7 additions & 10 deletions src/figdice/classes/ViewElementCData.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@
namespace figdice\classes;

class ViewElementCData extends ViewElement implements \Serializable {
public function __construct() {
parent::__construct();
}
public function render(Context $context) {
return $this->outputBuffer;
}
public function appendCDataSibling($cdata) {
$this->outputBuffer .= $cdata;
}
public function render(Context $context) {
return $this->outputBuffer;
}
public function appendCDataSibling($cdata) {
$this->outputBuffer .= $cdata;
}

public function serialize()
public function serialize()
{
return serialize($this->outputBuffer);
}
Expand Down
Loading

0 comments on commit f0b7b2e

Please sign in to comment.