attr_accessor从ruby到php

I am tying to convert a ruby code into php, from scratch. I have a few questions:

1.how would look the attr_accessor :ID :code in php? Something like this? private $ID=null; private $code=null;

  1. how would look the code in php for: def initialize(attributes={}) self.ID = attributes[:ID] self.CODE = attributes[:code]

Hope you can help, Kind regards, jhonnatan

Edited: 3. def get_ID get('get_ID') end

Will it be something like this: public function __construct(ID) get('...')

PHP equivalent for

1 - attr_accessor :ID and def get_ID get('get_ID') end

private $ID;

public function setID($ID)
{
    $this->ID = $ID;
}

public function getID() // This is the equivalent for def get_ID get('get_ID') end
{
    return $this->ID;
}

2 - def initialize(attributes={})

public function __construct($attributes)
{
    $this->ID = $attributes['ID'];
    $this->code = $attributes['code'];

}

3 - def myFunction ... end

public function myFunction() // If it's inside a class if not remove public
{
    ...
}