User Tools

Site Tools


en:dev:all:psr:psr-1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:dev:all:psr:psr-1 [25.05.2015 18:39] – [Namespaces und Klassennamen] Manuela v.d.Deckenen:dev:all:psr:psr-1 [25.05.2015 19:57] – translated to the end mrbaseman
Line 1: Line 1:
-FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// 
- 
 [size=10]originating from [[http://www.php-fig.org/psr/psr-1/|PHP-FIG PSR-1]][/size] [size=10]originating from [[http://www.php-fig.org/psr/psr-1/|PHP-FIG PSR-1]][/size]
 ====== Basic Coding Standard ====== ====== Basic Coding Standard ======
Line 12: Line 10:
   * Files MUST use only UTF-8 without BOM for PHP code.   * Files MUST use only UTF-8 without BOM for PHP code.
   * Files SHOULD either declare symbols (classes, functions, constants, etc.) **OR** contain directly executabl code (//**cause side-effects**//), but SHOULD NOT do both.   * Files SHOULD either declare symbols (classes, functions, constants, etc.) **OR** contain directly executabl code (//**cause side-effects**//), but SHOULD NOT do both.
-  * Namespaces and classes MUST follow an "autoloading" PSR: [[en:dev:all:psr:psr-0de|PSR-0]].+  * Namespaces and classes MUST follow an "autoloading" PSR: [[en:dev:all:psr:psr-0|PSR-0]].
   * Class names MUST be declared in //**StudlyCaps**//.   * Class names MUST be declared in //**StudlyCaps**//.
   * Class constants MUST be declared in all upper case with underscore separators.   * Class constants MUST be declared in all upper case with underscore separators.
Line 67: Line 65:
 </PHP> </PHP>
  
-===== Namespaces und Klassennamen =====+===== Namespaces and Class Names =====
  
-Die Benennung von Namespaces und Klassen MUSS nach [[dev:all:psr:psr-0|PSR-0]] erfolgen.+Namespaces and classes MUST follow [[en:dev:all:psr:psr-0|PSR-0]].
  
-Das bedeutet, dass jede Klasse in einer eigenen Datei ist und einem Namespace zugewiesender wenigstens den Vendor Name als Top-Level hat.+This means each class is in a file by itselfand is in a namespace of at least one level: a top-level vendor name.
  
-Klassennamen MÜSSEN in **StudlyCaps** deklariert werden.+Class names MUST be declared in **StudlyCaps**.
  
-:!: //Anpassung für WB:// Interfaces und abstrakte Klassen müssen im Namen zusätzlich mit dem Suffix **Interface** oder **Abstract** ergänzt werden.\\+:!: //Adaption for WB:// Interfaces and abstract classes must be marked by the suffix **Interface** or **Abstract** which has to be appended to the class name.\\
  
 +Code written for PHP 5.3 and after MUST use formal namespaces.
  
-Code der für PHP-5.3 und höher geschrieben wird MUSS formale Namespace nutzen.+For example:
  
-Beispiel: 
 <PHP> <PHP>
 <?php <?php
-// php 5.3 und später:+// PHP 5.3 and later:
 namespace Vendor\Model; namespace Vendor\Model;
  
Line 92: Line 90:
 <PHP> <PHP>
 <?php <?php
-// php 5.3 und später:+// PHP 5.3 and later:
 namespace Vendor\Model; namespace Vendor\Model;
  
Line 99: Line 97:
 } }
 </PHP> </PHP>
-Code der für PHP-Versionen vor 5.3 geschrieben wird SOLL die Konvention der Pseudo-Namespaces mit **Vendor_** Präfixes für Klassennamen benutzen.+Code written for 5.2.x and before SHOULD use the pseudo-namespacing convention of **Vendor_** prefixes on class names.
 <PHP> <PHP>
 <?php <?php
-// PHP 5.2.x und früher:+// PHP 5.2.x and earlier:
 class Vendor_Model_Foo class Vendor_Model_Foo
 { {
Line 109: Line 107:
 <PHP> <PHP>
 <?php <?php
-// PHP 5.2.x und früher:+// PHP 5.2.x and earlier:
 class Vendor_Model_FooAbstract class Vendor_Model_FooAbstract
 { {
Line 115: Line 113:
 </PHP> </PHP>
  
-===== Klassen- KonstantenEigenschaften und Methoden ===== +===== Class ConstantsProperties, and Methods ===== 
-Das Term 'Klassebezieht sich auf alle KlassenInterfaces und Traits.+ 
 +The term 'classrefers to all classesinterfaces, and traits. 
 +==== Constants ==== 
 + 
 +Class constants MUST be declared in all upper case with underscore separatorsFor example:
  
-==== Konstanten ==== 
-Klassenkonstanten MÜSSEN vollständig in Großbuchstaben deklariert werden. Der Unterstrich trennt einzelne Worte. 
 <PHP> <PHP>
 <?php <?php
Line 127: Line 127:
 { {
     const VERSION = '1.0';     const VERSION = '1.0';
-    const DATE_APPROVED = '2014-08-12';+    const DATE_APPROVED = '2012-06-01';
 } }
 </PHP> </PHP>
  
-==== Eigenschaften ==== +==== Properties ====
-Dieser Leitfaden vermeidet absichtlich jede Empfehlung in Bezug auf die Verwendung von $**StudlyCaps**, $**camelCase** oder $**under_score** Eigenschaftennamen.\\ +
-Welche Namenskonvention auch benutzt wird, sie SOLLTE konsistent in einem vertretbaren Rahmen angewendet werden.+
  
-:!: //Anpassung an WB:// Es MUSS durchgehend überall das **StudlyCaps** Format benutzt werdenwobei jedem Bezeichner ein Kleinbuchstabe vorangestellt wirdder den Datentyp der Eigenschaft beschreibtDerzeit definiert sind folgende Zuweisungen+This guide intentionally avoids any recommendation regarding the use of $**StudlyCaps**, $**camelCase**, or $**under_score**  property names.\\ 
->>'**s**' => String, '**i**' => Integer/Ganzzahl, '**f**' => Fließkommazahl, '**b**' => boolean, '**a**' => Array, '**o**' => Objekt+Whatever naming convention is used SHOULD be applied consistently within a reasonable scope. That scope may be vendor-level, package-level, class-level, or method-level. 
 + 
 +:!: //Adaption to WB:// It is REQUIRED that the **StudlyCaps** format has to be used everywhere consistentlywhere a lower case letter has to be prepended to each identifierwhich indicates the data type of the propertyCurrently the following assignments are defined
 +>>'**s**' => string, '**i**' => integer, '**f**' => floating point number, '**b**' => boolean, '**a**' => array, '**o**' => object
  
 <PHP> <PHP>
Line 144: Line 145:
 </PHP> </PHP>
  
-==== Methoden ==== 
-Methodennamen MÜSSEN in **camelCase()** deklariert werden. 
  
 +==== Methods ====
 +
 +Method names MUST be declared in **camelCase()**.
  
  --- //[[manuela@isteam.de|Manuela v.d.Decken]] 12.08.2014 20:35//  --- //[[manuela@isteam.de|Manuela v.d.Decken]] 12.08.2014 20:35//
  
  
en/dev/all/psr/psr-1.txt · Last modified: 03.06.2015 15:55 by 127.0.0.1