-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reg exp patter is optionlity #88
base: master
Are you sure you want to change the base?
Reg exp patter is optionlity #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments on code.
/** | ||
* Constructor | ||
* | ||
* @param string $content - file content | ||
* @param string $encoding - encoding | ||
*/ | ||
public function __construct($content, $encoding = self::DEFAULT_ENCODING) | ||
public function __construct($content, $encoding = self::DEFAULT_ENCODING, array $regExpPatternReplace = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would like to pass in your own replaces, I guess it would make sense to merge our expected replaces with the user-ones, or at least pass the default ones by default:
public function __construct($content, $encoding = self::DEFAULT_ENCODING, array $regExpPatternReplace = array()) | |
public function __construct($content, $encoding = self::DEFAULT_ENCODING, array $regExpPatternReplace = array('@' => '\@')) |
@@ -104,6 +108,10 @@ public function __construct($content, $encoding = self::DEFAULT_ENCODING) | |||
|
|||
// parse rules - default state | |||
$this->prepareRules(); | |||
|
|||
$this->regExpPatternReplace = empty($regExpPatternReplace) | |||
? array('@' => '\@') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you would want to replace it but not merge? Could you please provide a test for this case?
No description provided.