Skip to content
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

Added method isTemplateString #2

Merged
merged 1 commit into from
Apr 30, 2019
Merged

Added method isTemplateString #2

merged 1 commit into from
Apr 30, 2019

Conversation

mcaskill
Copy link
Member

The very simple method allows template loaders to validate if a given value is maybe the contents of a template or just a template identifier (file path).

Prevents the loader from passing what could be a raw template through further procedures meant for a template identifier.

@mducharme
Copy link
Member

I'm ok with the implementation but we got to find a better name... :P

isFile
isLoadable
isSourceString
...?

@coveralls
Copy link

coveralls commented Jan 18, 2017

Coverage Status

Coverage increased (+0.07%) to 94.048% when pulling 0395a6e on mcaskill-patch-2 into 42fc85f on master.

@mcaskill
Copy link
Member Author

I was initially calling it isTemplateLoaded() but I thought since this might not be true 100% of the time.

@mducharme
Copy link
Member

What about isLoadable or isTemplateFile..?

@mcaskill
Copy link
Member Author

It could be. The methods would then need to be:

AbstractLoader

protected function isTemplateFile($ident)
{
    return strpos($ident, PHP_EOL) === false;
}

MustacheLoader

protected function isTemplateFile($ident)
{
    return strpos($ident, '{{') === false && parent::isTemplateFile($ident);
}

@mcaskill mcaskill changed the title Added ‘isTemplateMaybeLoaded’ method Added method isTemplateString Apr 30, 2019
This simple method allows template loaders to validate if a given value is maybe the contents of a template or just a template identifier (file path).
@mcaskill mcaskill requested a review from mducharme April 30, 2019 19:59
@mducharme mducharme merged commit 9d745d7 into master Apr 30, 2019
@mducharme mducharme deleted the mcaskill-patch-2 branch July 3, 2019 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants