<?php
namespace App\Utils\BaseParser\TextParser\Types;

/**
 * Integer number
 * @author Lucian Sirbu
 *
 */
class Integer extends \App\Utils\BaseParser\TextParser\BlockRegexpAbstract
{
	protected $extractRegexp = "/^(?P<rawData>[0-9\s]__LENGHTS__)/";

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

		return null; //???
	}
}
