Fixed coding styles

This commit is contained in:
Cesar Rodas 2017-05-31 09:39:13 -04:00
parent dafc795d7c
commit addc80de15
1 changed files with 20 additions and 1 deletions

View File

@ -49,14 +49,34 @@ class WC_Meta_Data {
$this->data = $this->current_data; $this->data = $this->current_data;
} }
/**
* Creates or updates a property in the metadata object.
*
* @param string $key
* @param mixed $value
*
*/
public function __set( $key, $value ) { public function __set( $key, $value ) {
$this->current_data[ $key ] = $value; $this->current_data[ $key ] = $value;
} }
/**
* Checks if a given key exists in our data. This is called internally
* by `empty` and `isset`.
*
* @param string $key
*/
public function __isset( $key ) { public function __isset( $key ) {
return array_key_exists( $key, $this->current_data ); return array_key_exists( $key, $this->current_data );
} }
/**
* Returns the value of any property.
*
* @param string $key
*
* @return mixed Property value or NULL if it does not exists
*/
public function __get( $key ) { public function __get( $key ) {
if ( array_key_exists( $key, $this->current_data )) { if ( array_key_exists( $key, $this->current_data )) {
return $this->current_data[ $key ]; return $this->current_data[ $key ];
@ -70,7 +90,6 @@ class WC_Meta_Data {
* @return array * @return array
*/ */
public function get_changes() { public function get_changes() {
$changes = array(); $changes = array();
foreach ( $this->current_data as $id => $value) { foreach ( $this->current_data as $id => $value) {
if ( ! array_key_exists( $id, $this->data ) || $value !== $this->data[ $id ] ) { if ( ! array_key_exists( $id, $this->data ) || $value !== $this->data[ $id ] ) {