trouble with passing class method data to outside function

I haven’t looked in detail at your code, but what strikes me is your open_csv method.

You have the following lines

  • return $attributes['file'];

  • return $attributes['type'];

As your method currently stands, it stops and returns the value of file right after setting the attributes. Here is what return does in php

If called from within a function, the return statement immediately ends execution of the current function, and returns its argument as the value of the function call. 

Your solution would be to remove those two lines or modify your method to return the values later in an appropriate place like at the end of your method