Instead of making the properties private I feel that it would be easier to extend and manipulate the properties if they were protected.
From:
<?php
namespace App\Utilities;
use DivineOmega\uxdm\Objects\Sources\CSVSource as Base;
class GasCsvSource extends Base
{
/** @var $file */
protected $file;
/** @var array|string[] $fields */
protected $fields = [];
/** @var int $perPage */
protected $perPage = 20000;
/**
* @param $file
*/
public function __construct($file)
{
parent::__construct($file);
$this->file = $file;
$this->fields = [
// Custom fields
];
}
}
To:
<?php
namespace App\Utilities;
use DivineOmega\uxdm\Objects\Sources\CSVSource as Base;
class GasCsvSource extends Base
{
/** @var int $perPage */
protected $perPage = 20000;
/**
* @param $file
*/
public function __construct($file)
{
parent::__construct($file);
$this->file = $file;
$this->fields = [
// Custom fields
];
}
}
As a minimal example, you wouldn't have to re-declare the properties with a new scope. This is also useful for when changing the logic of getDataRows or getCSVLines in the case of a CSV as file is private and cannot be accessed in an extended class.
Instead of making the properties
private
I feel that it would be easier to extend and manipulate the properties if they wereprotected
.From:
To:
As a minimal example, you wouldn't have to re-declare the properties with a new scope. This is also useful for when changing the logic of
getDataRows
orgetCSVLines
in the case of a CSV asfile
isprivate
and cannot be accessed in an extended class.