[enh] Proposal to add class StringObject
Open
Nobody has claimed this yet.
status:ready for adoption
type:feature
- Dominant language
- PHP
- Stars
- 49
- Forks
- 18
- Avg merge
- 49m
- Merged PRs (30d)
- 1
Description
I propose to add class StringObject. Then it will be possible to manipulate strings in object-oriented style:
$baseWord = new StringObject('soft', 'UTF-8');
$projectName = $baseWord
->preprend('yii')
->addWord('project')
->upperCaseEveryWord();
$projectNameWordsCount = $projectName->wordsCount();
Then we can make class StringHelper a wrapper over class StringObject. For example:
class StringHelper
{
public static function createObject(string $string, string $encoding = null): StringObject
{
return new StringObject($string, $encoding);
}
public static function wordsCount(string $string, string $encoding = null): int
{
return static::createObject($string, $encoding)->wordsCount();
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by reading the existing StringHelper API and the issue discussion, then establish which StringObject methods and encoding behavior are in scope. Done requires an agreed API for the demonstrated operations and a consistent relationship between StringObject and StringHelper.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100