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


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

Re: dubbio nome funzione

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Alessandro Pellizzari <shuriken@amiran.it>
Newsgroups it.comp.www.php
Subject Re: dubbio nome funzione
Date Mon, 21 Jan 2019 13:24:51 +0000
Lines 36
Message-ID <galvh3Fchf9U1@mid.individual.net> (permalink)
References <q244rc$65c$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net lxT51AAIlaV9alrq2xwJSABqxOATEVE0Z1AO5vmyOOpbEGJVQ=
Cancel-Lock sha1:ofe4/ayjCiC35w3foJOTCEtOwwk=
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.4.0
In-Reply-To <q244rc$65c$1@gioia.aioe.org>
Content-Language en-GB
Xref csiph.com it.comp.www.php:22507

Show key headers only | 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