2016-10-13 13:11:22 -04:00
|
|
|
<?php declare(strict_types=1);
|
2016-08-04 14:55:37 -04:00
|
|
|
/**
|
|
|
|
* Ion
|
|
|
|
*
|
|
|
|
* Building blocks for web development
|
|
|
|
*
|
2018-01-17 12:45:58 -05:00
|
|
|
* PHP version 7.1
|
2016-08-26 23:10:20 -04:00
|
|
|
*
|
2016-08-04 14:55:37 -04:00
|
|
|
* @package Ion
|
2016-08-26 23:10:20 -04:00
|
|
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
2018-01-17 12:45:58 -05:00
|
|
|
* @copyright 2015 - 2018 Timothy J. Warren
|
2016-08-26 23:10:20 -04:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
2018-01-17 16:35:01 -05:00
|
|
|
* @version 2.3.0
|
2016-08-26 23:10:20 -04:00
|
|
|
* @link https://git.timshomepage.net/timw4mail/ion
|
2016-08-04 14:55:37 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Aviat\Ion\Type;
|
|
|
|
|
|
|
|
use Stringy\Stringy;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrapper around Stringy
|
|
|
|
*/
|
|
|
|
class StringType extends Stringy {
|
|
|
|
|
2017-09-13 16:43:58 -04:00
|
|
|
/**
|
2018-01-17 16:33:57 -05:00
|
|
|
* See if two strings match, despite being delimited differently,
|
2017-09-13 16:43:58 -04:00
|
|
|
* such as camelCase, PascalCase, kebab-case, or snake_case.
|
|
|
|
*
|
|
|
|
* @param string $strToMatch
|
2018-01-17 12:43:44 -05:00
|
|
|
* @throws \InvalidArgumentException
|
2017-09-13 16:43:58 -04:00
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function fuzzyCaseMatch(string $strToMatch): bool
|
|
|
|
{
|
2018-01-17 12:43:44 -05:00
|
|
|
$firstStr = self::create($this->str)->dasherize()->__toString();
|
|
|
|
$secondStr = self::create($strToMatch)->dasherize()->__toString();
|
2017-09-13 16:43:58 -04:00
|
|
|
|
|
|
|
return $firstStr === $secondStr;
|
|
|
|
}
|
2016-08-04 14:55:37 -04:00
|
|
|
}
|
|
|
|
// End of StringType.php
|