Project

General

Profile

Feature #6256

main_api.lib.php should be a class and be renamed to api.lib.php

Added by Julio Montoya over 5 years ago. Updated almost 3 years ago.

Status:
Needs testing
Priority:
Normal
Assignee:
-
Category:
System
Target version:
Start date:
24/06/2013
Due date:
% Done:

50%

Estimated time:
Complexity:
Normal
SCRUM pts - complexity:
?

History

#1

Updated by Julio Montoya over 5 years ago

  • Status changed from New to Needs testing
  • % Done changed from 0 to 50

The file was changed from main_api.lib.php to api.lib.php.
All functions now have the "api_" prefix in order be more easy to be transformed to a class (some day).

#2

Updated by Julio Montoya over 5 years ago

I forgot to mention that we need a class in order to use the api.lib.php as a service.
So we can instance the class once and we can inject it in other services.

for example:


class Api {
    protected $session;
    function __construct($session) {
        $this-session = $session;
    }
    function doSomething() {
       $great = $this->session->get('session_example');
    }
}

Instead of

  function doSomething() {
       $great = api_get_session_example();
  }

This is important in order to write tests.

#3

Updated by Yannick Warnier over 4 years ago

  • Category set to System
  • Target version set to 2.0
#4

Updated by Yannick Warnier almost 3 years ago

  • Target version changed from 2.0 to 3.0

Also available in: Atom PDF