____  ___    _  _     _   _ _____     _______
 / ___|/ _ \  | || |   | | | |_ _\ \   / / ____|
| |  _| | | | | || |_  | |_| || | \ \ / /|  _|
| |_| | |_| | |__   _| |  _  || |  \ V / | |___
 \____|\___/     |_|   |_| |_|___|  \_/  |_____|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Short Hint for Coding : Best-Practice : Implementation a constant Property on PHP

BY: @halloworld | CREATED: Dec. 6, 2019, 12:33 p.m. | VOTES: 23 | PAYOUT: $0.05 | [ VOTE ]

[IMAGE: https://steemitimages.com/DQmUq4Q2fGmX1eNirYvuqxfwwmkX8oQG4s5FQympmnXnHq5/DQmPiKcYtB7kqiL7JBjL6JuybPbUPxNvxTAkFarMCAP5xZK_1680x8400.jpeg]

Implementation a constant Property on PHP

PHP-Klassen bieten das Konzept von Konstantenzuweisungen nicht über Klassenmethoden an. Es gibt aber Wege,
ein Final auf Properties zu erzeugen.

Die Umsetzung in PHP ist wie folgt möglich:

Beispiel:


  /**
     * @param string $pass
     *
     * @return $this
     */
    public function setfinal_pass( $pass ){
        ( $this -> pass !== NULL ) ?:$this -> pass = $pass;
        return $this;
    }

Die setfinal_pass-Methode prüft, ob der Wert von pass schon übergeben wurde.
Im Erfolgsfall passiert einfach Nichts. Wenn der Wert von pass noch NULL besitzt
kann pass parametrisiert werden.
NULL selber steht aber dann nicht mehr als WERT zur Verfügung.

webdevelopment #code #coding #dev #development #programming

codedesign #codereview #cleancode #steemit #utopian-io

technology #science #deutsch #deutschland #german #germany

orginal #originalworks #diy #php #php5 #php7 #oop #ood

webserver #webdev #practice #mail #www #web #final #patterns

[IMAGE: https://steemitimages.com/DQmURKrKGzJoojPJsCnKUF8iDZdafGDsvzjE94rpmsTXTJR/rect4138.png]

TAGS: [ #deutsch ] [ #php ] [ #code ] [ #oop ] [ #webdevelopment ] [ #coding ] [ #dev ] [ #development ]

Replies

@portalvotes | Dec. 6, 2019, 12:38 p.m. | Votes: 1 | [ VOTE ]

Du hast einen Vote von @portalvotes bekommen.

@halloworld | Dec. 6, 2019, 12:49 p.m. | Votes: 0 | [ VOTE ]

Kannst Du es mal bitte lassen meine Beiträge vollzuspammen!

@portalvotes | Dec. 8, 2019, 3:22 p.m. | Votes: 0 | [ VOTE ]

Meinst du den Kommentar oder den Vote? falls es dir um den Germanbot geht: der gehört nicht mir, sondern nutzt lediglich mein script.

@germanbot | Dec. 6, 2019, 12:51 p.m. | Votes: 0 | [ VOTE ]

Guten Tag,

Mein Name ist GermanBot und du hast von mir ein Upvote erhalten. Als UpvoteBot möchte ich dich und dein sehr schönen Beitrag unterstützen. Jeden Tag erscheint ein Voting Report um 19 Uhr, in dem dein Beitrag mit aufgelistet wird. In dem Voting Report kannst du auch vieles von mir erfahren, auch werden meine Unterstützer mit erwähnt. Schau mal bei mir vorbei, hier die Votings Reports. Mach weiter so, denn ich schaue öfter bei dir vorbei. Doch leider wird das Projekt durch Cyber-Mobbing in Gefahr gebracht, mehr kannst du hier erfahren

Euer GermanBot

@steemitboard | Jan. 7, 2020, 2:56 a.m. | Votes: 0 | [ VOTE ]

Congratulations @halloworld! You received a personal award!

https://steemitimages.com/70x70/http://steemitboard.com/@halloworld/birthday2.pngHappy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!
[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>