master
parent
f55d317bcc
commit
0bcfa563c0
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 111 KiB |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
|
||||
if (\file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) { |
||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php'; |
||||
} |
||||
|
||||
spl_autoload_register(function ($class) { |
||||
$name = \str_replace('AlibabaCloud\\Client\\', '', $class); |
||||
$file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . \str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php'; |
||||
if (\file_exists($file)) { |
||||
require_once $file; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
}); |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
namespace AlibabaCloud\Client\Support; |
||||
|
||||
/** |
||||
* Class Stringy |
||||
* |
||||
* @package AlibabaCloud\Client\Support |
||||
*/ |
||||
class Stringy |
||||
{ |
||||
|
||||
private static function _value($value, $default = '') |
||||
{ |
||||
return null === $value ? $default : $value; |
||||
} |
||||
|
||||
/** |
||||
* @param string $str |
||||
* @param string $substr |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public static function contains($str, $substr) |
||||
{ |
||||
return false !== strpos(self::_value($str), self::_value($substr)); |
||||
} |
||||
|
||||
/** |
||||
* @param string $str |
||||
* @param string $substr |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public static function endsWith($str, $substr) |
||||
{ |
||||
$str = self::_value($str); |
||||
$substr = self::_value($substr); |
||||
$length = \strlen($substr); |
||||
if (!$length) { |
||||
return true; |
||||
} |
||||
|
||||
return substr($str, -$length) === $substr; |
||||
} |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue