[ Index ]

PHP Cross Reference of PHK Manager

title

Body

[close]

/PHK/Build/ -> DataStacker.php (source)

   1  <?php
   2  //=============================================================================
   3  //
   4  // Copyright Francois Laupretre <phk@tekwire.net>
   5  //
   6  //   Licensed under the Apache License, Version 2.0 (the "License");
   7  //   you may not use this file except in compliance with the License.
   8  //   You may obtain a copy of the License at
   9  //
  10  //       http://www.apache.org/licenses/LICENSE-2.0
  11  //
  12  //   Unless required by applicable law or agreed to in writing, software
  13  //   distributed under the License is distributed on an "AS IS" BASIS,
  14  //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15  //   See the License for the specific language governing permissions and
  16  //   limitations under the License.
  17  //
  18  //=============================================================================
  19  /**
  20  * @copyright Francois Laupretre <phk@tekwire.net>
  21  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, V 2.0
  22  * @category PHK
  23  * @package PHK
  24  *///==========================================================================
  25  
  26  //=============================================================================
  27  /**
  28  * A utility class used only at package creation time.
  29  *
  30  * This class maintains a string buffer and appends strings to it, returning
  31  * the current offset. When every strings have been appended, returns the
  32  * resulting buffer.
  33  *///===========================================================================
  34  
  35  namespace PHK\Build {
  36  
  37  if (!class_exists('PHK\Build\DataStacker',false))
  38  {
  39  //============================================================================
  40  
  41  class DataStacker
  42  {
  43  public $offset;
  44  public $data;
  45  
  46  //---------
  47  
  48  public function __construct()
  49  {
  50  $this->offset=0;
  51  $this->data='';
  52  }
  53  
  54  //---------
  55  
  56  public function push($data)
  57  {
  58  $this->data .= $data;
  59  $ret_offset=$this->offset;
  60  $this->offset += strlen($data);
  61  return $ret_offset;
  62  }
  63  
  64  //---
  65  } // End of class
  66  //===========================================================================
  67  } // End of class_exists
  68  //===========================================================================
  69  } // End of namespace
  70  //===========================================================================
  71  ?>


Generated: Thu Jun 4 18:33:15 2015 Cross-referenced by PHPXref 0.7.1