コード例 #1
0
 /**
  * Creates a column with a preset value.
  * Length will be set to the length of the preset value.
  * @param String. Any passed value will be cast to a string. E.g. 0 will be cast to "0"
  * @param String An optional label for the column, used in error messages.
  * @return Column
  */
 public static function create($value, $label = '')
 {
     $value = (string) $value;
     $column = new Column();
     $column->setDefaultValue($value);
     $column->setLabel($label);
     return $column;
 }
 /**
  * Creates a column with a value from config file.
  * Length will be set to the length of the configured value.
  * @param Line the parent line
  * @param String. Config key. The resolved value will be cast to a string.
  * @param String An optional label for the column, used in error messages.
  * @return Column
  */
 public static function create($config, $config_key, $label = '')
 {
     if (!$config->has($config_key)) {
         throw new COSProcessorColumnException('Could not find the config option ' . $config_key);
     }
     $value = (string) $config->get($config_key);
     $column = new Column();
     $column->setLabel($label);
     $column->setValue($value);
     return $column;
 }
 /**
  * Creates a column with a string value that is left padded with zeros.
  * A string "100" with a length 7 will result in "0000100"
  * @param String. Any passed value will be cast to a string. E.g. 0 will be cast to "0"
  * @param int. The fixed length of the string
  * @param String An optional label for the column, used in error messages.
  * @return Column
  */
 public static function create($value, $length, $label = '')
 {
     $value = (string) $value;
     $column = new Column();
     $column->setFixedLength($length);
     $column->setLabel($label);
     $column->setValue($value);
     $column->setPaddingType(Column::PADDING_ZEROFILL_LEFT);
     return $column;
 }
 /**
  * This column has a fixed length and contains a decimal value without a delimiter.
  * E.g. with a length of 6 and a value of 10, the final value would be "001000"
  * @param String. Any passed value will be cast to a string. E.g. 0 will be cast to "0"
  * @param int. The fixed length of the string
  * @param String An optional label for the column, used in error messages.
  * @return Column
  */
 public static function create($value, $length, $label = '')
 {
     //need to test this thoroughly.
     $value = (string) (round($value, 2) * 100);
     $column = new Column();
     $column->setFixedLength($length);
     $column->setLabel($label);
     $column->setValue($value);
     $column->setPaddingType(Column::PADDING_ZEROFILL_LEFT);
     return $column;
 }
コード例 #5
0
 /**
  * @return mixed
  */
 public function getString()
 {
     return parent::getPaddedValue($this->date->format($this->format));
 }
コード例 #6
0
 /**
  * Returns an empty column. This is not padded
  * @param String An optional label for the column, used in error messages.
  * @return Column
  */
 public static function create($label = '')
 {
     $column = new Column();
     $column->setLabel($label);
     return $column;
 }