Grammar

Forgive me about my perfections.

Table of Contents
  1. Command
  2. Plural and Singular
  3. Tenses

I’m really a strict person when talking about the grammar used in the API. Even, for trivial things like the page slug that you see in the address bar would also have to be arranged carefully. My background that was not originally be born from a native English speaker mother makes me to learn English a lot. Though, my English is really not as casual as native English people are, but at least I am concerned with the consistency of the API.

Command

My first thought previously was trying to list all commands that possibly can be used globally by the classes. Then, I thought about the computer commands. In a computer, we have common API that consists of three or four commands. They are create, update, delete, and open. Even, the PHP itself also has some built-in methods like __set(), __get(), __isset() and __unset(). From that, I can then make an overview of the verbs which possibly can be used as the API:

CreateDeleteOpen
clear
+-=
addremovehas
constructdestruct
createdestroy
installuninstallrun
launchabort
mountunmount
plugeject
plugunplug
postget
pushpull
sendretrieve
setunsetget
submitcancel
uploadunloaddownload
writeeraseread

Some of the groups are missing their parts. But I have to use at least three verbs for perfect commands, so I cancel all of the incomplete groups.

The next step is choosing the candidate. There are some rules:

  • As short as possible
  • Use single word where possible.

Words like upload, unload and download are seemingly be constructed by two words with load as the base command: up·load, un·load and down·load. So I cancel this option. add, remove and has are good, but using has to open something seems improper. So I cancel this option too. write, erase and read are good and indeed look very standard for a file-based CMS, but they are not universal. What if we want to use this API for doing like creating or getting an image. We normally does not write and read images, but draw and capture.

I need the universal one, and then decided to use set, unset and get because they are the shortest, and can be used as a valid object key.

There is a problem with the unset word. I can’t use that because it is constructed by two words: un·set. Then I try to choose another alternative and found reset. reset also seems to be constructed by two words: re·set. But I can’t remember that I ever found other words that can be freely combined by the re like these. Even if they can, they are uncommon:

CreateDeleteOpen
re·add ✔re·remove ✘re·has ✘
re·launch ✔re·abort ✘
re·set ✔re·get ✘
re·write ✔re·erase ✘re·read ✔

I can find reset as a word but not with unset:

1
2
3
4

The word reset may can’t represent all of the delete command but at least people can quickly understand with the meaning of reset as start over, back to zero or back to initial, which can also means becomes null, just like the default value of every variable with no values set. We can use, for example, write, erase and read if set, reset and get seem improper to be used just like what I did for the File API.

class Common extends Genome {
    public function set() {}
    public function reset() {}
    public function get() {}
}

Update: This pattern has been changed to set, let and get.

By standardizing the commands, I hope people can learn and understand faster because they can easily guess what methods are contained on every standard class.

Plural and Singular

Other things that disturb me a lot is the plural and singular nouns. I can’t standardize these things because there are some words that simply can be suffixed with an s to make it becomes the plural noun version, and some of them need to use es or need to change the last y part into an i just before doing the es thing. Some of them also cannot be pluralized because they already can be treated as a plural or singular noun by itself, or because they have their own plural word version. Here are some examples:

SingularPlural
categorycategor[y,ies]
childchild[ren]
datadata
datumdata
kinkin
pagepage[s]
personpeople
siblingsibling[s]
statusstatus[es]
tagtag[s]

That’s why I stopped doing something like naming the folder or classes with plural noun:

.\
├── engine\
│   ├── kernel\
│   │   ├── hook.php
│   │   ├── language.php
│   │   ├── message.php
│   │   ├── page.php
│   │   └── …
│   ├── plug\
│   │   └── …
│   ├── f.php
│   └── fire.php
├── lot\
│   ├── asset\
│   │   └── …
│   ├── cache\
│   ├── extend\
│   │   ├── …
│   │   └── plugin\
│   │       ├── engine\
│   │       └── lot\
│   │            ├── …
│   │            ├── art\
│   │            └── markdown\
│   ├── page\
│   │   └── …
│   ├── shield\
│   │   ├── …
│   │   └── document\
│   └── state\
│       └── config.php
├── .htaccess
├── favicon.ico
├── index.php
└── LICENSE

[connect:../reference/file]

In the file tree above, you can see that I have an extend folder which is still problematic for me. Why? Because extend is actually a verb, not a noun!

Then why don’t you use the word extension from the start?

That thing was a mistake, I think? But, the word extend just stuck in there and looks familiar just the way it is, so maybe I will treat the word extend as a noun in this case, so that we can say extends in place of extensions to represent a group of extensions?

Or… maybe I can replace the extension folder name with a word that has no meaning at all like x to represents extension?

But, but, we already have an automatic constant creation based on the folder name, and X is already defined as a constant to represents universal placeholder character.

Oh, oh, wait! But it will not redefine itself if it is already defined! So, we can hard-code the .\lot\x path value into an EXTEND constant. Yes, this is a GOOD idea!

.\
├── engine\
└── lot\
    ├── asset\
    ├── cache\
    ├── language\
    ├── page\
    ├── shield\
    ├── state\
    └── x\

OMG. No.

And, then, to overcome the limitation on distinguishing between the plural and singular, I have created the ability to use the thing as a plural or singular thing by using only the singular thing. For example, we can process single hook or multiple hooks with a single Hook class by detecting the given input whether it is singular or plural:

Hook::set('foo', function($content) { … });
Hook::set(['foo', 'bar', 'baz'], function($content) { … });

Hook::reset('foo');
Hook::reset(['foo', 'bar', 'baz']);

Hook::fire('foo', [$content]);
Hook::fire(['foo', 'bar', 'baz'], [$content]);

So that we can avoid on making the plural class name like this:

Hook::set('foo', function($content) { … });
Hook::reset('foo');
Hook::fire('foo', [$content]);

Hooks::set(['foo', 'bar', 'baz'], function($content) { … });
Hooks::reset(['foo', 'bar', 'baz']);
Hooks::fire(['foo', 'bar', 'baz'], [$content]);

Tenses

Inspired by the AJAX things, I divided the commands mostly into three states: present, present continuous and past tense. This is what I mean:

PresentPresent ContinuousPast
back upbacking upbacked up
closeclosingclosed
createcreatingcreated
deletedeletingdeleted
log inlogging inlogged in
openopeningopened
publishpublishingpublished
savesavingsaved
sendsendingsent
updateupdatingupdated

But, as the plural and singular things, they are also can’t be standardized. Some of the verbs can be suffixed by an ing and ed but some of them can’t. Some of them need to remove the last e and i part just before doing the ing and ed thing. Some of them need to double the last part just before doing the ing and ed thing. Some of them are not a valid language form and thus can’t be appended with the ing and ed things anyway. Words like backup and login are two examples of invalid term, but they are already used globally on the web and actually constructed by two words: back·up and log·in. That’s why we can’t say backuping and logining. Instead, we have to say backing up and logging in.

But, for the sake of consistency, I have standardized these thing away into a broken English grammar only for the language key. You can then set the proper grammar in the value side. This also applies to the noun. The rules are:

  • Append an s to the key to make the plural version of the noun
  • Append an ing to the key to make the present continuous version of the verb
  • Append an ed to the key to make the past version of the verb.
backup: Back Up
backuping: Backing Up
backuped: Backed Up

category: Category
categorys: Categories

child: Child
childs: Children

close: Close
closeing: Closing
closeed: Closed

kin: Kin
kins: Kin

open: Open
opening: Opening
opened: Opened

page: Page
pages: Pages

save: Save
saveing: Saving
saveed: Saved

tag: Tag
tags: Tags

This way, we can easily tell the engine which part is the singular, which part is the plural, or which part is the present command, which part is the present continuous command and which part is the past command simply by detecting the end of a string:

echo $i . ' ' . $language->{'comment' . ($i === 1 ? "" : 's')};
echo $language->{'save' . Anemon::alter($status, [
    1 => 'ing',
    2 => 'ed'
], "")};

Update: This feature has been removed.

4 Comments

HildaLot

Довгий час була впевнена, що відмінно вмію готувати, але недавно мої страви стали скучними і почали повторюватись. Дівчина запропонувала мені переглянути оригінальні рецепти, але я не знала, де шукати. Випадково в інтернеті знайшла цей каталог і... це було як відкриття нового світу! Оказалося, що є безліч сайтів з незвичайними рецептами, про які я навіть не підозрювала. Я була в захваті від розділи з фірмовими стравами та рецептами національних кухонь. Протягом місяця я освоїла страву французької кух

KeliFluth

Завжди вважала, що чудово вмію готувати, але недавно мої страви стали скучними і втратили різноманітність. Подружка підказала мені ознайомитись нові рецепти, але я не знала, як підібрати. Випадково в інтернеті знайшла цей каталог і... це було наче знахідка скарбу! Я дізналася, що є цілий океан сайтів з незвичайними рецептами, про які я навіть не здогадувалася. Я була в захваті від підбірки з фірмовими стравами та рецептами різних кухонь світу. За цей час я спробувала страву французької кухні, тайської т&#






All HTML tags will be removed. Use Markdown syntax to style your comment body.


CancelLog In

Brensnaph

Вибачте, але я мушу поділитися кулінарною драмою, що виникла у мене минулого тижня – уявіть собі!. Моя мала вимовила бажання, щоб як кулінарний експерт спекла дещо неймовірно красиве до її ДР. Я, як завжди, безумовно, почала переглядати врятувальну знахідку у Google і отримала несподіванку. Провела аж півтора години, і це ще щастя!, мов зомбі від блогу до черговий кулінарний портал! Одні рецепти були занадто заплутані, інші - з дивними компонентами, решта - серед тоннами реклами. А згодом ваша героїня згадала щод

AnthonyFum

WinLion Casino is an up-to-date, integrated platform created with Canadian players, combining over 9,000 games alongside a full sportsbook. Thanks to its sleek design, smooth mobile experience, and attractive bonuses, it’s quickly making a name for itself. You can check out the site here: https://winlioncasino.com/

Bonuses & Promotions

New players at winlion casino can grab a welcome package stretched over their first four deposits, giving up to $1,500 in bonus funds and 240 free spins with a 40x wagering requirement. Regular players get weekly reload bonuses, up to 10% cashback on net losses (often with zero playthrough requirements), and a multi-level loyalty program that rewards you with faster withdrawals and a personal account manager. You can log in to view your progress here: https://winlioncasino.com/logins/

Games & Betting

With over 9,000 titles from top studios like Pragmatic Play and NetEnt, winlion casino canada showcases exceptional variety. Slots span classic fruit machines to Megaways and progressive jackpots. The live casino showcases roulette, blackjack, and game shows like Crazy Time in high definition. The sportsbook delivers deep hockey coverage combined with other sports and esports, with live betting and cash-out options.

Banking & Mobile

Winlion accepts Canadian dollars (CAD) and provides fast transactions via Interac, credit cards, e-wallets, and crypto. Withdrawals to e-wallets and crypto are commonly processed within 24 hours. The platform uses a Progressive Web App (PWA) that enables you to install the site to your phone’s home screen for a smooth, app-like experience with no need to download anything.

Support & Final Thoughts

24/7 live chat and email support are accessible, along with responsible gaming tools like deposit limits and self-exclusion.

Pros: Generous welcome package, vast game library, Canada-friendly banking with Interac and CAD, fast withdrawals, smooth mobile PWA, and a full sportsbook with live betting.

Cons: Anjouan license can be less familiar to some players; no traditional 2FA.

For Canadian players looking for a versatile platform that handles casino games and sports betting with consistent polish, winlion casino canada is truly worth a closer look.