Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #22507

Re: dubbio nome funzione

From Alessandro Pellizzari <shuriken@amiran.it>
Newsgroups it.comp.www.php
Subject Re: dubbio nome funzione
Date 2019-01-21 13:24 +0000
Message-ID <galvh3Fchf9U1@mid.individual.net> (permalink)
References <q244rc$65c$1@gioia.aioe.org>

Show all headers | View raw


On 21/01/2019 09:53, sky winter wrote:

>      function ABC( $from ): array {
>          return [
>              'From'     => $from,
>              'X-Mailer' => 'PHP/' . phpversion(),
>          ];
>      }
> 
> La funzione ABC come potrei chiamarla?

Dipende dove si trova.

Per esempio, se è dentro una classe che gestisce le mail, puoi chiamarla 
solo `headers`.

Se è in un namespace che gestisce diverse cose tra cui il mailing, 
`mailHeaders`.

Se è in una collezione di funzioni generiche, magari 
`createMailHeadersForFrom` :D

Non userei `factory` per evitare confusione col Factory Pattern, o 
`build` per lo stesso motivo (a meno che non sia un builder per headers, 
ma in quel caso questa sarebbe `__construct` ;)

`helper` è troppo generico e `make` lo vedo più come qualcosa che fa 
tutto dall'inizio alla fine.

> La domanda può sembrare imbarazzante, eppure trovare una convenzione 
> adatta non è così semplice

There are 2 hard things in CompSci: cache invalidation, naming things, 
off-by-1 errors and Segmentation Fault. :P

Bye.

Back to it.comp.www.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

dubbio nome funzione sky winter <sky@bo.bo> - 2019-01-21 10:53 +0100
  Re: dubbio nome funzione Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-21 13:24 +0000
    Re: dubbio nome funzione sky winter <sky@bo.bo> - 2019-01-21 16:11 +0100
      Re: dubbio nome funzione Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-22 10:11 +0000

csiph-web