-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6378dfb
commit d25bd7a
Showing
6 changed files
with
137 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# Php with Docker | ||
|
||
## USe shell command | ||
## Use shell command | ||
|
||
For use shell command of php server, use bellow shell command | ||
```sh | ||
|
||
```sh {"id":"01HKSG0MQA06WJTW4V1ZQ588DK"} | ||
docker exec -it crazytest-php-fpm-1 bash | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* Utility | ||
* | ||
* Front TS Scrips for multiple tasks | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2023 Kévin Zarshenas | ||
*/ | ||
|
||
/** | ||
* Dependances | ||
*/ | ||
|
||
/** | ||
* Arrays | ||
* | ||
* Methods for manage arrays | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2023 Kévin Zarshenas | ||
*/ | ||
export default class Objects { | ||
|
||
/** Public static methods | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Array Filter | ||
* | ||
* @param obj Input object | ||
* @param separator Separator to nested (default ".") | ||
* @return any | ||
*/ | ||
public static convertToNestedObject = (obj:Object, separator:string = '.'):any => { | ||
|
||
// Declare result | ||
const result = {}; | ||
|
||
// Iteration obj | ||
for (const key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
if (key.includes(separator)) { | ||
const keys = key.split(separator); | ||
let current = result; | ||
|
||
for (let i = 0; i < keys.length; i++) { | ||
if (i === keys.length - 1) { | ||
current[keys[i]] = obj[key]; | ||
} else { | ||
current[keys[i]] = current[keys[i]] || {}; | ||
current = current[keys[i]]; | ||
} | ||
} | ||
} else if (typeof obj[key] === 'object' && obj[key] !== null) { | ||
result[key] = this.convertToNestedObject(obj[key], separator); | ||
} else { | ||
result[key] = obj[key]; | ||
} | ||
} | ||
} | ||
|
||
// Return result | ||
return result; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters