Passed
Pull Request — develop (#33)
by Carlo
02:44
created

MageApp   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
wmc 2
lcom 0
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A init() 0 4 1
1
<?php
2
3
namespace Magefix\Magento\Adapter;
4
5
use Mage;
6
/**
7
 * Class MageApp
8
 * @package Magefix\Magento\Adapter
9
 * @author  Carlo Tasca <[email protected]>
10
 */
11
class MageApp
12
{
13
    /**
14
     * Loads Magento app in adapters
15
     *
16
     * Solves PHP Fatal error such as:
17
     *
18
     * Call to a member function getModelInstance() on a non-object in /vagrant/public/app/Mage.php on line 463
19
     * when used in testing frameworks, e.g. PHPSpec
20
     *
21
     * @return \Mage_Core_Model_App
22
     */
23
    public static function get()
24
    {
25
        return Mage::app();
26
    }
27
28
    /**
29
     * Initiate Mage::app() in Adapters
30
     */
31
    public static function init()
32
    {
33
        Mage::app();
34
    }
35
}
36