• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ludovicm67 / php-strings / 15322127256

29 May 2025 10:44AM UTC coverage: 100.0%. Remained the same
15322127256

push

github

ludovicm67
chore: remove php-coveralls

23 of 23 relevant lines covered (100.0%)

1.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Strings.php
1
<?php
2

3
namespace ludovicm67\Strings;
4

5
/**
6
 * Strings is a class to manipulate strings easily
7
 */
8
class Strings {
9

10
  /**
11
   * Clean a string
12
   *
13
   * @param string $string the string to clean
14
   * @return string cleaned string
15
   */
16
  static function clean(string $string): string {
1✔
17
    return stripslashes(
1✔
18
      trim(
1✔
19
        htmlspecialchars(
1✔
20
          addslashes(
1✔
21
            html_entity_decode($string)
1✔
22
          )
1✔
23
        )
1✔
24
      )
1✔
25
    );
1✔
26
  }
27

28
  /**
29
   * Unconvert a string from camelCase
30
   *
31
   * @param string $string the string to unconvert
32
   * @return string unconverted string
33
   */
34
  static function fromCamelCase(string $string): string {
2✔
35
    return strtolower(
2✔
36
      preg_replace(
2✔
37
        ['/([a-z\d])([A-Z])/', '/([^-])([A-Z][a-z])/'],
2✔
38
        '$1-$2',
2✔
39
        $string)
2✔
40
    );
2✔
41
  }
42

43
  /**
44
   * Convert a string to camelCase
45
   *
46
   * @param string $string the string to convert to camelCase
47
   * @return string string converted to camelCase
48
   */
49
  static function toCamelCase(string $string): string {
1✔
50
    return lcfirst(
1✔
51
      str_replace(' ', '', ucwords(
1✔
52
        str_replace('-', ' ', self::fromCamelCase($string))
1✔
53
      ))
1✔
54
    );
1✔
55
  }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc