Skip to content

Commit

Permalink
Moved TODOs in code to tickets and credited sources in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
meszaros-lajos-gyorgy committed Apr 22, 2021
1 parent bde5c0b commit 8eed212
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,11 @@ Plus, sometimes the function name I would like to use is already taken by PHP, l
## Misc information

- ÁSÓ in hungarian means shovel

## Credits

https://www.geeksforgeeks.org/php-startswith-and-endswith-functions/ - used for S::startsWith() and S::endsWith()

https://stackoverflow.com/a/173479/1806628 - used for A::isAssoc()

https://www.php.net/manual/en/function.array-unique.php#116302 - used for A::uniqByKey()
7 changes: 2 additions & 5 deletions src/A.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public static function isArray($data): bool
}

// A::isAssoc(['a' => 12]) -> true
// https://stackoverflow.com/a/173479/1806628
public static function isAssoc(array $data): bool
{
if (self::isEmpty($data)) {
Expand Down Expand Up @@ -131,7 +130,6 @@ public static function uniq(array $data): array
}

// A::uniqByKey('color', [['color' => 'red', ...], ['color' => 'red', ...]]) -> [['color => 'red', ...]]
// https://www.php.net/manual/en/function.array-unique.php#116302
public static function uniqByKey($key, array $data): array
{
$i = 0;
Expand Down Expand Up @@ -204,8 +202,8 @@ public static function sortByKey(
// A::unnest([[1, 2, 3], [3, 4, [5]]]) -> [1, 2, 3, 3, 4, [5]]
public static function unnest($data, int $levels = 1): array
{
// TODO: implementálni azt, hogy több level-re legyen jó
// talán elég csak annyi, hogy rekurzívan meghívjuk az unnest-et, amíg $levels-- > 0
// TODO: implement this to work with any $levels
// it might be enought just to do a recursion until --$levels === 0
return self::reduce(
function ($acc, $x) {
return self::append($x, $acc);
Expand Down Expand Up @@ -296,7 +294,6 @@ public static function includes($value, array $data): bool
// A::slice(2, 4, [1, 2, 3, 4, 5]) -> [3, 4, 5]
public static function slice(int $fromIndex, int $toIndex, array $data): array
{
// TODO: make it work with negative numbers
return array_slice($data, $fromIndex, $toIndex);
}

Expand Down
4 changes: 0 additions & 4 deletions src/S.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public static function includes(
// S::split(' ', "aab bbc ccd") -> ['aab', 'bbc', 'ccd']
public static function split(string $separator, string $data): array
{
// TODO: ez nem biztos, hogy UTF-8 kompatibilis
// https://www.php.net/manual/en/function.mb-strtolower.php#118378
return explode($separator, $data);
}

Expand Down Expand Up @@ -93,7 +91,6 @@ public static function slice(int $startPos, int $endPos, string $data): string
}

// S::startsWith("ab", "abcd") -> true
// https://www.geeksforgeeks.org/php-startswith-and-endswith-functions/
public static function startsWith(
string $startString,
string $data,
Expand All @@ -107,7 +104,6 @@ public static function startsWith(
}

// S::endsWith("ab", "abcd") -> false
// https://www.geeksforgeeks.org/php-startswith-and-endswith-functions/
public static function endsWith(
string $endString,
string $data,
Expand Down

0 comments on commit 8eed212

Please sign in to comment.