/** * @param string|null $fieldName * @param string[] $filenames CSVファイルと同梱されているファイルの一覧。文字列キーが存在すれば、変更前の名前を表します。 * @throws \DomainException フィールド名がimage、audio、videoのいずれでもないとき。 */ public function __construct(string $fieldName = null, array $filenames = []) { parent::__construct(); if (!is_null($fieldName)) { if (isset(FilenameValidator::EXTENSIONS[$fieldName])) { $this->fieldName = $fieldName; } else { throw new \DomainException(); } } $this->filenames = array_change_key_case($filenames); }
/** * @param string|null $fieldName * @param string[] $filenames すでに存在するファイル名の一覧。 * @param bool $checkExtension $fieldNameがnullの場合、拡張子の確認を行わないときは偽。 * @throws \DomainException フィールド名がimage、audio、videoのいずれでもないとき。 * または、$fieldNameがnull以外、かつ$checkExtensionが偽の場合。 */ public function __construct(string $fieldName = null, array $filenames = [], bool $checkExtension = true) { parent::__construct(); if (!is_null($fieldName)) { if (isset(static::EXTENSIONS[$fieldName])) { $this->fieldName = $fieldName; } else { throw new \DomainException(); } if (!$checkExtension) { throw new \DomainException(); } } $this->filenames = $filenames; $this->checkExtension = $checkExtension; }
/** * @param bool $realNumber 実数の矯正であれば真を指定。 */ public function __construct(bool $realNumber = false) { parent::__construct(); $this->realNumber = $realNumber; }