<?php
namespace App\Sabre\LineParser\Types;

class Integer extends \App\Utils\BaseParser\TextParser\Types\Integer
{
	protected $extractRegexp = "/^(?P<rawData>[0-9 ]__LENGHTS__)/";

	/**
	 * (non-PHPdoc)
	 * @see \App\Utils\BaseParser\TextParser\BlockRegexpAbstract::formatExtractedData()
	 */
	protected function formatExtractedData($str, $matchesObj)
	{
		if (ltrim($str, ' ')==='') {
			return '';
		}
		elseif (ltrim($str, '0')!=='') {
			return (int)$str;
		}
		else {
			return 0;
		}

		return null; //???
	}
}
