随笔分类 - PHP
摘要:UTF-8 at PHP Level: Must use the mb_* functions (such as mb_strpos() and mb_strlen() ) whenever operate on Unicode string. For example you use substr(
阅读全文
摘要:add_action: add_action(string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1) Actions are the hooks that launches at spec
阅读全文
摘要:<?php function getArrayValues ($data) { static $newArr = []; // New Array if (!is_array($data)) { $newArr[] = $data; } foreach($data as $value) { if(!is_array($...
阅读全文
摘要:Purpose: To dynamically add new functionality to class instance. Booking.php BookingDecorator.php DoubleRoomBooking.php ExtraBed.php WiFi.php Tests/De
阅读全文
摘要:Purpose: A Data Mapper, is a Data Access Layer that performs bidirectional transfer of data between a persistent data store (ofen a relational databas
阅读全文
摘要:Purpose: To treat a group of objects the same way as a single instance of the object. RenderableInterface.php Form.php InputElement.php TextElement.ph
阅读全文
摘要:Purpose: Decouple an abstraction from its implementation so that the two can vary independently FormatterInterface.php PlainTextFormatter.php HtmlForm
阅读全文
摘要:Purpose: To translate one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not becaus
阅读全文
摘要:Structural Design Patterns are Design Patterns that ease the design by identifying a simple way to realize relationships between entities.
阅读全文
摘要:Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situati
阅读全文
摘要:Purpose: Similiar to the AbstractFactory, this pattern is used to create series of related or dependent objects. The difference between this and abstr
阅读全文
摘要:Purpose: This is considered to be an ANTI-PATTERN! We could use dependency injection to replace this pattern. To have only one instance of object in t
阅读全文
摘要:Purpose: It differs from the static factory because it is not static. Therefore, you can have multiple factories, differently parameterized, you can s
阅读全文
摘要:Purpose: To avoid the cost of creating objects the standard way (new Foo()) and instead create a prototype and clone it. BookPrototype.php BarBookProt
阅读全文
摘要:Purpose: The object pool pattern is a software creational design pattern that uses a set of initialized objects kept ready to use - a "pool" rather th
阅读全文
摘要:Purpose To have only a list of named instances that are used, like a singleton but with n instances. Multiton.php
阅读全文
摘要:Purpose The good point over the SimpleFactory is you can subclass it to implement different ways to create objects. For simple cases, this abstract cl
阅读全文
摘要:Purpose: Builder is an interface that build parts of a complex object. Sometimes, if the builder has a better knowledge of what it builds, this interf
阅读全文
posted @ 2019-05-07 15:57
Victor!!!!
摘要:Creational Creational Design Patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to
阅读全文
摘要:To Start working with DateTime, convert raw date and time string to an object with createFromFormat() factory method or do new DateTime to get the cur
阅读全文
posted @ 2019-05-07 11:32
Victor!!!!