public static function getSheet($identity=null, $autoCreate=false)
    {
        // Deafult is get active sheet
        if (!$identity) {
            
            return self::$_objSheet;
        }

        // Giving $identity situation
        if (is_numeric($identity)) {
            
            $objSheet = self::$_objSpreadsheet->getSheet($identity);
            // Auto create if not exist
            if (!$objSheet && $autoCreate) {
                // Create a new sheet by index
                $objSheet = self::setSheet($identity)
                    ->getSheet();
            }
        }
        elseif (is_string($identity)) {
            
            $objSheet = self::$_objSpreadsheet->getSheetByName($identity);
            // Auto create if not exist
            if (!$objSheet && $autoCreate) {
                // Create a new sheet by name
                $objSheet = self::setSheet(null, $identity, true)
                    ->getSheet();
            }
        }

        return $objSheet;
    }
public static function getSheet($identity=null, $autoCreate=false)
    {
        // Deafult is get active sheet
        if (!$identity) {
            
            return self::$_objSheet;
        }

        // Giving $identity situation
        if (is_numeric($identity)) {
            
            $objSheet = self::$_objSpreadsheet->getSheet($identity);
            // Auto create if not exist
            if (!$objSheet && $autoCreate) {
                // Create a new sheet by index
                $objSheet = self::setSheet($identity)
                    ->getSheet();
            }
        }
        elseif (is_string($identity)) {
            
            $objSheet = self::$_objSpreadsheet->getSheetByName($identity);
            // Auto create if not exist
            if (!$objSheet && $autoCreate) {
                // Create a new sheet by name
                $objSheet = self::setSheet(null, $identity, true)
                    ->getSheet();
            }
        }

        return $objSheet;
    }
public static function getSheet ( $ identity = null , $ autoCreate = false ) { // Deafult is get active sheet if ( ! $ identity ) { return self :: $ _objSheet ; } // Giving $identity situation if ( is_numeric ( $ identity ) ) { $ objSheet = self :: $ _objSpreadsheet -> getSheet ( $ identity ) ; // Auto create if not exist if ( ! $ objSheet && $ autoCreate ) { // Create a new sheet by index $ objSheet = self :: setSheet ( $ identity ) -> getSheet ( ) ; } } elseif ( is_string ( $ identity ) ) { $ objSheet = self :: $ _objSpreadsheet -> getSheetByName ( $ identity ) ; // Auto create if not exist if ( ! $ objSheet && $ autoCreate ) { // Create a new sheet by name $ objSheet = self :: setSheet ( null , $ identity , true ) -> getSheet ( ) ; } } return $ objSheet ; }
Get PhpSpreadsheet Sheet object from cache

@param int|string $identity Sheet index or name
@param bool $autoCreate
@return object PhpSpreadsheet Sheet object
Get PhpSpreadsheet Sheet object from cache