You are here

protected function LinkToFileConstraint::hasExtension in File Link 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Validation/Constraint/LinkToFileConstraint.php \Drupal\file_link\Plugin\Validation\Constraint\LinkToFileConstraint::hasExtension()

Check whereas given URL has an extension.

Parameters

string $url: URL.

Return value

bool Whereas given URL has an extension.

1 call to LinkToFileConstraint::hasExtension()
LinkToFileConstraint::validate in src/Plugin/Validation/Constraint/LinkToFileConstraint.php
Checks if the passed value is valid.

File

src/Plugin/Validation/Constraint/LinkToFileConstraint.php, line 131

Class

LinkToFileConstraint
Validation constraint for file_link, checking that URI points to a file.

Namespace

Drupal\file_link\Plugin\Validation\Constraint

Code

protected function hasExtension($url) {
  return !empty(pathinfo($this
    ->getPath($url), PATHINFO_EXTENSION));
}